From cf6b475bcd66018722e8b8cca90ff0ea662d10c6 Mon Sep 17 00:00:00 2001 From: ttasket Date: Sat, 18 Jun 2016 05:24:18 -0400 Subject: [PATCH] Update qubes-dom0-update (cherry picked from commit d316624f6120773955859c9c00bcd35b5501947f) --- dom0-updates/qubes-dom0-update | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/dom0-updates/qubes-dom0-update b/dom0-updates/qubes-dom0-update index 9638f22..36ce361 100755 --- a/dom0-updates/qubes-dom0-update +++ b/dom0-updates/qubes-dom0-update @@ -71,6 +71,8 @@ if [ "$YUM_ACTION" == "reinstall" ] && [[ "$PKGS" == *"qubes-template-"* ]]; the if [[ "$ONEPKG" == "qubes-template-"* ]] && [[ "$ONEPKG" == "${PKGS#\ }" ]]; then # test "$PKGS" minus space # Prepare to backup template root.img in case reinstall doesn't complete. TEMPLATE=${ONEPKG#qubes-template-} + TEMPLATE_NETVM=`qvm-prefs $TEMPLATE netvm` || exit 1 + if [[ "$TEMPLATE_NETVM" == *"(default)" ]] ; then TEMPLATE_NETVM="default" BAK_TEMPLATE_ROOT=`qvm-prefs $TEMPLATE root_img` || exit 1 else echo "ERROR: Specify only one package to reinstall template" @@ -199,10 +201,13 @@ elif [ -f /var/lib/qubes/updates/repodata/repomd.xml ]; then yum $YUM_OPTS $YUM_ACTION ; RETCODE=$? - if [ $RETCODE -eq 0 ] && [[ -n "$BAK_TEMPLATE_ROOT" ]] ; then - # Reinstall went OK, remove backup file. - echo "Removing $BAK_TEMPLATE_ROOT-bak" - rm -f "$BAK_TEMPLATE_ROOT-bak" + if [[ -n "$BAK_TEMPLATE_ROOT" ]] ; then + qvm-prefs -s $TEMPLATE netvm $TEMPLATE_NETVM + if [ $RETCODE -eq 0 ] ; then + # Reinstall went OK, remove backup file. + echo "Removing $BAK_TEMPLATE_ROOT-bak" + rm -f "$BAK_TEMPLATE_ROOT-bak" + fi fi fi fi