diff options
author | Stephen Hemminger <shemminger@vyatta.com> | 2012-04-10 18:29:46 -0700 |
---|---|---|
committer | Stephen Hemminger <shemminger@vyatta.com> | 2012-04-10 18:29:46 -0700 |
commit | 12372319ff3b16210b7ade93bab88e881c131dda (patch) | |
tree | 3d32c311b279cee16fc1363d4aa1574d9ed0c245 | |
parent | d4707f2d85d525d90e56020cbb029f928d210ef3 (diff) | |
parent | 158c7151fd6b3541e892a9a8173db2e4cb787de6 (diff) | |
download | vyatta-cfg-12372319ff3b16210b7ade93bab88e881c131dda.tar.gz vyatta-cfg-12372319ff3b16210b7ade93bab88e881c131dda.zip |
Merge branch 'pacifica' of fiji.vyatta.com:/git/vyatta-cfg into pacifica
-rwxr-xr-x | scripts/vyatta-strip-migration-comments.pl | 20 |
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"; |