diff options
author | Bob Gilligan <gilligan@vyatta.com> | 2011-10-19 17:54:23 -0700 |
---|---|---|
committer | Bob Gilligan <gilligan@vyatta.com> | 2011-10-19 17:54:23 -0700 |
commit | c44072f905c884eeee2d5abecb0b7728fcc538be (patch) | |
tree | 6e0b1556947d1af2a0782ad1dc9cf17d2b2b8130 | |
parent | c37a04277e4af322621e27a390481cb58b5e840d (diff) | |
download | vyatta-op-c44072f905c884eeee2d5abecb0b7728fcc538be.tar.gz vyatta-op-c44072f905c884eeee2d5abecb0b7728fcc538be.zip |
Bugfix 7502: Get "set system image default-boot" to work on Xen.
-rwxr-xr-x | scripts/vyatta-boot-image.pl | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/scripts/vyatta-boot-image.pl b/scripts/vyatta-boot-image.pl index 448192d..7c80da7 100755 --- a/scripts/vyatta-boot-image.pl +++ b/scripts/vyatta-boot-image.pl @@ -26,6 +26,7 @@ use strict; use warnings; use Getopt::Long; use File::Temp qw/ :mktemp /; +use File::Copy; # # Constants @@ -311,6 +312,24 @@ sub doSelect { print "Failed to set the default boot image. Exiting...\n"; exit 1; } + + if (-l $XEN_DEFAULT_IMAGE) { + my $backup_symlink = $XEN_DEFAULT_IMAGE . ".orig"; + if (!move($XEN_DEFAULT_IMAGE, $backup_symlink)) { + printf("Unable to back up Xen default image symlink: $XEN_DEFAULT_IMAGE\n"); + printf("Default boot image has not been changed.\n"); + system("logger -p local3.warning -t 'SystemImage' 'Default boot image attempt to change from $def_ver to $new_ver failed: cant back up symlink'"); + exit 1; + } + if (!symlink ($new_ver, $XEN_DEFAULT_IMAGE)) { + move($backup_symlink, $XEN_DEFAULT_IMAGE); + printf("Unable to update Xen default image symlink: $XEN_DEFAULT_IMAGE.\n"); + printf("Default boot image has not been changed.\n"); + system("logger -p local3.warning -t 'SystemImage' 'Default boot image attempt to change from $def_ver to $new_ver failed: cant update symlink'"); + exit 1; + } + } + print <<EOF; Default boot image has been set to "$new_ver". You need to reboot the system to start the new default image. |