From 49cdc5d9eb780cfa727b7335f5fe54804f82ee35 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Wed, 1 Dec 2010 10:41:49 -0800 Subject: [PATCH] Make new get_params work with bash --- Shorewall/Perl/Shorewall/Config.pm | 35 ++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/Shorewall/Perl/Shorewall/Config.pm b/Shorewall/Perl/Shorewall/Config.pm index e5e20bb99..96a246aef 100644 --- a/Shorewall/Perl/Shorewall/Config.pm +++ b/Shorewall/Perl/Shorewall/Config.pm @@ -2907,15 +2907,32 @@ sub get_params() { my $variable; - for ( @params ) { - if ( /^export (.*?)='(.*)'$/ ) { - $params{$1} = $2 unless $1 eq '_'; - } elsif ( /^export (.*?)='(.*)$/ ) { - $params{$variable=$1}="${2}\n"; - } else { - assert($variable); - $params{$variable} .= $_; - } + if ( $params[0] =~ /^declare/ ) { + for ( @params ) { + if ( /^declare -x (.*?)="(.*)"$/ ) { + $params{$1} = $2 unless $1 eq '_'; + } elsif ( /^declare -x (.*?)="(.*)$/ ) { + $params{$variable=$1}="${2}\n"; + } elsif ( /^declare -x (.*)\s+$/ ) { + $params{$1} = ''; + } else { + assert($variable); + s/'$//; + $params{$variable} .= $_; + } + } + } else { + for ( @params ) { + if ( /^export (.*?)='(.*)'$/ ) { + $params{$1} = $2 unless $1 eq '_'; + } elsif ( /^export (.*?)='(.*)$/ ) { + $params{$variable=$1}="${2}\n"; + } else { + assert($variable); + s/'$//; + $params{$variable} .= $_; + } + } } if ( $debug ) {