Avoid extra $COMMAND tests

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@2835 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2005-10-09 02:36:30 +00:00
parent 1a8f760491
commit 41178852fb

View File

@ -112,11 +112,9 @@ save_command()
# #
save_progress_message() save_progress_message()
{ {
if [ $COMMAND != refresh ]; then echo >> $RESTOREBASE
echo >> $RESTOREBASE echo "progress_message \"$@\"" >> $RESTOREBASE
echo "progress_message \"$@\"" >> $RESTOREBASE echo >> $RESTOREBASE
echo >> $RESTOREBASE
fi
} }
# #
@ -127,7 +125,7 @@ save_progress_message()
# #
run_and_save_command() run_and_save_command()
{ {
[ $COMMAND = refresh ] || echo "$@" >> $RESTOREBASE echo "$@" >> $RESTOREBASE
eval $* eval $*
} }
@ -137,7 +135,7 @@ run_and_save_command()
ensure_and_save_command() ensure_and_save_command()
{ {
if eval $* ; then if eval $* ; then
[ $COMMAND = refresh ] || echo "$@" >> $RESTOREBASE echo "$@" >> $RESTOREBASE
else else
[ -z "$STOPPING" ] && { stop_firewall; exit 2; } [ -z "$STOPPING" ] && { stop_firewall; exit 2; }
fi fi
@ -8696,6 +8694,26 @@ define_firewall() # $1 = Command (Start or Restart)
# #
refresh_firewall() 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 "Refreshing Shorewall..."
echo "Determining Zones and Interfaces..." echo "Determining Zones and Interfaces..."