summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2012-04-04 19:34:55 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2012-04-04 19:34:55 -0700
commit158c7151fd6b3541e892a9a8173db2e4cb787de6 (patch)
tree3b86ca5c46662aeb29065ac427b5488f6d1291b6 /scripts
parent3705ca912db94c6445768a09ddaf737fe38bd647 (diff)
downloadvyatta-cfg-158c7151fd6b3541e892a9a8173db2e4cb787de6.tar.gz
vyatta-cfg-158c7151fd6b3541e892a9a8173db2e4cb787de6.zip
Fix perlcritic warnings in strip migration comments
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/vyatta-strip-migration-comments.pl20
1 files changed, 11 insertions, 9 deletions
diff --git a/scripts/vyatta-strip-migration-comments.pl b/scripts/vyatta-strip-migration-comments.pl
index 6bc6152..21fcc89 100755
--- a/scripts/vyatta-strip-migration-comments.pl
+++ b/scripts/vyatta-strip-migration-comments.pl
@@ -21,7 +21,7 @@
use strict;
use warnings;
-
+use File::Copy;
# Looking for a comment something like this...
#
@@ -38,15 +38,17 @@ if (!defined $file) {
$file = "/opt/vyatta/etc/config/config.boot";
}
-print "copying original configuration file to $file.boot.strip-migration-comments-bu\n";
-`cp $file $file.boot.strip-migration-comments-bu`;
+my $backup = "$file.boot.strip-migration-comments-bu";
+print "copying original configuration $file to $backup\n";
+cp($file, $backup)
+ or die "Error! Unable to copy $file to $backup: $!";
-open(MYINPUTFILE, "<$file")
+open(my $inputfile, '<', $file)
or die "Error! Unable to open file for input \"$file\". $!";
my $contents = "";
my $in_mig_com = 0;
-while(<MYINPUTFILE>) {
+while(<$inputfile>) {
if ($_ =~ /CONFIGURATION COMMENTED OUT DURING MIGRATION BELOW/) {
$in_mig_com = 1;
}
@@ -60,12 +62,12 @@ while(<MYINPUTFILE>) {
$contents .= $_;
}
}
-close(MYINPUTFILE);
+close($inputfile);
-open(MYOUTPUTFILE, ">$file")
+open(my $outputfile, '>', $file)
or die "Error! Unable to open file for output \"$file\". $!";
-print MYOUTPUTFILE $contents;
-close(MYOUTPUTFILE);
+print $outputfile $contents;
+close($outputfile);
print "done\n";