X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=zpm-install;h=487740ddc4dbca063b3cbab96d1177dfa7a60bab;hb=c7ba15526ed6b0bebccfa080ad021654a8c311ae;hp=e722bf321f1ea85b4be8b75427c86d47aeaa6449;hpb=ecdd57da7df775c039aee834e1f74172004f352b;p=zpackage diff --git a/zpm-install b/zpm-install index e722bf3..487740d 100755 --- a/zpm-install +++ b/zpm-install @@ -1,16 +1,27 @@ #!/bin/sh -package=${1:-$ZPMPACKAGE} -shift +#package=${1:-$ZPMPACKAGE} pkgver=${ZPMPACKAGEVER:-1.0} pkgrel=${ZPMPACKAGEREL:-1} pkgroot=/ +# allocate an install id, perhaps hash package and timestamp +# extract pre-scripts and run them +# get list of paths to install +# for each path, if directory, create and set mode +# for each path, create leading directories +# extract to something like /var/tmp/.hash, with low perms +# only atomic if same filesystem, so use .installid.hash in the +# install directory +# set perms and such +# move into place +# after all the files, extract post scripts and run them + # 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" ;; @@ -25,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