summaryrefslogtreecommitdiff
path: root/scripts/rename-image.pl
diff options
context:
space:
mode:
authorBob Gilligan <gilligan@vyatta.com>2011-10-21 15:08:15 -0700
committerBob Gilligan <gilligan@vyatta.com>2011-10-21 15:08:15 -0700
commita85dfe27f88d18c226a3e7cf7c9e8457806d284a (patch)
treea3113c32b64622f777d00c8cabe1363cb9edb5b1 /scripts/rename-image.pl
parent6c88d36a86d2ed3a9674742f467674ca36205072 (diff)
downloadvyatta-op-a85dfe27f88d18c226a3e7cf7c9e8457806d284a.tar.gz
vyatta-op-a85dfe27f88d18c226a3e7cf7c9e8457806d284a.zip
Bugfix 7502: Make "delete system image" work correctly on Xen
Also, improved detection of currently running image in the "rename system image" command.
Diffstat (limited to 'scripts/rename-image.pl')
-rw-r--r--scripts/rename-image.pl10
1 files changed, 9 insertions, 1 deletions
diff --git a/scripts/rename-image.pl b/scripts/rename-image.pl
index fcdf624..8632334 100644
--- a/scripts/rename-image.pl
+++ b/scripts/rename-image.pl
@@ -70,8 +70,16 @@ my $cur_name;
if ($cur_name =~ s/BOOT_IMAGE=\/boot\///) {
$cur_name =~ s/\/vmlinuz.*//;
} else {
+ # Boot command line is not formatted as it would be for a system
+ # booted via grub2 with union mounted root filesystem. Another
+ # possibility is that it the system is Xen booted via pygrub.
+ #
if (-l $XEN_DEFAULT_IMAGE) {
- $cur_name = readlink($XEN_DEFAULT_IMAGE);
+ # On Xen/pygrub systems, we figure out the running version by
+ # looking at the bind mount of /boot.
+ $cur_name = `mount | awk '/on \\/boot / { print \$1 }'`;
+ $cur_name =~ s/\/live\/image\/boot\///;
+ chomp($cur_name);
}
}