From 8ed66423873e072328f71845674f985b7ba454eb Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Fri, 22 Feb 2013 16:15:41 -0800 Subject: [PATCH] Modify reload_command() and export_command() to directly call compiler() Signed-off-by: Tom Eastep --- Shorewall-core/lib.cli | 1 + Shorewall/lib.cli-std | 25 +++++++++++++++---------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/Shorewall-core/lib.cli b/Shorewall-core/lib.cli index a11f636b4..f50933cbc 100644 --- a/Shorewall-core/lib.cli +++ b/Shorewall-core/lib.cli @@ -3347,6 +3347,7 @@ shorewall_cli() { g_recovering= g_timestamp= g_shorewalldir= + g_haveconfig= VERBOSE= VERBOSITY=1 diff --git a/Shorewall/lib.cli-std b/Shorewall/lib.cli-std index ee4af3e43..847a139b7 100644 --- a/Shorewall/lib.cli-std +++ b/Shorewall/lib.cli-std @@ -367,7 +367,7 @@ compiler() { # # We've now set g_shorewalldir so recalculate CONFIG_PATH # - ensure_config_path + [ -n "$g_haveconfig" ] || ensure_config_path # # Get the config from $g_shorewalldir # @@ -1431,22 +1431,25 @@ reload_command() # $* = original arguments less the command. error_message " WARNING: $g_shorewalldir/shorewallrc does not exist; using settings from $SHAREDIR/shorewall" >&2 fi - if [ -z "$getcaps" ]; then - [ -f $g_shorewalldir/capabilities ] || getcaps=Yes - fi - if [ -f $g_shorewalldir/${g_program}.conf ]; then if [ -f $g_shorewalldir/params ]; then . $g_shorewalldir/params fi - . $g_shorewalldir/$g_program.conf - ensure_config_path + + get_config No + + g_haveconfig=Yes else fatal_error "$g_shorewalldir/$g_program.conf does not exist" fi + if [ -z "$getcaps" ]; then + capabilities=$(find_file capabilities) + [ -f $capabilities ] || getcaps=Yes + fi + if [ -n "$getcaps" ]; then [ -n "$DONT_LOAD" ] && DONT_LOAD="$(echo $DONT_LOAD | tr ',' ' ')" @@ -1462,9 +1465,9 @@ reload_command() # $* = original arguments less the command. file=$(resolve_file $g_shorewalldir/firewall) - [ -n "$g_timestamp" ] && timestamp='-t' || timestamp= + g_export=Yes - if $g_program $g_debugging $verbose $timestamp compile -e $g_shorewalldir $g_shorewalldir/firewall && \ + if compiler $g_debugging compiler $g_shorewalldir/firewall && \ progress_message3 "Copying $file and ${file}.conf to ${system}:${litedir}..." && \ rcp_command "$g_shorewalldir/firewall $g_shorewalldir/firewall.conf" ${litedir} then @@ -1551,7 +1554,9 @@ export_command() # $* = original arguments less the command. file=$(resolve_file $g_shorewalldir/firewall) - if $g_program $g_debugging $verbose compile -e $g_shorewalldir $g_shorewalldir/firewall && \ + g_export=Yes + + if compiler $g_debugging compile $g_shorewalldir/firewall && \ echo "Copying $file and ${file}.conf to ${target#*@}..." && \ scp $g_shorewalldir/firewall $g_shorewalldir/firewall.conf $target then