diff --git a/Shorewall/Perl/Shorewall/Compiler.pm b/Shorewall/Perl/Shorewall/Compiler.pm index bc4e59eed..d00338b16 100644 --- a/Shorewall/Perl/Shorewall/Compiler.pm +++ b/Shorewall/Perl/Shorewall/Compiler.pm @@ -81,11 +81,11 @@ sub generate_script_1( $ ) { if ( $script ) { if ( $test ) { - emit "#!/bin/sh\n#\n# Compiled firewall script generated by Shorewall-perl\n#"; + emit "#!$config{SHOREWALL_SHELL}\n#\n# Compiled firewall script generated by Shorewall-perl\n#"; } else { my $date = localtime; - emit "#!/bin/sh\n#\n# Compiled firewall script generated by Shorewall $globals{VERSION} - $date\n#"; + emit "#!$config{SHOREWALL_SHELL}\n#\n# Compiled firewall script generated by Shorewall $globals{VERSION} - $date\n#"; if ( $family == F_IPV4 ) { copy $globals{SHAREDIRPL} . 'prog.header'; diff --git a/Shorewall/Perl/Shorewall/Config.pm b/Shorewall/Perl/Shorewall/Config.pm index aac09cf7a..50393a8e2 100644 --- a/Shorewall/Perl/Shorewall/Config.pm +++ b/Shorewall/Perl/Shorewall/Config.pm @@ -1442,7 +1442,7 @@ sub close_file() { # # Functions for copying a file into the script # -sub copy( $ ) { +sub copy( $;$ ) { assert( $script_enabled ); if ( $script ) { @@ -3376,6 +3376,8 @@ sub get_configuration( $$$ ) { my ( $export, $update, $annotate ) = @_; + my $val; + $globals{EXPORT} = $export; our ( $once, @originalinc ); @@ -3403,6 +3405,18 @@ sub get_configuration( $$$ ) { get_capabilities( $export ); + if ( supplied( $val = $config{SHOREWALL_SHELL} ) ) { + unless ( $val =~ /^\// ) { + if ( $export ) { + $val = $config{SHOREWALL_SHELL} = "/bin/$val"; + warning_message "Assuming SHOREWALL_SHELL=$val"; + } else { + warning_message "Can't find SHOREWALL_SHELL ($val)" unless $config{SHOREWALL_SHELL} = which $val; + } + } + } else { + $config{SHOREWALL_SHELL} = '/bin/sh'; + } $globals{STATEMATCH} = '-m conntrack --ctstate' if have_capability 'CONNTRACK_MATCH'; @@ -3477,8 +3491,6 @@ sub get_configuration( $$$ ) { check_trivalue ( 'IP_FORWARDING', 'on' ); - my $val; - if ( have_capability( 'KERNELVERSION' ) < 20631 ) { check_trivalue ( 'ROUTE_FILTER', '' ); } else { diff --git a/Shorewall/Perl/prog.header b/Shorewall/Perl/prog.header index ac6b64347..4c334d7fe 100644 --- a/Shorewall/Perl/prog.header +++ b/Shorewall/Perl/prog.header @@ -1,5 +1,3 @@ -#!/bin/sh -# # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # # (c) 1999-2011 - Tom Eastep (teastep@shorewall.net) diff --git a/Shorewall/Perl/prog.header6 b/Shorewall/Perl/prog.header6 index f885af1cf..b1b1c7256 100644 --- a/Shorewall/Perl/prog.header6 +++ b/Shorewall/Perl/prog.header6 @@ -1,5 +1,3 @@ -#!/bin/sh -# # This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt] # # (c) 1999-2011- Tom Eastep (teastep@shorewall.net)