Fix syntax

@marmarek This works on my system.
(cherry picked from commit 457b275800)
This commit is contained in:
ttasket 2016-06-20 13:36:30 -04:00 committed by Marek Marczykowski-Górecki
parent 4563035b0c
commit 428ff4e503
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -71,9 +71,13 @@ 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 --force-root $TEMPLATE netvm` || exit 1
[[ "$TEMPLATE_NETVM" == *"(default)" ]] && TEMPLATE_NETVM="default"
BAK_TEMPLATE_ROOT=`qvm-prefs --force-root $TEMPLATE root_img` || exit 1
if ! TEMPLATE_NETVM=`qvm-prefs --force-root $TEMPLATE netvm` \
|| ! BAK_TEMPLATE_ROOT=`qvm-prefs --force-root $TEMPLATE root_img` ; then
exit 1
fi
if [[ "$TEMPLATE_NETVM" == *"(default)" ]] ; then
TEMPLATE_NETVM="default"
fi
else
echo "ERROR: Specify only one package to reinstall template"
exit 1
@ -181,11 +185,9 @@ fi
if [ "x$PKGS" != "x" ]; then
if [[ -n "$BAK_TEMPLATE_ROOT" ]] ; then
# Backup root.img just in case
echo -n "Renaming template root.img to root.img-bak..."
if mv "$BAK_TEMPLATE_ROOT" "$BAK_TEMPLATE_ROOT-bak" ; then
echo "OK"
echo "Renamed template root.img to root.img-bak"
else
echo; echo "ERROR: Could not rename root.img"
exit 1
fi
fi
@ -195,7 +197,7 @@ if [ "x$PKGS" != "x" ]; then
if [[ -n "$BAK_TEMPLATE_ROOT" ]] ; then
qvm-prefs --force-root -s $TEMPLATE netvm $TEMPLATE_NETVM
if [ $RETCODE -eq 0 ] ; then
# Reinstall went OK, remove backup file.
# Reinstall went OK, remove backup files.
echo "Removing $BAK_TEMPLATE_ROOT-bak"
rm -f "$BAK_TEMPLATE_ROOT-bak"
fi