]> pd.if.org Git - zpackage/commitdiff
log when aborting install
authorNathan Wagner <nw@hydaspes.if.org>
Fri, 26 Oct 2018 05:03:46 +0000 (05:03 +0000)
committerNathan Wagner <nw@hydaspes.if.org>
Sat, 3 Nov 2018 12:39:52 +0000 (12:39 +0000)
zpm-install

index 29d8c5d2fc270f0299bc5ecfcbbd46b280c405e1..edd84050a5d2eee8f05d08a3b7e89bf17a86f56e 100755 (executable)
@@ -6,6 +6,7 @@ warn() {
 
 die() {
        echo $* 1>&2
+       zpm log -i -a 'aborting install' -p "$pkgid" "$*"
        exit 1
 }
 
@@ -144,11 +145,9 @@ if [ -n "$rootdir" ]; then
        export ZPM_ROOT_DIR
 fi
 
-# TODO mark already installed packages as updating?
 for pkgstr in "$@"; do
        pkgid=$(zpm findpkg -f $pkgfile $pkgstr)
        if [ $? -ne 0 ]; then
-               # TODO log
                die "can't find package $pkgstr in $pkgfile"
        fi
 
@@ -167,7 +166,6 @@ for pkgstr in "$@"; do
                # zpm runscript -p pre-upgrade $current $pkgid
                zpm runscript -f $pkgfile -p pre-install $pkgid $current
                if [ $? -ne 0 ]; then
-                       # TODO log
                        die "pre-install script for $pkgid failed"
                fi
        fi
@@ -184,11 +182,11 @@ for pkgstr in "$@"; do
                zpm rmpackage $pkgid
                zpm merge -f $pkgfile -s installing $pkgid
                if [ $? -ne 0 ]; then
-                       # TODO log
                        die "merging $pkgid failed"
                fi
+       else
+               zpm pkg $pkgid status=installing
        fi
-       # TODO but need to mark as installing if not merged
 
        #zpm shell $ZPMDB 'select * from install_status' 1>&2
        if [ $dryrun -gt 0 ]; then
@@ -206,6 +204,7 @@ for pkgstr in "$@"; do
        zpm syncfs $syncopts -f $pkgfile
 
        if [ $? -ne 0 ]; then
+               zpm pkg $pkgid status=failed
                die 'zpm-syncfs failed';
        fi