From b7a857315121186ae7e67c761f8ad0cc5c1575ef Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 29 Nov 2011 11:00:16 -0800 Subject: boot-image: fix perl critic warnings Bug 6886 Mostly changes to use explicit glob() function. --- scripts/vyatta-boot-image.pl | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/scripts/vyatta-boot-image.pl b/scripts/vyatta-boot-image.pl index 68d016f..2d53f1c 100755 --- a/scripts/vyatta-boot-image.pl +++ b/scripts/vyatta-boot-image.pl @@ -190,7 +190,7 @@ sub deleteGrubEntries { my $p = (stat($grub_cfg))[2]; return 'Failed to modify GRUB configuration' - if (!defined($p) || !chmod(($p & 07777), $tfile)); + if (!defined($p) || !chmod(($p & oct(7777)), $tfile)); system("mv $tfile $grub_cfg"); return 'Failed to delete GRUB entries' if ($? >> 8); return undef; @@ -244,7 +244,7 @@ sub image_vyatta_version { return "unknown"; } - my @squash_files = ; + my @squash_files = glob("/live/image/boot/$image_name/*.squashfs"); foreach my $squash_file (@squash_files) { if (-e $squash_file) { system("sudo mkdir /tmp/squash_mount"); @@ -369,8 +369,7 @@ sub select_by_name { # Find the entry that matches the new default version my $entries = $gref->{'entries'}; - my $entry; - foreach $entry (@{$entries}) { + foreach my $entry (@{$entries}) { # Skip non-vyatta entries next if (!defined($entry->{'ver'})); @@ -436,9 +435,7 @@ sub del_non_image_files { system("echo Deleting disk-based system files at: `date` >> $logfile"); system("echo Run by: `whoami` >> $logfile"); - my @entries=; - my $entry; - foreach $entry (@entries) { + foreach my $entry (glob("/live/image/*")) { if ($entry eq "/live/image/boot") { print "Skipping $entry.\n"; } else { -- cgit v1.2.3