Apply Ed W's first patch

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2011-05-23 14:36:21 -07:00
parent c050b29985
commit a64d882a36
2 changed files with 44 additions and 41 deletions

View File

@ -26,7 +26,7 @@
# #
# For a list of supported commands, type 'shorewall help' # For a list of supported commands, type 'shorewall help'
# #
##################################################################################################### ################################################################################################
# #
# Set the configuration variables from shorewall.conf # Set the configuration variables from shorewall.conf
# #
@ -300,7 +300,6 @@ get_config() {
;; ;;
esac esac
case $LEGACY_FASTSTART in case $LEGACY_FASTSTART in
Yes|yes) Yes|yes)
;; ;;
@ -316,11 +315,10 @@ get_config() {
LEGACY_FASTSTART=Yes LEGACY_FASTSTART=Yes
;; ;;
esac esac
} }
# #
# Fatal error # Issue an error message and die
# #
startup_error() { startup_error() {
echo " ERROR: $@" >&2 echo " ERROR: $@" >&2
@ -339,6 +337,7 @@ uptodate() {
# Run the compiler # Run the compiler
# #
compiler() { compiler() {
pc=$g_libexec/shorewall/compiler.pl
if [ $(id -u) -ne 0 ]; then if [ $(id -u) -ne 0 ]; then
if [ -z "$SHOREWALL_DIR" -o "$SHOREWALL_DIR" = /etc/shorewall ]; then if [ -z "$SHOREWALL_DIR" -o "$SHOREWALL_DIR" = /etc/shorewall ]; then
@ -390,11 +389,11 @@ compiler() {
fi fi
if [ $g_perllib = ${g_libexec}/shorewall ]; then if [ $g_perllib = ${g_libexec}/shorewall ]; then
$PERL $debugflags $g_libexec/shorewall/compiler.pl $options $@ $PERL $debugflags $pc $options $@
else else
PERL5LIB=$g_perllib PERL5LIB=$g_perllib
export PERL5LIB export PERL5LIB
$PERL $debugflags $g_libexec/shorewall/compiler.pl $options $@ $PERL $debugflags $pc $options $@
fi fi
} }

View File

@ -123,7 +123,7 @@ get_config() {
;; ;;
esac esac
[ -n "$LOGFORMAT" ] || LOGFORMAT='Shorewall6:%s.%s' [ -z "$LOGFORMAT" ] && LOGFORMAT='Shorewall:%s.%s'
[ -n "$LOGFORMAT" ] && LOGFORMAT="${LOGFORMAT%%%*}" [ -n "$LOGFORMAT" ] && LOGFORMAT="${LOGFORMAT%%%*}"
@ -260,7 +260,7 @@ uptodate() {
} }
# #
# Run the appropriate compiler # Run the compiler
# #
compiler() { compiler() {
pc=$g_libexec/shorewall/compiler.pl pc=$g_libexec/shorewall/compiler.pl
@ -432,10 +432,13 @@ start_command() {
if [ -n "${g_fast}${AUTOMAKE}" ]; then if [ -n "${g_fast}${AUTOMAKE}" ]; then
if [ -z "$g_fast" -o -z "$LEGACY_FASTSTART" ]; then if [ -z "$g_fast" -o -z "$LEGACY_FASTSTART" ]; then
# #
# Autofast -- use the last compiled script # Automake or LEGACY_FASTSTART=No -- use the last compiled script
# #
object=firewall object=firewall
else else
#
# 'start -f' with LEGACY_FASTSTART=Yes -- use last saved configuration
#
object=$RESTOREFILE object=$RESTOREFILE
fi fi
@ -471,7 +474,7 @@ compile_command() {
finished=0 finished=0
while [ $finished -eq 0 ]; do while [ $finished -eq 0 ]; do
[ $# -eq 0 ] && break; [ $# -eq 0 ] && break
option=$1 option=$1
case $option in case $option in
-*) -*)
@ -575,14 +578,14 @@ check_command() {
g_profile=Yes g_profile=Yes
option=${option#p} option=${option#p}
;; ;;
r*)
g_preview=Yes;
option=${option#r}
;;
d*) d*)
g_debug=Yes; g_debug=Yes;
option=${option#d} option=${option#d}
;; ;;
r*)
g_preview=Yes;
option=${option#r}
;;
*) *)
usage 1 usage 1
;; ;;
@ -1148,7 +1151,7 @@ reload_command() # $* = original arguments less the command.
temp=$(rsh_command /sbin/shorewall6-lite show config 2> /dev/null | grep ^LITEDIR | sed 's/LITEDIR is //') temp=$(rsh_command /sbin/shorewall6-lite show config 2> /dev/null | grep ^LITEDIR | sed 's/LITEDIR is //')
[ -n "$temp" ] && litedir=$temp [ -n "$temp" ] && litedir="$temp"
temp=$(rsh_command /sbin/shorewall6-lite show config 2> /dev/null | grep ^LIBEXEC | sed 's/LIBEXEC is //') temp=$(rsh_command /sbin/shorewall6-lite show config 2> /dev/null | grep ^LIBEXEC | sed 's/LIBEXEC is //')
@ -1396,6 +1399,9 @@ if [ $# -gt 0 ] && [ "$1" = "nolock" ]; then
fi fi
SHOREWALL_DIR= SHOREWALL_DIR=
g_noroutes=
g_purge=
g_ipt_options="-nv" g_ipt_options="-nv"
g_fast= g_fast=
g_verbose_offset=0 g_verbose_offset=0
@ -1404,10 +1410,6 @@ g_debug=
g_export= g_export=
g_refreshchains=:none: g_refreshchains=:none:
g_noroutes=
g_purge=
g_timestamp=
# #
# Make sure that these variables are cleared # Make sure that these variables are cleared
# #
@ -1520,8 +1522,9 @@ SHAREDIR=/usr/share/shorewall6
CONFDIR=/etc/shorewall6 CONFDIR=/etc/shorewall6
g_product="Shorewall6" g_product="Shorewall6"
g_recovering= g_recovering=
g_timestamp=
g_libexec=/usr/share g_libexec=/usr/share
g_perllib=share/shorewall g_perllib=/usr/share/shorewall
[ -f ${CONFDIR}/vardir ] && . ${CONFDIR}/vardir [ -f ${CONFDIR}/vardir ] && . ${CONFDIR}/vardir
@ -1815,7 +1818,8 @@ case "$COMMAND" in
else else
fatal_error "Shorewall6 is not started" fatal_error "Shorewall6 is not started"
fi fi
;; *) ;;
*)
usage 1 usage 1
;; ;;