From 69abb009984591a846641fb5120a1340f7fc9357 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Wed, 13 Aug 2008 10:34:24 +0000 Subject: move set_in_file from network::drakfirewall to network::shorewall (to be used by drakguard) --- lib/network/shorewall.pm | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/network/shorewall.pm') diff --git a/lib/network/shorewall.pm b/lib/network/shorewall.pm index 0361eb8..a93af5d 100644 --- a/lib/network/shorewall.pm +++ b/lib/network/shorewall.pm @@ -36,6 +36,14 @@ sub get_config_file { map { [ split ' ' ] } grep { !/^#/ } cat_("$::prefix${shorewall_root}/$file"); } +sub set_in_file { + my ($file, $enabled, @list) = @_; + substInFile { + foreach my $l (@list) { s|^$l\n|| } + $_ .= join("\n", @list) . "\n" if eof && $enabled; + } "$::prefix/etc/shorewall/$file"; +} + sub dev_to_shorewall { my ($dev) = @_; $dev =~ /^ippp/ && "ippp+" || -- cgit v1.2.1