diff options
author | Bob Gilligan <gilligan@vyatta.com> | 2009-12-23 11:21:53 -0800 |
---|---|---|
committer | Bob Gilligan <gilligan@vyatta.com> | 2009-12-23 11:21:53 -0800 |
commit | 34cc89caa71daf74e14751a0598587281bf8c374 (patch) | |
tree | dcbe5876662f606b1fa0a8a5c39a0c6993a60454 /scripts/vyatta-boot-image.pl | |
parent | 550cf8c5a540e25582f8ae0483fce29b4bdb0bcb (diff) | |
download | vyatta-op-34cc89caa71daf74e14751a0598587281bf8c374.tar.gz vyatta-op-34cc89caa71daf74e14751a0598587281bf8c374.zip |
Fix deletion of image from disk-based image.
Diffstat (limited to 'scripts/vyatta-boot-image.pl')
-rwxr-xr-x | scripts/vyatta-boot-image.pl | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/scripts/vyatta-boot-image.pl b/scripts/vyatta-boot-image.pl index 3c35847..c6b2349 100755 --- a/scripts/vyatta-boot-image.pl +++ b/scripts/vyatta-boot-image.pl @@ -10,6 +10,7 @@ my $UNION_GRUB_CFG = "$UNION_BOOT/grub/grub.cfg"; my $VER_FILE = '/opt/vyatta/etc/version'; my $OLD_IMG_VER_STR = 'Old non-image installation'; my $OLD_GRUB_CFG = '/boot/grub/grub.cfg'; +my $DISK_BOOT = '/boot'; my $grub_cfg; # this function parses the grub config file and returns a hash reference @@ -267,6 +268,8 @@ sub curVer { sub doDelete { my ($bdx) = @_; my $del_ver = ${$bentries}[$resp]->{'ver'}; + my $boot_dir; + print "Are you sure you want to delete the\n\"$del_ver\" image? "; print '(Yes/No) [No]: '; my $resp = <STDIN>; @@ -292,7 +295,14 @@ before deleting. Exiting... EOF exit 1; } - if (! -d "$UNION_BOOT/$del_ver") { + + if (-d $UNION_BOOT) { + $boot_dir = $UNION_BOOT; + } elsif (-d $DISK_BOOT) { + $boot_dir = $DISK_BOOT; + } + + if (! -d "$boot_dir/$del_ver") { print "Cannot find the target image. Exiting...\n"; exit 1; } @@ -303,7 +313,7 @@ EOF print "$err. Exiting...\n"; exit 1; } - system("rm -rf '$UNION_BOOT/$del_ver'"); + system("rm -rf '$boot_dir/$del_ver'"); if ($? >> 8) { print "Error deleting the image. Exiting...\n"; exit 1; |