vm: Parse all options from when downloading updates (#348)

Collect options and pkg names to separate variables and check if any pkg name
was given, not any argument.
This commit is contained in:
Marek Marczykowski 2011-09-12 14:32:56 +02:00
parent 0dee090a65
commit bd67aa341c

View File

@ -4,14 +4,23 @@ DOM0_UPDATES_DIR=/var/lib/qubes/dom0-updates
DOIT=0 DOIT=0
GUI=1 GUI=1
OPTS=
PKGLIST=
while [ -n "$1" ]; do while [ -n "$1" ]; do
if [ "x--doit" = "x$1" ]; then case "$1" in
--doit)
DOIT=1 DOIT=1
elif [ "x--nogui" = "x$1" ]; then ;;
--nogui)
GUI=0 GUI=0
else ;;
break -*)
fi OPTS="$OPTS $1"
;;
*)
PKGLIST="$PKGLIST $1"
;;
esac
shift shift
done done
@ -23,11 +32,9 @@ fi
mkdir -p $DOM0_UPDATES_DIR/etc mkdir -p $DOM0_UPDATES_DIR/etc
cp /etc/yum.conf $DOM0_UPDATES_DIR/etc/ cp /etc/yum.conf $DOM0_UPDATES_DIR/etc/
PKGLIST="$*"
if [ "x$PKGLIST" = "x" ]; then if [ "x$PKGLIST" = "x" ]; then
echo "Checking for dom0 updates..." echo "Checking for dom0 updates..."
PKGLIST=`yum --installroot $DOM0_UPDATES_DIR check-update -q | cut -f 1 -d ' '` PKGLIST=`yum --installroot $DOM0_UPDATES_DIR $OPTS check-update -q | cut -f 1 -d ' '`
else else
PKGS_FROM_CMDLINE=1 PKGS_FROM_CMDLINE=1
fi fi
@ -44,7 +51,7 @@ if [ "$DOIT" != "1" -a "$PKGS_FROM_CMDLINE" != "1" ]; then
fi fi
if [ "$PKGS_FROM_CMDLINE" == 1 ]; then if [ "$PKGS_FROM_CMDLINE" == 1 ]; then
OPTS="--resolve" OPTS="$OPTS --resolve"
GUI=0 GUI=0
fi fi