Have separate hashes for the two shorewallrc files.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2012-09-03 20:09:20 -07:00
parent 55e3b11a28
commit bdd66e68c9
4 changed files with 27 additions and 15 deletions

View File

@ -158,7 +158,7 @@ sub generate_script_2() {
push_indent;
if ( $shorewallrc{TEMPDIR} ) {
if ( $shorewallrc1{TEMPDIR} ) {
emit( '',
qq(TMPDIR="$shorewallrc{TEMPDIR}") ,
q(export TMPDIR) );
@ -168,14 +168,14 @@ sub generate_script_2() {
emit( 'g_family=4' );
if ( $export ) {
emit ( qq(g_confdir=$shorewallrc{CONFDIR}/shorewall-lite),
emit ( qq(g_confdir=$shorewallrc1{CONFDIR}/shorewall-lite),
'g_product="Shorewall Lite"',
'g_program=shorewall-lite',
'g_basedir=/usr/share/shorewall-lite',
qq(CONFIG_PATH="$shorewallrc{CONFDIR}/shorewall-lite:$shorewallrc{SHAREDIR}/shorewall-lite") ,
qq(CONFIG_PATH="$shorewallrc1{CONFDIR}/shorewall-lite:$shorewallrc1{SHAREDIR}/shorewall-lite") ,
);
} else {
emit ( qq(g_confdir=$shorewallrc{CONFDIR}/shorewall),
emit ( qq(g_confdir=$shorewallrc1{CONFDIR}/shorewall),
'g_product=Shorewall',
'g_program=shorewall',
'g_basedir=/usr/share/shorewall',
@ -186,14 +186,14 @@ sub generate_script_2() {
emit( 'g_family=6' );
if ( $export ) {
emit ( qq(g_confdir=$shorewallrc{CONFDIR}/shorewall6-lite),
emit ( qq(g_confdir=$shorewallrc1{CONFDIR}/shorewall6-lite),
'g_product="Shorewall6 Lite"',
'g_program=shorewall6-lite',
'g_basedir=/usr/share/shorewall6',
qq(CONFIG_PATH="$shorewallrc{CONFDIR}/shorewall6-lite:$shorewallrc{SHAREDIR}/shorewall6-lite") ,
qq(CONFIG_PATH="$shorewallrc1{CONFDIR}/shorewall6-lite:$shorewallrc{SHAREDIR}/shorewall6-lite") ,
);
} else {
emit ( qq(g_confdir=$shorewallrc{CONFDIR}/shorewall6),
emit ( qq(g_confdir=$shorewallrc1{CONFDIR}/shorewall6),
'g_product=Shorewall6',
'g_program=shorewall6',
'g_basedir=/usr/share/shorewall',
@ -206,15 +206,15 @@ sub generate_script_2() {
if ( $family == F_IPV4 ) {
if ( $export ) {
emit ( '[ -n "${VARDIR:=' . $shorewallrc{VARDIR} . '/shorewall-lite}" ]' );
emit ( '[ -n "${VARDIR:=' . $shorewallrc1{VARDIR} . '/shorewall-lite}" ]' );
} else {
emit ( '[ -n "${VARDIR:=' . $shorewallrc{VARDIR} . '/shorewall}" ]' );
emit ( '[ -n "${VARDIR:=' . $shorewallrc1{VARDIR} . '/shorewall}" ]' );
}
} else {
if ( $export ) {
emit ( '[ -n "${VARDIR:=' . $shorewallrc{VARDIR} . '/shorewall6-lite}" ]' );
emit ( '[ -n "${VARDIR:=' . $shorewallrc1{VARDIR} . '/shorewall6-lite}" ]' );
} else {
emit ( '[ -n "${VARDIR:=' . $shorewallrc{VARDIR} . '/shorewall6}" ]' );
emit ( '[ -n "${VARDIR:=' . $shorewallrc1{VARDIR} . '/shorewall6}" ]' );
}
}

View File

@ -144,6 +144,7 @@ our %EXPORT_TAGS = ( internal => [ qw( create_temp_script
%globals
%config_files
%shorewallrc
%shorewallrc1
%helpers
%helpers_map
@ -540,7 +541,7 @@ my $ifstack;
#
# From .shorewallrc
#
our %shorewallrc;
our ( %shorewallrc, %shorewallrc1 );
#
# read_a_line options
#
@ -900,6 +901,11 @@ sub initialize( $;$$) {
SHAREDIR => '/usr/share/',
CONFDIR => '/etc/',
);
%shorewallrc1 = (
SHAREDIR => '/usr/share/',
CONFDIR => '/etc/',
);
%helpers_enabled = (
amanda => 1,
@ -968,7 +974,15 @@ sub initialize( $;$$) {
#
# If we are compiling for export, process the shorewallrc from the remote system
#
process_shorewallrc( $shorewallrc1 ) if $shorewallrc1;
if ( $shorewallrc1 ) {
my %rc = %shorewallrc;
%shorewallrc = ( );
process_shorewallrc( $shorewallrc1 );
%shorewallrc1 = %shorewallrc;
%shorewallrc = %rc;
} else {
%shorewallrc1 = %shorewallrc;
}
}
my @abbr = qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec );

View File

@ -9,7 +9,6 @@
# See http://shorewall.net/starting_and_stopping_shorewall.htm for additional
# information.
#
FORMAT 2
###############################################################################
#TARGET SOURCE DEST PROTO DEST SOURCE
# PORT(S) PORT(S)

View File

@ -9,7 +9,6 @@
# See http://shorewall.net/starting_and_stopping_shorewall.htm for additional
# information.
#
FORMAT 2
###############################################################################
#TARGET SOURCE DEST PROTO DEST SOURCE
# PORT(S) PORT(S)