Cosmetic changes to generated script

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@6766 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2007-07-03 18:22:36 +00:00
parent 70690de951
commit 82428d66bc
3 changed files with 61 additions and 52 deletions

View File

@ -84,29 +84,13 @@ sub reinitialize() {
sub generate_script_1() { sub generate_script_1() {
copy $globals{SHAREDIRPL} . 'prog.header';
my $date = localtime; my $date = localtime;
emit "#\n# Compiled firewall script generated by Shorewall-perl $globals{VERSION} - $date\n#"; emit "#!/bin/sh\n#\n# Compiled firewall script generated by Shorewall-perl $globals{VERSION} - $date\n#";
if ( $export ) { copy $globals{SHAREDIRPL} . 'prog.header';
emitj ( 'SHAREDIR=/usr/share/shorewall-lite',
'CONFDIR=/etc/shorewall-lite',
'VARDIR=/var/lib/shorewall-lite',
'PRODUCT="Shorewall Lite"'
);
} else {
emitj ( 'SHAREDIR=/usr/share/shorewall',
'CONFDIR=/etc/shorewall',
'VARDIR=/var/lib/shorewall',
'PRODUCT=\'Shorewall\'',
);
}
emit "TEMPFILE=\n"; for my $exit qw/init start tcclear started stop stopped clear refresh/ {
for my $exit qw/init start tcclear started stop stopped clear/ {
emit "run_${exit}_exit() {"; emit "run_${exit}_exit() {";
push_indent; push_indent;
append_file $exit or emit 'true'; append_file $exit or emit 'true';
@ -123,12 +107,28 @@ sub generate_script_1() {
push_indent; push_indent;
if ( $export ) {
emitj ( 'SHAREDIR=/usr/share/shorewall-lite',
'CONFDIR=/etc/shorewall-lite',
'VARDIR=/var/lib/shorewall-lite',
'PRODUCT="Shorewall Lite"'
);
} else {
emitj ( 'SHAREDIR=/usr/share/shorewall',
'CONFDIR=/etc/shorewall',
'VARDIR=/var/lib/shorewall',
'PRODUCT=\'Shorewall\'',
);
}
if ( $export ) { if ( $export ) {
emit ( 'CONFIG_PATH="/etc/shorewall-lite:/usr/share/shorewall-lite"' ); emit ( 'CONFIG_PATH="/etc/shorewall-lite:/usr/share/shorewall-lite"' );
} else { } else {
emit ( qq(CONFIG_PATH="$config{CONFIG_PATH}") ); emit ( qq(CONFIG_PATH="$config{CONFIG_PATH}") );
} }
emit 'TEMPFILE=';
propagateconfig; propagateconfig;
emitj ( '[ -n "${COMMAND:=restart}" ]', emitj ( '[ -n "${COMMAND:=restart}" ]',
@ -627,14 +627,17 @@ if [ $COMMAND = restore ]; then
fi fi
set_state "Started" set_state "Started"
else else
if [ $COMMAND = refresh ]; then
run_refresh_exit
else
setup_netfilter setup_netfilter
restore_dynamic_rules restore_dynamic_rules
run_start_exit run_start_exit
$IPTABLES -N shorewall $IPTABLES -N shorewall
set_state "Started" set_state "Started"
run_started_exit run_started_exit
cp -f $(my_pathname) ${VARDIR}/.restore cp -f $(my_pathname) ${VARDIR}/.restore
fi
fi fi
date > ${VARDIR}/restarted date > ${VARDIR}/restarted

View File

@ -1,17 +1,20 @@
--- ../Shorewall-common/lib.base 2007-07-02 15:50:32.000000000 -0700 --- ../Shorewall-common/lib.base 2007-07-02 15:50:32.000000000 -0700
+++ prog.header 2007-07-02 16:50:14.000000000 -0700 +++ prog.header 2007-07-03 10:27:47.000000000 -0700
@@ -1,48 +1,29 @@ @@ -1,48 +1,28 @@
#!/bin/sh -#!/bin/sh
+# This program is under GPL [http://www.gnu.org/copyleft/gpl.htm]
# #
-# Shorewall 4.0 -- /usr/share/shorewall/lib.base -# Shorewall 4.0 -- /usr/share/shorewall/lib.base
+# Generated by the Shoreline Firewall (Shorewall) Packet Filtering Firewall - V4.0
#
# This program is under GPL [http://www.gnu.org/copyleft/gpl.htm]
#
-# (c) 1999,2000,2001,2002,2003,2004,2005,2006,2007 - Tom Eastep (teastep@shorewall.net)
+# (c) 2006,2007 - Tom Eastep (teastep@shorewall.net) +# (c) 2006,2007 - Tom Eastep (teastep@shorewall.net)
# #
-# This program is under GPL [http://www.gnu.org/copyleft/gpl.htm]
#
-# (c) 1999,2000,2001,2002,2003,2004,2005,2006,2007 - Tom Eastep (teastep@shorewall.net)
+# Options are:
#
-# Complete documentation is available at http://shorewall.net -# Complete documentation is available at http://shorewall.net
+# -n Don't alter Routing
+# -v and -q Standard Shorewall Verbosity control
# #
-# This program is free software; you can redistribute it and/or modify -# This program is free software; you can redistribute it and/or modify
-# it under the terms of Version 2 of the GNU General Public License -# it under the terms of Version 2 of the GNU General Public License
@ -48,11 +51,6 @@
-SHELLSHAREDIR=/usr/share/shorewall-shell -SHELLSHAREDIR=/usr/share/shorewall-shell
-PERLSHAREDIR=/usr/share/shorewall-perl -PERLSHAREDIR=/usr/share/shorewall-perl
- -
+# Options are:
+#
+# -n Don't alter Routing
+# -v and -q Standard Shorewall Verbosity control
+#
+# Commands are: +# Commands are:
+# +#
+# start Starts the firewall +# start Starts the firewall
@ -65,10 +63,13 @@
+# version Displays the version of Shorewall that +# version Displays the version of Shorewall that
+# generated this program +# generated this program
+# +#
+################################################################################
+# Functions imported from /usr/share/shorewall/lib.base
+################################################################################
# #
# Message to stderr # Message to stderr
# #
@@ -111,20 +92,6 @@ @@ -111,20 +91,6 @@
} }
# #
@ -89,7 +90,7 @@
# Suppress all output for a command # Suppress all output for a command
# #
qt() qt()
@@ -310,83 +277,6 @@ @@ -310,83 +276,6 @@
} }
# #
@ -173,7 +174,7 @@
# Note: The following set of IP address manipulation functions have anomalous # Note: The following set of IP address manipulation functions have anomalous
# behavior when the shell only supports 32-bit signed arithmatic and # behavior when the shell only supports 32-bit signed arithmatic and
# the IP address is 128.0.0.0 or 128.0.0.1. # the IP address is 128.0.0.0 or 128.0.0.1.
@@ -607,40 +497,6 @@ @@ -607,40 +496,6 @@
fi fi
} }
@ -214,7 +215,7 @@
# #
# Query NetFilter about the existence of a filter chain # Query NetFilter about the existence of a filter chain
# #
@@ -879,21 +735,6 @@ @@ -879,21 +734,6 @@
} }
# #
@ -236,7 +237,7 @@
# Find a File -- For relative file name, look in each ${CONFIG_PATH} then ${CONFDIR} # Find a File -- For relative file name, look in each ${CONFIG_PATH} then ${CONFDIR}
# #
find_file() find_file()
@@ -918,54 +759,6 @@ @@ -918,54 +758,6 @@
} }
# #
@ -291,7 +292,7 @@
# Set the Shorewall state # Set the Shorewall state
# #
set_state () # $1 = state set_state () # $1 = state
@@ -974,200 +767,6 @@ @@ -974,200 +766,6 @@
} }
# #
@ -492,7 +493,7 @@
# Delete IP address # Delete IP address
# #
del_ip_addr() # $1 = address, $2 = interface del_ip_addr() # $1 = address, $2 = interface
@@ -1286,82 +885,6 @@ @@ -1286,82 +884,6 @@
cut -b -${1} cut -b -${1}
} }
@ -575,7 +576,7 @@
delete_tc1() delete_tc1()
{ {
clear_one_tc() { clear_one_tc() {
@@ -1496,65 +1019,3 @@ @@ -1496,65 +1018,6 @@
echo echo echo echo
} }
@ -641,3 +642,6 @@
- esac - esac
- fi - fi
-} -}
+################################################################################
+# End of functions imported from /usr/share/shorewall/lib.base
+################################################################################

View File

@ -1,7 +1,3 @@
#!/bin/sh
#
# Generated by the Shoreline Firewall (Shorewall) Packet Filtering Firewall - V4.0
#
# This program is under GPL [http://www.gnu.org/copyleft/gpl.htm] # This program is under GPL [http://www.gnu.org/copyleft/gpl.htm]
# #
# (c) 2006,2007 - Tom Eastep (teastep@shorewall.net) # (c) 2006,2007 - Tom Eastep (teastep@shorewall.net)
@ -24,6 +20,9 @@
# version Displays the version of Shorewall that # version Displays the version of Shorewall that
# generated this program # generated this program
# #
################################################################################
# Functions imported from /usr/share/shorewall/lib.base
################################################################################
# #
# Message to stderr # Message to stderr
# #
@ -1019,3 +1018,6 @@ find_echo() {
echo echo echo echo
} }
################################################################################
# End of functions imported from /usr/share/shorewall/lib.base
################################################################################