summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Gilligan <gilligan@vyatta.com>2011-10-12 17:13:27 -0700
committerBob Gilligan <gilligan@vyatta.com>2011-10-12 17:13:27 -0700
commit1f3e23f7147ef23f338788a223f8a5901546866a (patch)
treef8bae2a9a536254f89bfa9107a3cd59df7da10c9
parent23d33e2d237323d2c13df8339212b84e0b36aeac (diff)
downloadvyatta-cfg-system-1f3e23f7147ef23f338788a223f8a5901546866a.tar.gz
vyatta-cfg-system-1f3e23f7147ef23f338788a223f8a5901546866a.zip
Bugfix 7502: Get "add system image" to work on Xen
This fix solves the problem with indirection. We introduce a symlink in /live/image/boot pointing to the current default system image. The pygrub config file in /boot/grub/menu.lst points to the kernel and initrd files in the default image by using this symlink in the pathname. Every time we add, delete or change the default system image, we need to change this symlink to point to the new default image.
-rwxr-xr-xscripts/install/install-image-existing6
-rwxr-xr-xscripts/install/install-postinst-new5
2 files changed, 10 insertions, 1 deletions
diff --git a/scripts/install/install-image-existing b/scripts/install/install-image-existing
index 7c75b35b..ea5455ea 100755
--- a/scripts/install/install-image-existing
+++ b/scripts/install/install-image-existing
@@ -258,6 +258,12 @@ if [ -e "$DEF_GRUB" ]; then
sed -n '/^menuentry/,${p}' $old_grub_cfg >>$new_grub_cfg
sed -i "s/^set default=[0-9]\+$/set default=$new_index/" $new_grub_cfg
mv $new_grub_cfg $old_grub_cfg
+
+ # Update the default image symlink used by Xen
+ if [ -L $BOOT_DIR/%%default_image ]; then
+ mv $BOOT_DIR/%%default_image $BOOT_DIR/%%default_image.orig
+ ln -s $NEWNAME $BOOT_DIR/%%default_image
+ fi
fi
logger -p local3.warning -t "SystemImage" "System Image $NEWNAME has been added and made the default boot image"
diff --git a/scripts/install/install-postinst-new b/scripts/install/install-postinst-new
index d782a5bf..2a9539c6 100755
--- a/scripts/install/install-postinst-new
+++ b/scripts/install/install-postinst-new
@@ -158,6 +158,9 @@ setup_xen_extras () {
echo "kernel $xen_grub_boot_path/vmlinuz root=/dev/$rootdev boot=live vyatta-union=$xen_grub_boot_path console=hvc0" >> $grubfile
echo "initrd $xen_grub_boot_path/initrd.img" >> $grubfile
+ # Add symlink pointing to default image
+ ln -s $image_name $grub_root/boot/%%default_image
+
# Add console port entry for the Xen PV console
add_console_entry hvc0 "${INST_ROOT}${VYATTA_CFG_DIR}/config.boot"
}
@@ -191,7 +194,7 @@ image_name=${image_name#$WRITE_ROOT/boot/}
# these are the defaults for "union"
grub_root=$WRITE_ROOT
grub_setup_args="-u $image_name"
-xen_grub_boot_path="/boot/$image_name"
+xen_grub_boot_path="/boot/%%default_image"
if [ "$INSTALL_TYPE" == 'old' ]; then
grub_root=$INST_ROOT
grub_setup_args="-v $version"