X-Git-Url: https://pd.if.org/git/?p=zpackage;a=blobdiff_plain;f=zpm-install;h=0a7cf3ed2a8335fe2d2ebede5c095ad264255fca;hp=911ebf72bcc76702df8041a8ed799814ca4a3ab2;hb=09c80a1f8918d888063f4d1a75921a99fe5f0b5c;hpb=6cd290b379076aa17eed531cb23585b20cae3a37 diff --git a/zpm-install b/zpm-install index 911ebf7..0a7cf3e 100755 --- a/zpm-install +++ b/zpm-install @@ -10,6 +10,12 @@ die() { exit 1 } +changeall() { + for pkgid in $(zpm list -s $1); do + zpm pkg $pkgid status=$2 + done +} + dryrun=0 verbose=0 runscripts=1 @@ -18,11 +24,13 @@ absorb=0 overwrite=0 syncopts='' installall=0 +mergefiles=0 # zpm-install [-SCn] [ -d localdb ] [ -f pkgfile ] [ -R installroot ] pkgstr ... -while getopts f:d:R:nSCvAOa opt; do +while getopts f:d:R:nSCvAOaF opt; do case $opt in f) pkgfile="$OPTARG" ;; + F) mergefiles=1 ;; d) localdb="$OPTARG" ;; R) rootdir="$OPTARG" ;; S) runscripts=0 ;; @@ -135,6 +143,10 @@ for pkgid in $pkglist; do if [ $? -ne 0 ]; then die "pre-install script for $pkgid failed" fi + else + if zpm script -f $pkgfile -Fql -p pre-install $pkgid; then + zpm note -e -p $pkgid -m 'pre-install script not run' + fi fi # remove the package if it exists. can't be in an installed @@ -150,13 +162,19 @@ for pkgid in $pkglist; do if [ $verbose -gt 0 ]; then echo merging $pkgid fi - zpm merge -u -F -f $pkgfile -s installing $pkgid + if [ $mergefiles -eq 1 ]; then + zpm merge -u -F -f $pkgfile -s installing $pkgid + else + zpm merge -u -f $pkgfile -s installing $pkgid + fi if [ $? -ne 0 ]; then die "merging $pkgid failed" fi else zpm pkg $pkgid status=installing fi + + zpm shell "$ZPMDB" "update packages set status='updating' where status='installed' and package in (select package from packages where status = 'installing')" done # do the sync @@ -170,13 +188,21 @@ if [ $verbose -gt 0 ]; then syncopts="$syncopts -v" fi +if [ "$pkgfile" != "$ZPMDB" ]; then + syncopts="$syncopts -f $pkgfile" +fi + +#zpm shell $ZPMDB 'select * from syncinfo' +#zpm list -v zpm syncfs $syncopts syncrv=$? -for pkgid in $pkglist; do - zpm pkg $pkgid status=dryrun -done +if [ $dryrun -gt 0 ]; then + for pkgid in $pkglist; do + zpm pkg $pkgid status=dryrun + done +fi if [ $syncrv -ne 0 ]; then zpm pkg $pkgid status=failed @@ -197,10 +223,14 @@ fi for pkgid in $pkglist; do package=$(zpm parse -n $pkgid) - current=$(zpm list -s installed "$package") + current=$(zpm list -s updating "$package") if [ $runscripts -gt 0 ]; then - zpm script -f $pkgfile -p post-install $pkgid $current + zpm script -p post-install $pkgid $current + else + if zpm script -Fql -p post-install $pkgid; then + zpm note -e -p $pkgid -m 'post-install script not run' + fi fi if [ -n "$current" ]; then @@ -212,6 +242,13 @@ for pkgid in $pkglist; do # TODO skip configure if not on a terminal, regardless of settings # TODO will need force option if [ $runconfigure -gt 0 ]; then - zpm script -f $pkgfile -p configure $pkgid + zpm script -p configure $pkgid + else + if zpm script -Fql -p configure $pkgid; then + zpm note -e -p $pkgid -m 'configure script not run' + fi fi + done + +changeall updating updated