From 16f1de61155baf72d4116441a72f2428810a52ae Mon Sep 17 00:00:00 2001 From: Ben Nemec Date: Mon, 9 Feb 2015 09:36:06 -0600 Subject: [PATCH] Quote to handle empty DIB_RELEASE We don't export DIB_RELEASE in the base distro scripts, so many times it will be an unset variable in 51-bootloader from the vm element. Currently that script doesn't handle the situation properly and we get errors like: line 160: [: =: unary operator expected This change quotes the references to DIB_RELEASE so that won't happen anymore. Change-Id: Ic8f91804334f8862c217f465be80e96d3116f5c8 --- elements/vm/finalise.d/51-bootloader | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/elements/vm/finalise.d/51-bootloader b/elements/vm/finalise.d/51-bootloader index a53221ec..d8d626fa 100755 --- a/elements/vm/finalise.d/51-bootloader +++ b/elements/vm/finalise.d/51-bootloader @@ -167,7 +167,7 @@ function install_grub2 { # grub-mkconfig generates a config with the device in it, # This shouldn't be needed, but old code has bugs DIB_RELEASE=${DIB_RELEASE:-} - if [ $DIB_RELEASE = 'precise' ] || [ $DIB_RELEASE = 'wheezy' ]; then + if [ "$DIB_RELEASE" = 'precise' ] || [ "$DIB_RELEASE" = 'wheezy' ]; then sed -i "s%search --no.*%%" $GRUB_CFG sed -i "s%set root=.*%set root=(hd0,1)%" $GRUB_CFG fi @@ -178,7 +178,7 @@ function install_grub2 { sed -i "s%search --no-floppy --fs-uuid --set=root .*$%search --no-floppy --set=root --label ${DIB_ROOT_LABEL}%" $GRUB_CFG sed -i "s%root=UUID=[A-Za-z0-9\-]*%root=LABEL=${DIB_ROOT_LABEL}%" $GRUB_CFG if [ "$DISTRO_NAME" = 'fedora' ] ; then - if [ $DIB_RELEASE = '19' ]; then + if [ "$DIB_RELEASE" = '19' ]; then sed -i "s%UUID=[A-Za-z0-9\-]*%LABEL=${DIB_ROOT_LABEL}%" /etc/fstab fi fi