chiark / gitweb /
Add devscripts for qa.d.o
[dsa-metapackages.git] / apt-in-chroot
index 4e0028a6748bf5d09bd90f3f2ae1bea4269e34eb..9082965e06192d672e3960cd5270a015bac46817 100755 (executable)
@@ -24,7 +24,7 @@ VALID_CHROOTS_PARSE="$(/usr/bin/dchroot -l 2>&1 | /usr/bin/awk -F": " '{print $2
 
 usage() {
         bn="`basename "$0"`"
-       echo "Usage: $bn <chroot> <apt sub-command> <package>"
+       echo "Usage: $bn <chroot> <apt sub-command> [<package>]"
        echo ""
        echo "  allowed chroots are ($VALID_CHROOTS_PARSE)"
        echo ""
@@ -33,6 +33,7 @@ usage() {
        echo "          + remove"
        echo "          + purge"
        echo "          + build-dep"
+       echo "          + update"
 }
 
 
@@ -48,7 +49,7 @@ PACKAGES=$*
 
 
 case "$APTCMD" in
-install|remove|purge|build-dep)
+install|remove|purge|build-dep|update)
        # those are the allowed apt sub-commands
        ;;
 *)
@@ -57,11 +58,7 @@ install|remove|purge|build-dep)
        ;;
 esac
 
-grep -qFx $CHROOT <<< "$VALID_CHROOTS"
-
-RET=$?
-
-if [ "$RET" == "0" ]; then
+if echo "$VALID_CHROOTS" | grep -qFx "$CHROOT"; then
        # valid chroot
        echo "Will run '/usr/sbin/chroot $CHROOT_DIR/$CHROOT apt-get $APTCMD $PACKAGES'"
        /usr/sbin/chroot $CHROOT_DIR/$CHROOT apt-get $APTCMD $PACKAGES