From 3c151ca50939ebcc75666178ab6aa2e858bcd6dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Thu, 26 Mar 2015 00:58:10 +0100 Subject: [PATCH] dom0-update: allow to specify custom yum action This can be useful for actions like "downgrade", "reinstall" etc. Needs additional testing if whole distribution upgrade using "distro-sync" action will work as expected. --- dom0-updates/qubes-dom0-update | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/dom0-updates/qubes-dom0-update b/dom0-updates/qubes-dom0-update index 8ba238a..e49c3e2 100755 --- a/dom0-updates/qubes-dom0-update +++ b/dom0-updates/qubes-dom0-update @@ -16,6 +16,7 @@ if [ "$1" = "--help" ]; then echo " --clean clean yum cache before doing anything" echo " --check-only only check for updates (no install)" echo " --gui use gpk-update-viewer for update selection" + echo " --action=... use specific yum action, instead of automatic install/update" echo " download (and install if run by root) new packages" echo " in dom0 instead of updating" exit @@ -26,6 +27,7 @@ YUM_OPTS= GUI= CHECK_ONLY= ALL_OPTS=$* +YUM_ACTION= QVMRUN_OPTS= CLEAN= # Filter out some yum options and collect packages list @@ -43,11 +45,17 @@ while [ $# -gt 0 ]; do --check-only) CHECK_ONLY=1 ;; + --action=*) + YUM_ACTION=${1#--action=} + ;; -*) YUM_OPTS="$YUM_OPTS $1" ;; *) PKGS="$PKGS $1" + if [ -z "$YUM_ACTION" ]; then + YUM_ACTION=install + fi ;; esac shift @@ -139,8 +147,12 @@ if [ -r /var/lib/qubes/updates/errors ]; then exit 1 fi +if [ -z "$YUM_ACTION" ]; then + YUM_ACTION=upgrade +fi + if [ "x$PKGS" != "x" ]; then - yum $YUM_OPTS install $PKGS + yum $YUM_OPTS $YUM_ACTION $PKGS elif [ -f /var/lib/qubes/updates/repodata/repomd.xml ]; then # Above file exists only when at least one package was downloaded if [ "$GUI" == "1" ]; then @@ -148,7 +160,7 @@ elif [ -f /var/lib/qubes/updates/repodata/repomd.xml ]; then else yum check-update if [ $? -eq 100 ]; then - yum $YUM_OPTS update + yum $YUM_OPTS $YUM_ACTION fi fi yum -q check-update && rm -f $UPDATES_STAT_FILE