summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@vyos.io>2020-09-09 04:31:20 +0300
committerDaniil Baturin <daniil@vyos.io>2020-09-09 04:31:20 +0300
commit7b73a065f598ef0ddc7a27adde6e401757e6254c (patch)
treebe9f48394373ca388af86a8ea04536202b5f57a5 /scripts
parent23ff9798a80f5f619398af7edd4b18827f8b6cfb (diff)
downloadvyatta-op-7b73a065f598ef0ddc7a27adde6e401757e6254c.tar.gz
vyatta-op-7b73a065f598ef0ddc7a27adde6e401757e6254c.zip
T2303: correctly delete images with quotes in GRUB entries.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/vyatta-boot-image.pl12
1 files changed, 10 insertions, 2 deletions
diff --git a/scripts/vyatta-boot-image.pl b/scripts/vyatta-boot-image.pl
index 568fbc0..0ecb442 100755
--- a/scripts/vyatta-boot-image.pl
+++ b/scripts/vyatta-boot-image.pl
@@ -459,6 +459,14 @@ sub doDelete {
}
my $boot_dir;
+ my $del_ver_pure = $del_ver;
+ $del_ver_pure =~ s/["']*//g;
+
+ if(!$del_ver_pure) {
+ print "Version string is empty!\n";
+ exit 1;
+ }
+
my $cver = curVer();
if (!defined($cver)) {
print "Cannot verify current version. Exiting...\n";
@@ -491,7 +499,7 @@ sub doDelete {
$boot_dir = $DISK_BOOT;
}
- if (($del_ver ne $OLD_IMG_VER_STR) && (! -d "$boot_dir/$del_ver")) {
+ if (($del_ver ne $OLD_IMG_VER_STR) && (! -d "$boot_dir/$del_ver_pure")) {
print "Cannot find the target image. Exiting...\n";
exit 1;
}
@@ -502,7 +510,7 @@ sub doDelete {
if ($del_ver eq $OLD_IMG_VER_STR) {
del_non_image_files();
} else {
- system("rm -rf '$boot_dir/$del_ver'");
+ system("rm -rf '$boot_dir/$del_ver_pure'");
if ($? >> 8) {
print "Error deleting the image. Exiting...\n";
exit 1;