From 0b7f1fa905b522e2b6303f3c4c5ebde4b1b8cacb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Sun, 11 Feb 2018 13:54:34 +0100 Subject: [PATCH 1/3] dom0-updates: refactor for ease adding new actions with old yum Some more actions could be implemented even without --downloadonly option. Ease doing so. QubesOS/qubes-issues#3553 --- misc/qubes-download-dom0-updates.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/misc/qubes-download-dom0-updates.sh b/misc/qubes-download-dom0-updates.sh index 9bcdfeb..ade4283 100755 --- a/misc/qubes-download-dom0-updates.sh +++ b/misc/qubes-download-dom0-updates.sh @@ -108,15 +108,9 @@ YUM_COMMAND="fakeroot $YUM $YUM_ACTION -y --downloadonly" # check for --downloadonly option - if not supported (Debian), fallback to # yumdownloader if ! $YUM --help | grep -q downloadonly; then - if [ "$YUM_ACTION" != "install" ] && [ "$YUM_ACTION" != "upgrade" ]; then - echo "ERROR: yum version installed in VM $(hostname) does not suppport --downloadonly option" >&2 - echo "ERROR: only 'install' and 'upgrade' actions supported ($YUM_ACTION not)" >&2 - if [ "$GUI" = 1 ]; then - zenity --error --text="yum version too old for '$YUM_ACTION' action, see console for details" - fi - exit 1 - fi - if [ "$YUM_ACTION" = "upgrade" ]; then + if [ "$YUM_ACTION" = "install" ]; then + YUM_COMMAND="yumdownloader --destdir=$DOM0_UPDATES_DIR/packages --resolve" + elif [ "$YUM_ACTION" = "upgrade" ]; then # shellcheck disable=SC2086 UPDATES_FULL=$($YUM $OPTS check-update $PKGLIST) check_update_retcode=$? @@ -128,8 +122,14 @@ if ! $YUM --help | grep -q downloadonly; then exit 0 fi PKGLIST=$UPDATES + else + echo "ERROR: yum version installed in VM $(hostname) does not suppport --downloadonly option" >&2 + echo "ERROR: only 'install' and 'upgrade' actions supported ($YUM_ACTION not)" >&2 + if [ "$GUI" = 1 ]; then + zenity --error --text="yum version too old for '$YUM_ACTION' action, see console for details" + fi + exit 1 fi - YUM_COMMAND="yumdownloader --destdir=$DOM0_UPDATES_DIR/packages --resolve" fi mkdir -p "$DOM0_UPDATES_DIR/packages" From c567222b6f3ac517dd18ccd1a3964055aeace52c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Sun, 11 Feb 2018 14:08:19 +0100 Subject: [PATCH 2/3] dom0-update: add some approximation of 'list', 'search' and 'reinstall' ... on systems lacking yum --downloadonly Fixes QubesOS/qubes-issues#3553 --- misc/qubes-download-dom0-updates.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/misc/qubes-download-dom0-updates.sh b/misc/qubes-download-dom0-updates.sh index ade4283..b3e9cb7 100755 --- a/misc/qubes-download-dom0-updates.sh +++ b/misc/qubes-download-dom0-updates.sh @@ -122,6 +122,15 @@ if ! $YUM --help | grep -q downloadonly; then exit 0 fi PKGLIST=$UPDATES + YUM_COMMAND="yumdownloader --destdir=$DOM0_UPDATES_DIR/packages --resolve" + elif [ "$YUM_ACTION" == "list" ] || [ "$YUM_ACTION" == "search" ]; then + # those actions do not download any package, so lack of --downloadonly is irrelevant + YUM_COMMAND="fakeroot $YUM $YUM_ACTION -y" + elif [ "$YUM_ACTION" == "reinstal" ]; then + # this is just approximation of 'reinstall' action... + # shellcheck disable=SC2086 + PKGLIST=$(rpm --root=$DOM0_UPDATES_DIR -q $PKGLIST) + YUM_COMMAND="yumdownloader --destdir=$DOM0_UPDATES_DIR/packages --resolve" else echo "ERROR: yum version installed in VM $(hostname) does not suppport --downloadonly option" >&2 echo "ERROR: only 'install' and 'upgrade' actions supported ($YUM_ACTION not)" >&2 From 76f5253341767440471b12f205b894e8bc0628b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Tue, 13 Feb 2018 18:52:46 +0100 Subject: [PATCH 3/3] Drop fakeroot for list/search actions on Debian It isn't needed for informative actions and apparently fakeroot cause problems on Whonix. Suggested by @awokd QubesOS/qubes-issues#3553 --- misc/qubes-download-dom0-updates.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/qubes-download-dom0-updates.sh b/misc/qubes-download-dom0-updates.sh index b3e9cb7..b720715 100755 --- a/misc/qubes-download-dom0-updates.sh +++ b/misc/qubes-download-dom0-updates.sh @@ -125,7 +125,7 @@ if ! $YUM --help | grep -q downloadonly; then YUM_COMMAND="yumdownloader --destdir=$DOM0_UPDATES_DIR/packages --resolve" elif [ "$YUM_ACTION" == "list" ] || [ "$YUM_ACTION" == "search" ]; then # those actions do not download any package, so lack of --downloadonly is irrelevant - YUM_COMMAND="fakeroot $YUM $YUM_ACTION -y" + YUM_COMMAND="$YUM $YUM_ACTION -y" elif [ "$YUM_ACTION" == "reinstal" ]; then # this is just approximation of 'reinstall' action... # shellcheck disable=SC2086