3 #package=${1:-$ZPMPACKAGE}
4 pkgver=${ZPMPACKAGEVER:-1.0}
5 pkgrel=${ZPMPACKAGEREL:-1}
9 # allocate an install id, perhaps hash package and timestamp
10 # installid=$(echo $(date) $pkglist | zpm hash)
12 # extract pre-scripts and run them
13 # get list of paths to install
14 # for each path, if directory, create and set mode
15 # for each path, create leading directories
16 # extract to something like /var/tmp/.hash, with low perms
17 # only atomic if same filesystem, so use .installid.hash in the
21 # after all the files, extract post scripts and run them
23 # also need to mark package as installing so if it fails part way
24 # through, it can be finished later
25 # probably also want an option to "backup" any packages being upgraded
26 # so it's trivial to downgrade or to revert if the install fails
28 # option for "multipackage" just to let the system know that's what you meant
29 # option to take filenames from stdin
30 # parse package, version, release from file if not given
31 # TODO what's the difference between prefix and pkgroot
32 # need an option to not chown the files
33 # option to install but not merge/track
34 while getopts :f:v:r:d:a:u:l:p:b:P:R: opt; do
36 R) pkgroot="$OPTARG" ;;
37 f) pkgfile="$OPTARG" ;;
38 v) pkgver="$OPTARG" ;;
39 r) pkgrel="$OPTARG" ;;
40 d) description="$OPTARG" ;;
43 l) licenses="$OPTARG" ;;
44 p) packager="$OPTARG" ;;
45 b) builddate="$OPTARG" ;;
46 P) prefix="$OPTARG" ;;
56 if [ -z "$pkgfile" ]; then
57 # actually, if no pkgfile, get pkgfile from repo
58 # but need to loop over finding package files then
59 # so this program probably needs to be "install from pkgfile"
60 # and a separate one that will loop over a package
61 # spec list and find from repos
62 die "must specify package file"
63 pkgfile="$package-$pkgver-$pkgrel.zpm"
72 pkglist=$(zpm findpkg $pkgfile)
76 zpm shell $pkgfile<<EOS
77 select path from packagefiles
78 where package||'-'||version||'-'||release = '$pkg'
83 for pkg in $pkglist; do
84 # TODO find scripts marked as pre-install
85 # TODO if this is an upgrade, run pre-upgrade
87 # TODO get total size of install so we can do a progress bar
89 # add package info to local package db
90 # zpm merge -L -f $pkgfile $pkg
92 # mark package in localdb as installing
93 # zpm setmark installing $pkg
94 # install all the files for a package
95 # TODO install directories first in order of path length
96 echo installing $pkglist
97 filecount=$(pathlist | wc -l)
100 pathlist | xargs -t zpm ipkgfile -R "$pkgroot" -f $pkgfile -- $pkg
102 # TODO find scripts marked as post-install
103 # TODO if this is an upgrade, run post-upgrade
105 # mark as ready for install
106 #zpm setmark ready $pkg
109 #zpm setmark installed $pkglist