diff options
author | Bob Gilligan <gilligan@vyatta.com> | 2010-05-04 10:59:49 -0700 |
---|---|---|
committer | Bob Gilligan <gilligan@vyatta.com> | 2010-05-04 10:59:49 -0700 |
commit | 6f57b95df6e3aa1b5b7c163b65059f9067f71eee (patch) | |
tree | dd11f610b6c3409892deb524d200656004462648 /scripts | |
parent | cb95ae399390b7415ac8926c928e70e8a5469aa8 (diff) | |
download | vyatta-op-6f57b95df6e3aa1b5b7c163b65059f9067f71eee.tar.gz vyatta-op-6f57b95df6e3aa1b5b7c163b65059f9067f71eee.zip |
Don't allow the currently running image to be renamed.
Allowing the running image to be renamed introduced several issues.
It is simpler just to dis-allow it. If the user needs to re-name the
running image, they can reboot on another image, re-name the first
image, then boot back into it.
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/rename-image.pl | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/scripts/rename-image.pl b/scripts/rename-image.pl index d9fbd78..e2e9745 100644 --- a/scripts/rename-image.pl +++ b/scripts/rename-image.pl @@ -60,6 +60,17 @@ if (("$new_name" eq "Old-non-image-installation") || exit 1; } +my $cmdline=`cat /proc/cmdline`; +my $cur_name; +($cur_name, undef) = split(' ', $cmdline); +$cur_name =~ s/BOOT_IMAGE=\/boot\///; +$cur_name =~ s/\/vmlinuz.*//; + +if ($old_name eq $cur_name) { + printf("Can't re-name the running image.\n"); + exit 1; +} + if (-e "$image_path/$new_name") { printf("New name $new_name already exists.\n"); exit 1; |