Eliminate running the script twice is some cases

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2015-06-26 14:32:43 -07:00
parent 846d629c47
commit 9f08726794
4 changed files with 17 additions and 6 deletions

View File

@ -4019,6 +4019,7 @@ shorewall_cli() {
g_tcrules=
g_counters=
g_loopback=
g_compiled=
VERBOSE=
VERBOSITY=1

View File

@ -98,14 +98,22 @@ get_script_version() { # $1 = script
local digits
local verbosity
verbosity="$VERBOSITY"
VERBOSITY=0
if [ "$g_compiled" = "$g_file" ]; then
#
# Either this script was just compiled or AUTOMAKE determined that compilation wasn't needed
#
temp="$VERSION"
else
verbosity="$VERBOSITY"
VERBOSITY=0
temp=$( $SHOREWALL_SHELL $1 version | tail -n 1 | sed 's/-.*//' )
temp=$( $SHOREWALL_SHELL $1 version | tail -n 1 )
fi
if [ -z "$temp" ]; then
version=0
else
temp=${temp%-*}
ifs=$IFS
IFS=.
temp=$(echo $temp)

View File

@ -100,6 +100,8 @@ g_sha1sum2=
# Other Globals
#
g_counters=
g_compiled=
g_file=
initialize

View File

@ -430,6 +430,7 @@ compiler() {
if [ -n "$g_conditional" ] && uptodate "$g_file"; then
echo "$g_file is up to date -- no compilation required"
g_compiled="$g_file"
return 0
fi
@ -472,7 +473,8 @@ compiler() {
status=$?
if [ $status -eq 0 -a $COMMAND != check ]; then
run_postcompile "$g_file"
g_compiled="$g_file"
run_postcompile "$g_compiled"
return
fi
@ -1227,8 +1229,6 @@ safe_commands() {
exit $status
fi
run_postcompile ${VARDIR}/.$command
case $command in
start)
RESTOREFILE=NONE