From 5b953cc1dd33540376da4be0ef2ae4d1c71ba173 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Mon, 3 Sep 2012 09:50:07 -0700 Subject: [PATCH] Handle different layouts on the admin system and remote firewall(s) Signed-off-by: Tom Eastep --- Shorewall/Perl/Shorewall/Config.pm | 15 ++++++++++++--- Shorewall/install.sh | 4 ++++ Shorewall/lib.cli-std | 5 +++-- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/Shorewall/Perl/Shorewall/Config.pm b/Shorewall/Perl/Shorewall/Config.pm index 61c00766b..44bf43189 100644 --- a/Shorewall/Perl/Shorewall/Config.pm +++ b/Shorewall/Perl/Shorewall/Config.pm @@ -190,6 +190,10 @@ Exporter::export_ok_tags('internal'); our $VERSION = 'MODULEVERSION'; +# +# The installer will modify this if necessary +# +use constant { SHAREDIR => '/usr/share' }; # # describe the current command, it's present progressive, and it's completion. # @@ -944,9 +948,10 @@ sub initialize( $;$ ) { snmp => 'snmp', tftp => 'tftp', ); - - - process_shorewallrc( $shorewallrc ) if $shorewallrc; + # + # Process the global shorewallrc file + # + process_shorewallrc( SHAREDIR . '/shorewall/shorewallrc' ); $globals{SHAREDIRPL} = "$shorewallrc{SHAREDIR}/shorewall/"; @@ -962,6 +967,10 @@ sub initialize( $;$ ) { $globals{PRODUCT} = 'shorewall6'; $config{IP6TABLES} = undef; } + # + # If we are compiling for export, process the shorewallrc from the remote system + # + process_shorewallrc( $shorewallrc ) if $shorewallrc; } my @abbr = qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ); diff --git a/Shorewall/install.sh b/Shorewall/install.sh index 873d7c517..a85829a50 100755 --- a/Shorewall/install.sh +++ b/Shorewall/install.sh @@ -1051,6 +1051,10 @@ if [ -d Perl ]; then install_file $f ${DESTDIR}${PERLLIBDIR}/$f 0644 echo "Module ${f%.*} installed as ${DESTDIR}${PERLLIBDIR}/$f" done + + if [ $SHAREDIR != /usr/share ]; then + eval perl -p -i -e \'s\|SHAREDIR => \(.\)/usr/share\|SHAREDIR => \\${1}${SHAREDIR}/\|\' ${DESTDIR}${PERLLIBDIR}/Config.pm + fi # # Install the program skeleton files # diff --git a/Shorewall/lib.cli-std b/Shorewall/lib.cli-std index e2bebd4cb..240d0a901 100644 --- a/Shorewall/lib.cli-std +++ b/Shorewall/lib.cli-std @@ -401,10 +401,11 @@ compiler() { shorewallrc=$(find_file shorewallrc) [ -f "$shorewallrc" ] || fatal_error "Compiling for export requires a shorewallrc file" else - shorewallrc="${g_basedir}/shorewallrc" + shorewallrc= fi - options="--verbose=$VERBOSITY --family=$g_family --config_path=$CONFIG_PATH --shorewallrc=${shorewallrc}" + options="--verbose=$VERBOSITY --family=$g_family --config_path=$CONFIG_PATH" + [ -n "$shorewallrc" ] && options="$options --shorewallrc=${shorewallrc}" [ -n "$STARTUP_LOG" ] && options="$options --log=$STARTUP_LOG" [ -n "$LOG_VERBOSITY" ] && options="$options --log_verbosity=$LOG_VERBOSITY"; [ -n "$g_export" ] && options="$options --export"