From bd67aa341c66189f950bec4b1f312fe7a2578d56 Mon Sep 17 00:00:00 2001 From: Marek Marczykowski Date: Mon, 12 Sep 2011 14:32:56 +0200 Subject: [PATCH 1/4] 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. --- common/qubes_download_dom0_updates.sh | 29 +++++++++++++++++---------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/common/qubes_download_dom0_updates.sh b/common/qubes_download_dom0_updates.sh index 1b1ea0b..2472184 100755 --- a/common/qubes_download_dom0_updates.sh +++ b/common/qubes_download_dom0_updates.sh @@ -4,14 +4,23 @@ DOM0_UPDATES_DIR=/var/lib/qubes/dom0-updates DOIT=0 GUI=1 +OPTS= +PKGLIST= while [ -n "$1" ]; do - if [ "x--doit" = "x$1" ]; then - DOIT=1 - elif [ "x--nogui" = "x$1" ]; then - GUI=0 - else - break - fi + case "$1" in + --doit) + DOIT=1 + ;; + --nogui) + GUI=0 + ;; + -*) + OPTS="$OPTS $1" + ;; + *) + PKGLIST="$PKGLIST $1" + ;; + esac shift done @@ -23,11 +32,9 @@ fi mkdir -p $DOM0_UPDATES_DIR/etc cp /etc/yum.conf $DOM0_UPDATES_DIR/etc/ -PKGLIST="$*" - if [ "x$PKGLIST" = "x" ]; then 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 PKGS_FROM_CMDLINE=1 fi @@ -44,7 +51,7 @@ if [ "$DOIT" != "1" -a "$PKGS_FROM_CMDLINE" != "1" ]; then fi if [ "$PKGS_FROM_CMDLINE" == 1 ]; then - OPTS="--resolve" + OPTS="$OPTS --resolve" GUI=0 fi From eff965ea1a8baed12ac5caaf73219db49c1af347 Mon Sep 17 00:00:00 2001 From: Marek Marczykowski Date: Mon, 12 Sep 2011 14:34:41 +0200 Subject: [PATCH 2/4] vm: dom0 updates - minor cleanup --- common/qubes_download_dom0_updates.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/qubes_download_dom0_updates.sh b/common/qubes_download_dom0_updates.sh index 2472184..e56d3ac 100755 --- a/common/qubes_download_dom0_updates.sh +++ b/common/qubes_download_dom0_updates.sh @@ -4,7 +4,7 @@ DOM0_UPDATES_DIR=/var/lib/qubes/dom0-updates DOIT=0 GUI=1 -OPTS= +OPTS="--installroot $DOM0_UPDATES_DIR" PKGLIST= while [ -n "$1" ]; do case "$1" in @@ -34,7 +34,7 @@ cp /etc/yum.conf $DOM0_UPDATES_DIR/etc/ if [ "x$PKGLIST" = "x" ]; then echo "Checking for dom0 updates..." - PKGLIST=`yum --installroot $DOM0_UPDATES_DIR $OPTS check-update -q | cut -f 1 -d ' '` + PKGLIST=`yum $OPTS check-update -q | cut -f 1 -d ' '` else PKGS_FROM_CMDLINE=1 fi @@ -61,11 +61,11 @@ set -e if [ "$GUI" = 1 ]; then ( echo "1" - yumdownloader --destdir "$DOM0_UPDATES_DIR/packages" --installroot "$DOM0_UPDATES_DIR" $OPTS $PKGLIST + yumdownloader --destdir "$DOM0_UPDATES_DIR/packages" $OPTS $PKGLIST echo 100 ) | zenity --progress --pulsate --auto-close --auto-kill \ --text="Downloading updates for Dom0, please wait..." --title="Qubes Dom0 updates" else - yumdownloader --destdir "$DOM0_UPDATES_DIR/packages" --installroot "$DOM0_UPDATES_DIR" $OPTS $PKGLIST + yumdownloader --destdir "$DOM0_UPDATES_DIR/packages" $OPTS $PKGLIST fi if ls $DOM0_UPDATES_DIR/packages/*.rpm > /dev/null 2>&1; then From 76cce9108bd838272c83679f3d746e676e927d92 Mon Sep 17 00:00:00 2001 From: Marek Marczykowski Date: Mon, 12 Sep 2011 14:36:53 +0200 Subject: [PATCH 3/4] vm: allow clean yum cache for dom0 updates (#346) --- common/qubes_download_dom0_updates.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/common/qubes_download_dom0_updates.sh b/common/qubes_download_dom0_updates.sh index e56d3ac..c30e5bf 100755 --- a/common/qubes_download_dom0_updates.sh +++ b/common/qubes_download_dom0_updates.sh @@ -4,6 +4,7 @@ DOM0_UPDATES_DIR=/var/lib/qubes/dom0-updates DOIT=0 GUI=1 +CLEAN=0 OPTS="--installroot $DOM0_UPDATES_DIR" PKGLIST= while [ -n "$1" ]; do @@ -14,6 +15,9 @@ while [ -n "$1" ]; do --nogui) GUI=0 ;; + --clean) + CLEAN=1 + ;; -*) OPTS="$OPTS $1" ;; @@ -32,6 +36,10 @@ fi mkdir -p $DOM0_UPDATES_DIR/etc cp /etc/yum.conf $DOM0_UPDATES_DIR/etc/ +if [ "x$CLEAN" = "1" ]; then + yum $OPTS clean all +fi + if [ "x$PKGLIST" = "x" ]; then echo "Checking for dom0 updates..." PKGLIST=`yum $OPTS check-update -q | cut -f 1 -d ' '` From 3b21e8a5962873758448a88e93692f7d8031cf18 Mon Sep 17 00:00:00 2001 From: Marek Marczykowski Date: Mon, 12 Sep 2011 15:08:29 +0200 Subject: [PATCH 4/4] vm/dom0 updates: Remove useless PKGCOUNT information from message --- common/qubes_download_dom0_updates.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/common/qubes_download_dom0_updates.sh b/common/qubes_download_dom0_updates.sh index c30e5bf..132a161 100755 --- a/common/qubes_download_dom0_updates.sh +++ b/common/qubes_download_dom0_updates.sh @@ -53,9 +53,8 @@ if [ -z "$PKGLIST" ]; then fi if [ "$DOIT" != "1" -a "$PKGS_FROM_CMDLINE" != "1" ]; then - PKGCOUNT=`echo $PKGLIST|wc -w` zenity --question --title="Qubes Dom0 updates" \ - --text="$PKGCOUNT updates for dom0 available. Do you want to download its now?" || exit 0 + --text="There are updates for dom0 available, do you want to download them now?" || exit 0 fi if [ "$PKGS_FROM_CMDLINE" == 1 ]; then