From fd46d4cfd23783899dd0af370b2fa281126e1fb8 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Wed, 23 Oct 2019 15:38:57 +0200 Subject: T1431: add an unattended image deletion option. --- scripts/vyatta-boot-image.pl | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'scripts') diff --git a/scripts/vyatta-boot-image.pl b/scripts/vyatta-boot-image.pl index d3ca5e8..5057d3a 100755 --- a/scripts/vyatta-boot-image.pl +++ b/scripts/vyatta-boot-image.pl @@ -469,19 +469,21 @@ sub doDelete { exit 1; } - print "Are you sure you want to delete the\n\"$del_ver\" image? "; - print '(Yes/No) [No]: '; - $resp = ; - if (!defined($resp)) { - $resp = 'no'; - } - chomp($resp); - $resp = lc($resp); - if (($resp ne 'yes') && ($resp ne 'y')) { - print "Image is NOT deleted. Exiting...\n"; - exit 1; + my $process_client = $ENV{'VYOS_HEADLESS_CLIENT'}; + if (!defined($process_client)) { + print "Are you sure you want to delete the\n\"$del_ver\" image? "; + print '(Yes/No) [No]: '; + $resp = ; + if (!defined($resp)) { + $resp = 'no'; + } + chomp($resp); + $resp = lc($resp); + if (($resp ne 'yes') && ($resp ne 'y')) { + print "Image is NOT deleted. Exiting...\n"; + exit 1; + } } - if (-d $UNION_BOOT) { $boot_dir = $UNION_BOOT; } elsif (-d $DISK_BOOT) { -- cgit v1.2.3