From: Nathan Wagner Date: Fri, 31 Mar 2017 04:55:36 +0000 (-0500) Subject: general zpm-install work X-Git-Tag: v0.1.6~128 X-Git-Url: https://pd.if.org/git/?p=zpackage;a=commitdiff_plain;h=2bacfde5f520d3b16fee4ab4b825726e55cb132e general zpm-install work --- diff --git a/zpm-install b/zpm-install index 8123b9b..487740d 100755 --- a/zpm-install +++ b/zpm-install @@ -1,7 +1,6 @@ #!/bin/sh -package=${1:-$ZPMPACKAGE} -shift +#package=${1:-$ZPMPACKAGE} pkgver=${ZPMPACKAGEVER:-1.0} pkgrel=${ZPMPACKAGEREL:-1} @@ -22,7 +21,7 @@ pkgroot=/ # option for "multipackage" just to let the system know that's what you meant # option to take filenames from stdin # parse package, version, release from file if not given -while getopts :f:v:r:d:a:u:l:p:b:P: opt; do +while getopts :f:v:r:d:a:u:l:p:b:P:R: opt; do case $opt in R) pkgroot="$OPTARG" ;; f) pkgfile="$OPTARG" ;; @@ -37,78 +36,56 @@ while getopts :f:v:r:d:a:u:l:p:b:P: opt; do P) prefix="$OPTARG" ;; esac done +shift $((OPTIND - 1)) set -e if [ -z "$pkgfile" ]; then + # actually, if no pkgfile, get pkgfile from repo pkgfile="$package-$pkgver-$pkgrel.zpm" fi -appid=$(sqlite3 $pkgfile 'pragma application_id;' | ( echo obase = 16; cat - ) | bc) -if [ "$appid" != "5A504442" ]; then - echo $pkgfile does not appear to be a zpm package file +die() { + echo $* 1&>2 exit 1 -fi - -# check if package exists -# run preinstall or preupgrade stage, in chroot - -# add package info and mark installing to local package database -# each path: add to local db, extract, set mode/owner/mtime etc. -# mark install done in local database +} -for path in $*; do - mtime=$(stat -c '%Y' $path) - uid=$(stat -c '%u' $path) - gid=$(stat -c '%g' $path) - username=$(stat -c '%U' $path) - groupname=$(stat -c '%G' $path) - mode=$(stat -c '%a' $path) +set -e +zpm test -v $pkgfile +set +e - # strip off leading slashes - rpath=$(echo "$path" | sed -e 's|^/*||') - # and a leading ./ - rpath=${rpath#./} - rpath=$(echo "$rpath" | sed -e 's|^/*||') +if [ $# -gt 0 ]; then + pkglist="$@" +else + pkglist=$(zpm findpkg $pkgfile) +fi - if [ -z "$rpath" ] || [ "$rpath" = '.' ]; then - continue - fi +pathlist() { + sqlite3 $pkgfile< $target"} -printf "%s\n" $path + # mark as ready for install + #zpm setmark ready $pkg done + +#zpm setmark installed $pkglist