]> pd.if.org Git - zpackage/blobdiff - zpm-ipkgfile
add pkgname arg to newpackage
[zpackage] / zpm-ipkgfile
index 04f980e25b4939df135f5e088c1b14fc8203e481..a7be95a862fdecdeaf6a9b1634bdfa49ce2cc9dc 100755 (executable)
@@ -1,5 +1,12 @@
 #!/bin/sh
 
+# install a file from a package
+# -f pkgfile
+# -R root of pkg
+# -P prefix to file
+# -S strip prefix
+# -p pkgname
+
 pkgroot=/
 
 while getopts :f:v:r:d:a:u:l:p:b:P:R: opt; do
@@ -8,12 +15,6 @@ while getopts :f:v:r:d:a:u:l:p:b:P:R: opt; do
                 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
@@ -25,7 +26,7 @@ die() {
 }
 
 pkgfileinfo() {
-       sqlite3 $pkgfile<<EOS
+       zpm shell $pkgfile<<EOS
 select $1 from packagefiles
        where path='$2'
        and package||'-'||version||'-'||release = '$pkg'
@@ -41,21 +42,26 @@ fi
 pkg="$1"
 shift
 
+ZPMPKGFILE=$pkgfile
+export ZPMPKGFILE
+
 set -e
 for path in $*; do
-       fhash=$(pkgfileinfo hash $path)
-       mode=$(pkgfileinfo mode $path)
-       owner=$(pkgfileinfo username $path)
-       group=$(pkgfileinfo groupname $path)
-       ftype=$(pkgfileinfo filetype $path)
+       echo installing $path from $pkg
+       set -x
+       fhash=$(zpm pkgfileinfo hash $path)
+       mode=$(zpm pkgfileinfo mode $path)
+       ftype=$(zpm pkgfileinfo filetype $path)
+       owner=$(zpm pkgfileinfo username $path)
+       group=$(zpm pkgfileinfo groupname $path)
+
        name=$(basename -- $path)
+       dir=$(dirname -- $path)
 
        if [ "$pkgroot" != '/' ]; then
-               dir=$pkgroot/$(dirname -- $path)
+               dir=$pkgroot/$dir
                dir=${dir%/.}
                if [ "$dir" = "//" ]; then dir=/ ; fi
-       else
-               dir=''
        fi
 
        tmppath=$dir/.installing.$name