From 6f57b95df6e3aa1b5b7c163b65059f9067f71eee Mon Sep 17 00:00:00 2001 From: Bob Gilligan Date: Tue, 4 May 2010 10:59:49 -0700 Subject: 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. --- scripts/rename-image.pl | 11 +++++++++++ 1 file changed, 11 insertions(+) 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; -- cgit v1.2.3