mirror of
https://gitlab.com/shorewall/code.git
synced 2024-12-22 06:10:42 +01:00
Pass both shorewallrc files to the compiler from lib.cli-std
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
b8e6a812bd
commit
55e3b11a28
@ -54,8 +54,8 @@ my $family;
|
||||
#
|
||||
# Initilize the package-globals in the other modules
|
||||
#
|
||||
sub initialize_package_globals( $$ ) {
|
||||
Shorewall::Config::initialize($family, $_[1]);
|
||||
sub initialize_package_globals( $$$ ) {
|
||||
Shorewall::Config::initialize($family, $_[1], $_[2]);
|
||||
Shorewall::Chains::initialize ($family, 1, $export );
|
||||
Shorewall::Zones::initialize ($family, $_[0]);
|
||||
Shorewall::Nat::initialize;
|
||||
@ -546,8 +546,8 @@ EOF
|
||||
#
|
||||
sub compiler {
|
||||
|
||||
my ( $scriptfilename, $directory, $verbosity, $timestamp , $debug, $chains , $log , $log_verbosity, $preview, $confess , $update , $annotate , $convert, $config_path, $shorewallrc ) =
|
||||
( '', '', -1, '', 0, '', '', -1, 0, 0, 0, 0, , 0 , '' , '');
|
||||
my ( $scriptfilename, $directory, $verbosity, $timestamp , $debug, $chains , $log , $log_verbosity, $preview, $confess , $update , $annotate , $convert, $config_path, $shorewallrc , $shorewallrc1 ) =
|
||||
( '', '', -1, '', 0, '', '', -1, 0, 0, 0, 0, , 0 , '' , '/usr/share/shorewall/shorewallrc', '' );
|
||||
|
||||
$export = 0;
|
||||
$test = 0;
|
||||
@ -586,6 +586,7 @@ sub compiler {
|
||||
annotate => { store => \$annotate, validate=> \&validate_boolean } ,
|
||||
config_path => { store => \$config_path } ,
|
||||
shorewallrc => { store => \$shorewallrc } ,
|
||||
shorewallrc1 => { store => \$shorewallrc1 } ,
|
||||
);
|
||||
#
|
||||
# P A R A M E T E R P R O C E S S I N G
|
||||
@ -603,7 +604,7 @@ sub compiler {
|
||||
#
|
||||
# Now that we know the address family (IPv4/IPv6), we can initialize the other modules' globals
|
||||
#
|
||||
initialize_package_globals( $update, $shorewallrc );
|
||||
initialize_package_globals( $update, $shorewallrc, $shorewallrc1 );
|
||||
|
||||
set_config_path( $config_path ) if $config_path;
|
||||
|
||||
|
@ -190,10 +190,6 @@ 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.
|
||||
#
|
||||
@ -571,8 +567,8 @@ sub process_shorewallrc($);
|
||||
# 2. The compiler can run multiple times in the same process so it has to be
|
||||
# able to re-initialize its dependent modules' state.
|
||||
#
|
||||
sub initialize( $;$ ) {
|
||||
( $family, my $shorewallrc ) = @_;
|
||||
sub initialize( $;$$) {
|
||||
( $family, my ( $shorewallrc, $shorewallrc1 ) ) = @_;
|
||||
|
||||
if ( $family == F_IPV4 ) {
|
||||
( $product, $Product, $toolname, $toolNAME ) = qw( shorewall Shorewall iptables IPTABLES );
|
||||
@ -609,7 +605,7 @@ sub initialize( $;$ ) {
|
||||
EXPORT => 0,
|
||||
KLUDGEFREE => '',
|
||||
STATEMATCH => '-m state --state',
|
||||
VERSION => "4.5.6",
|
||||
VERSION => "4.5.8-Beta2",
|
||||
CAPVERSION => 40507 ,
|
||||
);
|
||||
#
|
||||
@ -951,7 +947,9 @@ sub initialize( $;$ ) {
|
||||
#
|
||||
# Process the global shorewallrc file
|
||||
#
|
||||
process_shorewallrc( SHAREDIR . '/shorewall/shorewallrc' );
|
||||
# Note: The build file executes this function passing only the protocol family
|
||||
#
|
||||
process_shorewallrc( $shorewallrc ) if defined $shorewallrc;
|
||||
|
||||
$globals{SHAREDIRPL} = "$shorewallrc{SHAREDIR}/shorewall/";
|
||||
|
||||
@ -970,7 +968,7 @@ sub initialize( $;$ ) {
|
||||
#
|
||||
# If we are compiling for export, process the shorewallrc from the remote system
|
||||
#
|
||||
process_shorewallrc( $shorewallrc ) if $shorewallrc;
|
||||
process_shorewallrc( $shorewallrc1 ) if $shorewallrc1;
|
||||
}
|
||||
|
||||
my @abbr = qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec );
|
||||
|
@ -37,7 +37,8 @@
|
||||
# --log_verbosity=<number> # Log Verbosity range -1 to 2
|
||||
# --family=<number> # IP family; 4 = IPv4 (default), 6 = IPv6
|
||||
# --preview # Preview the ruleset.
|
||||
# --shorewallrc=<path> # Path to shorewallrc file.
|
||||
# --shorewallrc=<path> # Path to global shorewallrc file.
|
||||
# --shorewallrc1=<path> # Path to export shorewallrc file.
|
||||
# --config_path=<path-list> # Search path for config files
|
||||
#
|
||||
use strict;
|
||||
@ -67,6 +68,7 @@ sub usage( $ ) {
|
||||
[ --update ]
|
||||
[ --convert ]
|
||||
[ --shorewallrc=<pathname> ]
|
||||
[ --shorewallrc1=<pathname> ]
|
||||
[ --config_path=<path-list> ]
|
||||
';
|
||||
|
||||
@ -94,6 +96,7 @@ my $update = 0;
|
||||
my $convert = 0;
|
||||
my $config_path = '';
|
||||
my $shorewallrc = '';
|
||||
my $shorewallrc1 = '';
|
||||
|
||||
Getopt::Long::Configure ('bundling');
|
||||
|
||||
@ -126,6 +129,7 @@ my $result = GetOptions('h' => \$help,
|
||||
'convert' => \$convert,
|
||||
'config_path=s' => \$config_path,
|
||||
'shorewallrc=s' => \$shorewallrc,
|
||||
'shorewallrc1=s' => \$shorewallrc1,
|
||||
);
|
||||
|
||||
usage(1) unless $result && @ARGV < 2;
|
||||
@ -148,5 +152,6 @@ compiler( script => $ARGV[0] || '',
|
||||
convert => $convert,
|
||||
annotate => $annotate,
|
||||
config_path => $config_path,
|
||||
shorewallrc => $shorewallrc
|
||||
shorewallrc => $shorewallrc,
|
||||
shorewallrc1 => $shorewallrc1,
|
||||
);
|
||||
|
@ -1051,10 +1051,6 @@ 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
|
||||
#
|
||||
|
@ -361,6 +361,7 @@ uptodate() {
|
||||
compiler() {
|
||||
local pc
|
||||
local shorewallrc
|
||||
local shorewallrc1
|
||||
|
||||
pc=$g_libexec/shorewall/compiler.pl
|
||||
|
||||
@ -397,15 +398,15 @@ compiler() {
|
||||
[ "$1" = nolock ] && shift;
|
||||
shift
|
||||
|
||||
shorewallrc=${g_basedir}/shorewallrc
|
||||
|
||||
if [ -n "$g_export" ]; then
|
||||
shorewallrc=$(find_file shorewallrc)
|
||||
[ -f "$shorewallrc" ] || fatal_error "Compiling for export requires a shorewallrc file"
|
||||
else
|
||||
shorewallrc=
|
||||
shorewallrc1=$(find_file shorewallrc)
|
||||
[ -f "$shorewallrc1" ] || fatal_error "Compiling for export requires a shorewallrc file"
|
||||
fi
|
||||
|
||||
options="--verbose=$VERBOSITY --family=$g_family --config_path=$CONFIG_PATH"
|
||||
[ -n "$shorewallrc" ] && options="$options --shorewallrc=${shorewallrc}"
|
||||
options="--verbose=$VERBOSITY --family=$g_family --config_path=$CONFIG_PATH --shorewallrc=${shorewallrc}"
|
||||
[ -n "$shorewallrc1" ] && options="$options --shorewallrc1=${shorewallrc1}"
|
||||
[ -n "$STARTUP_LOG" ] && options="$options --log=$STARTUP_LOG"
|
||||
[ -n "$LOG_VERBOSITY" ] && options="$options --log_verbosity=$LOG_VERBOSITY";
|
||||
[ -n "$g_export" ] && options="$options --export"
|
||||
|
@ -978,10 +978,19 @@ set +a
|
||||
<term>shorewallrc</term>
|
||||
|
||||
<listitem>
|
||||
<para>Pathname of the shorewallrc file. Added in Shorewall
|
||||
<para>Pathname of the global shorewallrc file. Added in Shorewall
|
||||
4.5.1.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>shorewallrc1</term>
|
||||
|
||||
<listitem>
|
||||
<para>Pathname of the export shorewallrc file. Added in Shorewall
|
||||
4.5.8.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
|
||||
<para>Those parameters that are supplied must have defined values.
|
||||
|
Loading…
Reference in New Issue
Block a user