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
This commit is contained in:
Ben Nemec 2015-02-09 09:36:06 -06:00 committed by vigneshvar
parent ed0ac6d617
commit 16f1de6115

View File

@ -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