summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorhydrajump <wave@hydrajump.com>2014-05-03 03:53:36 +0200
committerhydrajump <wave@hydrajump.com>2014-05-03 03:53:36 +0200
commit01bfe09a152f2dc7b2c14d5ecebf9aa5b0a9c687 (patch)
tree9b66abd1482ea9a395004efe607bead00145d077 /scripts
parent803a08517eef23f085961b046787b785a8832dc9 (diff)
downloadvyatta-cfg-system-01bfe09a152f2dc7b2c14d5ecebf9aa5b0a9c687.tar.gz
vyatta-cfg-system-01bfe09a152f2dc7b2c14d5ecebf9aa5b0a9c687.zip
Fix AWS EC2 AMI support
- grub.cfg is now correctly modified when installing on a VyOS AMI - ec2-fetch-ssh-public-key init script still needs to be activated if installing on a VyOS AMI. This is an outstanding issue which needs to be addressed. See debian/vyatta-cfg-system.postinst.in.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/install/install-image-existing50
1 files changed, 23 insertions, 27 deletions
diff --git a/scripts/install/install-image-existing b/scripts/install/install-image-existing
index b172b6f6..f8aef0ba 100755
--- a/scripts/install/install-image-existing
+++ b/scripts/install/install-image-existing
@@ -257,39 +257,35 @@ fi
DEF_GRUB=${INST_ROOT}${vyatta_sysconfdir}/grub/default-union-grub-entry
if [ -e "$DEF_GRUB" ]; then
echo "Setting up grub configuration..."
-
- if is_amazon_ec2_ami; then
- sed -i '/menuentry/ i\
- menuentry '"VyOS AMI (HVM) $NEWNAME"' { \
- linux /boot/'$NEWNAME'/vmlinuz boot=live quiet vyatta-union=/boot/'$NEWNAME' console=ttyS0 \
- initrd /boot/'$NEWNAME'/initrd.img \
- } \
-
- ' $BOOT_DIR/grub/grub.cfg
-
- else
- new_index=$(get_grub_index)
-
- def_grub_vers=/tmp/def_grub.$$
- cp $DEF_GRUB $def_grub_vers
- sed -i "s/menuentry \"VyOS.*(/menuentry \"VyOS $NEWNAME (/" $def_grub_vers
- sed -i "s/menuentry \"Lost password change.*(/menuentry \"Lost password change $NEWNAME (/" $def_grub_vers
- sed -i "sX/boot/[A-Za-z0-9\.\-]*X/boot/${NEWNAME}Xg" $def_grub_vers
-
- old_grub_cfg=$BOOT_DIR/grub/grub.cfg
- new_grub_cfg=/tmp/grub.cfg.$$
- sed -n '/^menuentry/q;p' $old_grub_cfg >$new_grub_cfg
- cat $def_grub_vers >> $new_grub_cfg
- 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
- fi
+ new_index=$(get_grub_index)
+
+ def_grub_vers=/tmp/def_grub.$$
+ cp $DEF_GRUB $def_grub_vers
+ sed -i "s/menuentry \"VyOS.*(/menuentry \"VyOS $NEWNAME (/" $def_grub_vers
+ sed -i "s/menuentry \"Lost password change.*(/menuentry \"Lost password change $NEWNAME (/" $def_grub_vers
+ sed -i "sX/boot/[A-Za-z0-9\.\-]*X/boot/${NEWNAME}Xg" $def_grub_vers
+
+ old_grub_cfg=$BOOT_DIR/grub/grub.cfg
+ new_grub_cfg=/tmp/grub.cfg.$$
+ sed -n '/^menuentry/q;p' $old_grub_cfg >$new_grub_cfg
+ cat $def_grub_vers >> $new_grub_cfg
+ 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
+
+ # Modify grub.cfg for AWS EC2 AMI
+ if is_amazon_ec2_ami; then
+ sed -i "/menuentry \"VyOS $NEWNAME (Serial/{N;N;N;N;d;}" $BOOT_DIR/grub/grub.cfg
+ sed -i "/menuentry \"Lost password change $NEWNAME/{N;N;N;N;d;}" $BOOT_DIR/grub/grub.cfg
+ sed -i "s/VyOS $NEWNAME (KVM console)/VyOS AMI (HVM) $NEWNAME/" $BOOT_DIR/grub/grub.cfg
+ sed -i "s/$NEWNAME console=ttyS0.*/$NEWNAME console=ttyS0/" $BOOT_DIR/grub/grub.cfg
+ fi
fi
logger -p local3.warning -t "SystemImage" "System Image $NEWNAME has been added and made the default boot image"