X-Git-Url: https://pd.if.org/git/?p=zpackage;a=blobdiff_plain;f=zpm-update;h=44529783408c1c195c4524ae071d53e574c3622a;hp=c85b0edf9fc7e9944015da2659cd6c160008ae5a;hb=556cd1f04308ff45196f9422f1568cdd493171a7;hpb=4b853577a65802c130837d9a9669ca3e4413dee8 diff --git a/zpm-update b/zpm-update index c85b0ed..4452978 100755 --- a/zpm-update +++ b/zpm-update @@ -103,9 +103,12 @@ backup=0 ignorelibdeps=0 justlist=0 +# treat un-adorned packages as uninstalls +uninstall=0 + # TODO option to attempt to resume an ongoing install # zpm-install [-SCn] [ -d localdb ] [ -f pkgfile ] [ -R installroot ] pkgstr ... -while getopts f:d:R:nSCvAObBL opt; do +while getopts f:d:R:nSCvAObBLU opt; do case $opt in f) pkgfile="$OPTARG" ;; d) localdb="$OPTARG" ;; @@ -122,6 +125,7 @@ while getopts f:d:R:nSCvAObBL opt; do B) backup=0 ;; L) ignorelibdeps=1 ;; l) justlist=1 ;; + U) uninstall=1 ;; *) die "usage ..." ;; esac done @@ -141,8 +145,9 @@ for op in "$@"; do -*) pkgid=$(zpm findpkg -I "${op#-}") if [ -n "$pkgid" ]; then to_remove="$to_remove $pkgid" + else + die "$op not installed" fi - # else warn not installed ;; +*) pkg=${op#+} search="$search $pkg" @@ -156,7 +161,17 @@ for op in "$@"; do die "can't find $pkg in $file" fi ;; - *) search="$search $op" + *) + if [ $uninstall -eq 0 ]; then + search="$search $op" + else + pkgid=$(zpm findpkg -I "${op}") + if [ -n "$pkgid" ]; then + to_remove="$to_remove $pkgid" + else + die "$op not installed" + fi + fi ;; esac done