diff options
-rw-r--r-- | init-sh/lib.sh | 25 |
1 files changed, 1 insertions, 24 deletions
diff --git a/init-sh/lib.sh b/init-sh/lib.sh index e8798c7..6a613e9 100644 --- a/init-sh/lib.sh +++ b/init-sh/lib.sh @@ -46,30 +46,7 @@ AddRules() { AddBegRules() { echo "Modifying config in ${2}..." -/usr/bin/perl -e ' - my $m; - - $file = shift or die; - $temp = `mktemp /tmp/secure.XXXXXX`; - - chomp $temp; - - open FH, $file; - open FW, ">$temp"; - - while (<FH>) { - if (!/^\#/ && !/^$/ && !$m) { - print FW $ENV{"COMMENT"}; - print FW "\n"; - print FW "@ARGV\n\n"; $m++; - } - print FW; - } - close FH; - close FW; - - `mv -f $temp $file`; -' $@ + perl -pe -i '/^#/ or /^$/ or $m++ or print "$ENV{COMMENT}\n@ARGV\n\n"' $@ echo -e "done.\n" } |