From 41178852fb0942248da49521843e1768f98d58d2 Mon Sep 17 00:00:00 2001 From: teastep Date: Sun, 9 Oct 2005 02:36:30 +0000 Subject: [PATCH] Avoid extra $COMMAND tests git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@2835 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- Shorewall/firewall | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/Shorewall/firewall b/Shorewall/firewall index a6e853292..daa739a16 100755 --- a/Shorewall/firewall +++ b/Shorewall/firewall @@ -112,11 +112,9 @@ save_command() # save_progress_message() { - if [ $COMMAND != refresh ]; then - echo >> $RESTOREBASE - echo "progress_message \"$@\"" >> $RESTOREBASE - echo >> $RESTOREBASE - fi + echo >> $RESTOREBASE + echo "progress_message \"$@\"" >> $RESTOREBASE + echo >> $RESTOREBASE } # @@ -127,7 +125,7 @@ save_progress_message() # run_and_save_command() { - [ $COMMAND = refresh ] || echo "$@" >> $RESTOREBASE + echo "$@" >> $RESTOREBASE eval $* } @@ -137,7 +135,7 @@ run_and_save_command() ensure_and_save_command() { if eval $* ; then - [ $COMMAND = refresh ] || echo "$@" >> $RESTOREBASE + echo "$@" >> $RESTOREBASE else [ -z "$STOPPING" ] && { stop_firewall; exit 2; } fi @@ -8696,6 +8694,26 @@ define_firewall() # $1 = Command (Start or Restart) # refresh_firewall() { + # + # Overload some functions that need different behavior in this command + # + save_progress_message() + { + echo $@ >> /dev/null + } + + run_and_save_command() + { + eval $* + } + + ensure_and_save_command() + { + if ! eval $* ; then + [ -z "$STOPPING" ] && { stop_firewall; exit 2; } + fi + } + echo "Refreshing Shorewall..." echo "Determining Zones and Interfaces..."