summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/network/shorewall.pm6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/network/shorewall.pm b/lib/network/shorewall.pm
index a93af5d..7989583 100644
--- a/lib/network/shorewall.pm
+++ b/lib/network/shorewall.pm
@@ -38,9 +38,13 @@ sub get_config_file {
sub set_in_file {
my ($file, $enabled, @list) = @_;
+ my $done;
substInFile {
foreach my $l (@list) { s|^$l\n|| }
- $_ .= join("\n", @list) . "\n" if eof && $enabled;
+ if (!$done && $enabled && (/^#LAST LINE/ || eof)) {
+ $_ = join('', map { "$_\n" } @list) . $_;
+ $done = 1;
+ }
} "$::prefix/etc/shorewall/$file";
}