summaryrefslogtreecommitdiffstats
path: root/punani/bin
diff options
context:
space:
mode:
authortv <tv@iiso>2011-11-20 11:49:00 +0100
committertv <tv@iiso>2011-11-20 11:49:00 +0100
commit4c53eae0cd6d1644f5ad3e79e5eb5611975079a1 (patch)
tree6ec59aa4c69e6c126c3fd49a3a12150c05948601 /punani/bin
parent4b8fe23246540d1a9dded43d40f01bb093dbfb06 (diff)
//punani: allow multiple PACKAGE
Diffstat (limited to 'punani/bin')
-rwxr-xr-xpunani/bin/punani29
1 files changed, 17 insertions, 12 deletions
diff --git a/punani/bin/punani b/punani/bin/punani
index a7e86d96..4be74f77 100755
--- a/punani/bin/punani
+++ b/punani/bin/punani
@@ -2,11 +2,8 @@
set -euf
PUNANI_HOST="${PUNANI_HOST-http://euer.krebsco.de:9111}"
-
-if [ $# -ne 2 ];then
- echo "usage: `basename $0` (install|remove) PACKAGE"
- exit 23
-fi
+ACTION="$1"; shift
+PKGS="$*"
## find package manager
if ! :; then : # dummy case, so the rest has a common format
@@ -37,15 +34,22 @@ else
fi
## find package name
-PKG="$2"
-RESOLVED=`wget -O- $PUNANI_HOST/$PACKER_CMD/$PKG 2>/dev/null || :`
-if [ ! "$RESOLVED" ];then
- echo "Error 2: could not resolve '$PKG'; no punani for you!" >&2
- exit 23
+if test -n "$PKGS"; then
+ for PKG in $PKGS; do
+ RES="`wget -O- $PUNANI_HOST/$PACKER_CMD/$PKG 2>/dev/null || :`"
+ if [ ! "$RES" ]; then
+ echo "Error 2: could not resolve '$PKG'; no punani for you!" >&2
+ exit 23
+ fi
+ RESOLVED="${RESOLVED+$RESOLVED }$RES"
+ done
+else
+ echo "Error 1: no PACKAGE specified." >&2
+ ACTION="usage"
fi
## dispatch
-case "$1" in
+case "$ACTION" in
install)
set -x
exec sudo $PACKER_CMD $INSTALL_PARAM $RESOLVED
@@ -55,5 +59,6 @@ case "$1" in
exec sudo $PACKER_CMD $REMOVE_PARAM $RESOLVED
;;
*)
- echo "usage: `basename $0` (install|remove) PACKAGE"
+ echo "usage: `basename $0` (install|remove) PACKAGE..."
+ exit 23
esac