#!/bin/sh
-#package=${1:-$ZPMPACKAGE}
+# what we need to install a package:
+
+# recording repo: where we record what we've done
+# source: where we get the package and files from
+# install root: really just a prefix, but thought about differently,
+# and we might need to do a chroot
+
+# zpm install [options] <package ...>
+
pkgver=${ZPMPACKAGEVER:-1.0}
pkgrel=${ZPMPACKAGEREL:-1}
# TODO what's the difference between prefix and pkgroot
# need an option to not chown the files
# option to install but not merge/track
-while getopts :f:v:r:d:a:u:l:p:b:P:R: opt; do
+
+# options
+# -R install root, if installing as root, will chroot?
+# -C no chroot, even if root
+# -N no pre-scripts
+# -X no post-scripts
+# -f source repository file
+# -d local (recording) repository database
+# -D don't locally record
+# -t only files matching tags
+# -T exclude files matching tags
+
+chroot=1
+
+while getopts :R:CNXf:d:Dt:T: opt; do
case $opt in
R) pkgroot="$OPTARG" ;;
+ C) chroot=0 ;;
f) pkgfile="$OPTARG" ;;
- v) pkgver="$OPTARG" ;;
- r) pkgrel="$OPTARG" ;;
- d) description="$OPTARG" ;;
- a) arch="$OPTARG" ;;
- u) url="$OPTARG" ;;
- l) licenses="$OPTARG" ;;
- p) packager="$OPTARG" ;;
- b) builddate="$OPTARG" ;;
- P) prefix="$OPTARG" ;;
esac
done
+
shift $((OPTIND - 1))
die() {
fi
pathlist() {
- sqlite3 $pkgfile<<EOS
+ zpm shell $pkgfile<<EOS
select path from packagefiles
where package||'-'||version||'-'||release = '$pkg'
;
EOS
}
+# find a repo file for a given package
+findrepofor() {
+ false
+}
+
+installpkg() (
+ package="$1"
+)
+
for pkg in $pkglist; do
# TODO find scripts marked as pre-install
# TODO if this is an upgrade, run pre-upgrade
# zpm setmark installing $pkg
# install all the files for a package
# TODO install directories first in order of path length
- pathlist | xargs zpm ipkgfile -R "$pkgroot" -f $pkgfile -- $pkg
+ echo installing $pkglist
+ filecount=$(pathlist | wc -l)
+ echo $filecount files
+ #pathlist
+ pathlist | xargs zpm ipkgfile -R "$pkgroot" -f $pkgfile -- $pkg
# TODO find scripts marked as post-install
# TODO if this is an upgrade, run post-upgrade