3 # install a file from a package
12 while getopts :f:v:r:d:a:u:l:p:b:P:R: opt; do
14 R) pkgroot="$OPTARG" ;;
15 f) pkgfile="$OPTARG" ;;
16 v) pkgver="$OPTARG" ;;
17 r) pkgrel="$OPTARG" ;;
18 P) prefix="$OPTARG" ;;
29 zpm shell $pkgfile<<EOS
30 select $1 from packagefiles
32 and package||'-'||version||'-'||release = '$pkg'
37 # if not from a package file, from local db
38 if [ -z "$pkgfile" ]; then
39 die "installing from non-pkgfile not supported"
50 printf '%s installing %s\n' $pkg $path
51 fhash=$(zpm pkgfileinfo hash $path)
52 mode=$(zpm pkgfileinfo mode $path)
53 ftype=$(zpm pkgfileinfo filetype $path)
54 owner=$(zpm pkgfileinfo username $path)
55 group=$(zpm pkgfileinfo groupname $path)
57 name=$(basename -- $path)
58 dir=$(dirname -- $path)
60 if [ "$pkgroot" != '/' ]; then
63 if [ "$dir" = "//" ]; then dir=/ ; fi
66 tmppath=$dir/.installing.$name
68 # can't use install because it's not posix.
69 # probably worth writing a zpm-install, but with
70 # a different name since that wants to be a package install
71 # probably makes the most sense for extract to know how
72 # to do the extract to temp and such, then
73 # you can just add the -S option (secure)
76 zpm extract $pkgfile $fhash $tmppath 0
77 chown $owner:$group $tmppath
79 # TODO mv -n non-posix, going to need to have extract do all
81 mv -n $tmppath $dir/$name