From 8c7a225070f8e360fc5edff43da19cefc8330c46 Mon Sep 17 00:00:00 2001 From: ttasket Date: Sat, 18 Jun 2016 04:22:23 -0400 Subject: [PATCH] Backup root.img Just in case template %post scriptlet doesn't unlink during reinstall, or if reinstall fails. Fixed PKGS test. --- dom0-updates/qubes-dom0-update | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dom0-updates/qubes-dom0-update b/dom0-updates/qubes-dom0-update index 9990367..9638f22 100755 --- a/dom0-updates/qubes-dom0-update +++ b/dom0-updates/qubes-dom0-update @@ -68,12 +68,12 @@ if [ "$YUM_ACTION" == "reinstall" ] && [[ "$PKGS" == *"qubes-template-"* ]]; the echo "WARNING: Reinstalling a template will erase files in /home and /rw !" $ONEPKG=`cut -f 1 -d ' ' <<<$PKGS` - if [[ "$ONEPKG" == "qubes-template-"* ]] ; then + 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-} BAK_TEMPLATE_ROOT=`qvm-prefs $TEMPLATE root_img` || exit 1 else - echo "ERROR: Specify only one template package for reinstall" + echo "ERROR: Specify only one package to reinstall template" exit 1 fi @@ -201,6 +201,7 @@ elif [ -f /var/lib/qubes/updates/repodata/repomd.xml ]; then 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" fi fi