Fix syntax
@marmarek This works on my system.
This commit is contained in:
parent
32a4269f4a
commit
457b275800
@ -71,9 +71,13 @@ if [ "$YUM_ACTION" == "reinstall" ] && [[ "$PKGS" == *"qubes-template-"* ]]; the
|
|||||||
if [[ "$ONEPKG" == "qubes-template-"* ]] && [[ "$ONEPKG" == "${PKGS#\ }" ]]; then # test "$PKGS" minus space
|
if [[ "$ONEPKG" == "qubes-template-"* ]] && [[ "$ONEPKG" == "${PKGS#\ }" ]]; then # test "$PKGS" minus space
|
||||||
# Prepare to backup template root.img in case reinstall doesn't complete.
|
# Prepare to backup template root.img in case reinstall doesn't complete.
|
||||||
TEMPLATE=${ONEPKG#qubes-template-}
|
TEMPLATE=${ONEPKG#qubes-template-}
|
||||||
TEMPLATE_NETVM=`qvm-prefs --force-root $TEMPLATE netvm` || exit 1
|
if ! TEMPLATE_NETVM=`qvm-prefs --force-root $TEMPLATE netvm` \
|
||||||
[[ "$TEMPLATE_NETVM" == *"(default)" ]] && TEMPLATE_NETVM="default"
|
|| ! BAK_TEMPLATE_ROOT=`qvm-prefs --force-root $TEMPLATE root_img` ; then
|
||||||
BAK_TEMPLATE_ROOT=`qvm-prefs --force-root $TEMPLATE root_img` || exit 1
|
exit 1
|
||||||
|
fi
|
||||||
|
if [[ "$TEMPLATE_NETVM" == *"(default)" ]] ; then
|
||||||
|
TEMPLATE_NETVM="default"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "ERROR: Specify only one package to reinstall template"
|
echo "ERROR: Specify only one package to reinstall template"
|
||||||
exit 1
|
exit 1
|
||||||
@ -181,11 +185,9 @@ fi
|
|||||||
if [ "x$PKGS" != "x" ]; then
|
if [ "x$PKGS" != "x" ]; then
|
||||||
if [[ -n "$BAK_TEMPLATE_ROOT" ]] ; then
|
if [[ -n "$BAK_TEMPLATE_ROOT" ]] ; then
|
||||||
# Backup root.img just in case
|
# 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
|
if mv "$BAK_TEMPLATE_ROOT" "$BAK_TEMPLATE_ROOT-bak" ; then
|
||||||
echo "OK"
|
echo "Renamed template root.img to root.img-bak"
|
||||||
else
|
else
|
||||||
echo; echo "ERROR: Could not rename root.img"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -195,7 +197,7 @@ if [ "x$PKGS" != "x" ]; then
|
|||||||
if [[ -n "$BAK_TEMPLATE_ROOT" ]] ; then
|
if [[ -n "$BAK_TEMPLATE_ROOT" ]] ; then
|
||||||
qvm-prefs --force-root -s $TEMPLATE netvm $TEMPLATE_NETVM
|
qvm-prefs --force-root -s $TEMPLATE netvm $TEMPLATE_NETVM
|
||||||
if [ $RETCODE -eq 0 ] ; then
|
if [ $RETCODE -eq 0 ] ; then
|
||||||
# Reinstall went OK, remove backup file.
|
# Reinstall went OK, remove backup files.
|
||||||
echo "Removing $BAK_TEMPLATE_ROOT-bak"
|
echo "Removing $BAK_TEMPLATE_ROOT-bak"
|
||||||
rm -f "$BAK_TEMPLATE_ROOT-bak"
|
rm -f "$BAK_TEMPLATE_ROOT-bak"
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user