mirror of
https://gitlab.com/shorewall/code.git
synced 2025-03-05 10:02:19 +01:00
A little code reorg
git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@5720 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
parent
0c6b0db56f
commit
7592f5cb2f
@ -28,7 +28,7 @@ use warnings;
|
|||||||
use Shorewall::Common;
|
use Shorewall::Common;
|
||||||
|
|
||||||
our @ISA = qw(Exporter);
|
our @ISA = qw(Exporter);
|
||||||
our @EXPORT = qw(find_file get_configuration report_capabilities propagateconfig append_file run_user_exit generate_aux_config %config %env %capabilities );
|
our @EXPORT = qw(find_file expand_shell_variables get_configuration report_capabilities propagateconfig append_file run_user_exit generate_aux_config %config %env %capabilities );
|
||||||
our @EXPORT_OK = ();
|
our @EXPORT_OK = ();
|
||||||
our @VERSION = 1.00;
|
our @VERSION = 1.00;
|
||||||
|
|
||||||
@ -251,6 +251,13 @@ sub report_capabilities() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Some files can have shell variables embedded. This function expands them from %ENV.
|
||||||
|
#
|
||||||
|
sub expand_shell_variables( $ ) {
|
||||||
|
my $line = $_[0]; $line = $1 . ( $ENV{$2} || '' ) . $3 while $line =~ /^(.*?)\$([a-zA-Z]\w*)(.*)$/; $line;
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Read the shorewall.conf file and establish global hashes %config and %env.
|
# Read the shorewall.conf file and establish global hashes %config and %env.
|
||||||
#
|
#
|
||||||
@ -265,7 +272,8 @@ sub get_configuration() {
|
|||||||
chomp $line;
|
chomp $line;
|
||||||
next if $line =~ /^\s*#/;
|
next if $line =~ /^\s*#/;
|
||||||
next if $line =~ /^\s*$/;
|
next if $line =~ /^\s*$/;
|
||||||
$line = $1 . ( $ENV{$2} || '' ) . $3 while $line =~ /^(.*?)\$([a-zA-Z]\w*)(.*)$/;
|
|
||||||
|
expand_shell_variables( $line );
|
||||||
|
|
||||||
if ( $line =~ /^([a-zA-Z]\w*)\s*=\s*(.*)$/ ) {
|
if ( $line =~ /^([a-zA-Z]\w*)\s*=\s*(.*)$/ ) {
|
||||||
my ($var, $val) = ($1, $2);
|
my ($var, $val) = ($1, $2);
|
||||||
|
@ -32,7 +32,6 @@ use strict;
|
|||||||
|
|
||||||
our @ISA = qw(Exporter);
|
our @ISA = qw(Exporter);
|
||||||
our @EXPORT = qw( find_macro
|
our @EXPORT = qw( find_macro
|
||||||
expand_shell_variables
|
|
||||||
split_action
|
split_action
|
||||||
substitute_action
|
substitute_action
|
||||||
merge_macro_source_dest
|
merge_macro_source_dest
|
||||||
@ -61,13 +60,6 @@ sub find_macro( $ )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
|
||||||
# Macro and action files can have shell variables embedded. This function expands them from %ENV.
|
|
||||||
#
|
|
||||||
sub expand_shell_variables( $ ) {
|
|
||||||
my $line = $_[0]; $line = $1 . ( $ENV{$2} || '' ) . $3 while $line =~ /^(.*?)\$([a-zA-Z]\w*)(.*)$/; $line;
|
|
||||||
}
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Return ( action, level[:tag] ) from passed full action
|
# Return ( action, level[:tag] ) from passed full action
|
||||||
#
|
#
|
||||||
|
@ -80,10 +80,6 @@ use Shorewall::Proxyarp;
|
|||||||
# It's color theme drives my eyes crazy.
|
# It's color theme drives my eyes crazy.
|
||||||
# It's indentation scheme is unfathomable.
|
# It's indentation scheme is unfathomable.
|
||||||
#
|
#
|
||||||
# Now I could spend my time trying to configure cperl-mode to do what I want; but why?
|
|
||||||
# Like most Open Source Software, it's documentation is pathetic. I would rather spend
|
|
||||||
# my time making Shorewall better as opposed to working around braindead editing modes.
|
|
||||||
#
|
|
||||||
# Bottom line. I use quoting techinques other than 'here documents'.
|
# Bottom line. I use quoting techinques other than 'here documents'.
|
||||||
#
|
#
|
||||||
|
|
||||||
@ -92,7 +88,7 @@ sub generate_script_1 {
|
|||||||
|
|
||||||
my $date = localtime;
|
my $date = localtime;
|
||||||
|
|
||||||
emit join ( '', "#\n# Compiled firewall script generated by Shorewall-pl ", $env{VERSION}, " - $date\n#" );
|
emit "#\n# Compiled firewall script generated by Shorewall-pl $env{VERSION} - $date\n#";
|
||||||
|
|
||||||
if ( $ENV{EXPORT} ) {
|
if ( $ENV{EXPORT} ) {
|
||||||
emitj ( 'SHAREDIR=/usr/share/shorewall-lite',
|
emitj ( 'SHAREDIR=/usr/share/shorewall-lite',
|
||||||
|
Loading…
Reference in New Issue
Block a user