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" ;;
B) backup=0 ;;
L) ignorelibdeps=1 ;;
l) justlist=1 ;;
+ U) uninstall=1 ;;
*) die "usage ..." ;;
esac
done
-*) 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"
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
for pkgid in $to_remove; do
printf 'remove %s\n' $pkgid
done
+ exit 0
fi
if [ -z "$merge" ] && [ -z "$to_remove" ]; then
exit 0
fi
-echo "merge: $merge"
+test -n "$merge" && echo "install: $merge"
+test -n "$to_remove" && echo "remove: $to_remove"
# finally, merge everything
for mergepkg in $merge; do
if [ $pkgfile != $ZPMDB ]; then
echo merging $pkgfile $pkgid
zpm merge -Fuv -f "$pkgfile" $pkgid
+ if [ $? -ne 0 ]; then
+ die "unable to merge $pkgfile"
+ fi
fi
to_install="$to_install $pkgid"
done