Fix syntax
@marmarek This works on my system.
(cherry picked from commit 457b275800
)
This commit is contained in:
parent
4563035b0c
commit
428ff4e503
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user