mirror of
https://gitlab.com/shorewall/code.git
synced 2025-06-01 23:45:53 +02:00
Don't run the postcompile script when compilation is bypassed
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
b35c214c70
commit
9bf65ab9ab
@ -363,6 +363,21 @@ uptodate() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Run the postcompile user exit
|
||||||
|
#
|
||||||
|
run_postcompile() { # $1 is the compiled script
|
||||||
|
local script
|
||||||
|
|
||||||
|
script=$(find_file postcompile)
|
||||||
|
|
||||||
|
if [ -f $script ]; then
|
||||||
|
. $script $1
|
||||||
|
else
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Run the compiler
|
# Run the compiler
|
||||||
#
|
#
|
||||||
@ -413,7 +428,7 @@ compiler() {
|
|||||||
[ -f "$shorewallrc1" ] || fatal_error "Compiling for export requires a shorewallrc file"
|
[ -f "$shorewallrc1" ] || fatal_error "Compiling for export requires a shorewallrc file"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$g_conditional" ] && uptodate $g_file; then
|
if [ -n "$g_conditional" ] && uptodate "$g_file"; then
|
||||||
echo "$g_file is up to date -- no compilation required"
|
echo "$g_file is up to date -- no compilation required"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
@ -453,21 +468,15 @@ compiler() {
|
|||||||
else
|
else
|
||||||
PERL5LIB=${PERLLIBDIR} $PERL $debugflags $pc $options $@
|
PERL5LIB=${PERLLIBDIR} $PERL $debugflags $pc $options $@
|
||||||
fi
|
fi
|
||||||
}
|
|
||||||
|
|
||||||
#
|
status=$?
|
||||||
# Run the postcompile user exit
|
|
||||||
#
|
|
||||||
run_postcompile() { # $1 is the compiled script
|
|
||||||
local script
|
|
||||||
|
|
||||||
script=$(find_file postcompile)
|
if [ $status -eq 0 -a $COMMAND != check ]; then
|
||||||
|
run_postcompile "$g_file"
|
||||||
if [ -f $script ]; then
|
return
|
||||||
. $script $1
|
|
||||||
else
|
|
||||||
return 0
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
return $status
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -487,8 +496,8 @@ start_command() {
|
|||||||
rc=$?
|
rc=$?
|
||||||
[ -n "$nolock" ] || mutex_off
|
[ -n "$nolock" ] || mutex_off
|
||||||
else
|
else
|
||||||
if compiler $g_debugging $nolock compile ${VARDIR}/.start; then
|
g_file="${VARDIR}/.start"
|
||||||
run_postcompile ${VARDIR}/.start
|
if compiler $g_debugging $nolock compile "$g_file"; then
|
||||||
[ -n "$nolock" ] || mutex_on
|
[ -n "$nolock" ] || mutex_on
|
||||||
run_it ${VARDIR}/.start $g_debugging start
|
run_it ${VARDIR}/.start $g_debugging start
|
||||||
rc=$?
|
rc=$?
|
||||||
@ -692,7 +701,7 @@ compile_command() {
|
|||||||
;;
|
;;
|
||||||
1)
|
1)
|
||||||
g_file=$1
|
g_file=$1
|
||||||
[ -d $g_file ] && fatal_error "$g_file is a directory"
|
[ -d "$g_file" ] && fatal_error "$g_file is a directory"
|
||||||
;;
|
;;
|
||||||
2)
|
2)
|
||||||
[ -n "$g_shorewalldir" -a -z "$g_export" ] && usage 2
|
[ -n "$g_shorewalldir" -a -z "$g_export" ] && usage 2
|
||||||
@ -715,7 +724,7 @@ compile_command() {
|
|||||||
|
|
||||||
[ "x$g_file" = x- ] && g_doing=''
|
[ "x$g_file" = x- ] && g_doing=''
|
||||||
|
|
||||||
compiler $g_debugging compile $g_file && run_postcompile $g_file
|
compiler $g_debugging compile "$g_file"
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -1005,9 +1014,10 @@ restart_command() {
|
|||||||
uptodate ${VARDIR}/firewall && g_fast=Yes
|
uptodate ${VARDIR}/firewall && g_fast=Yes
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
g_file="${VARDIR}/.restart"
|
||||||
|
|
||||||
if [ -z "$g_fast" ]; then
|
if [ -z "$g_fast" ]; then
|
||||||
if compiler $g_debugging $nolock compile ${VARDIR}/.restart; then
|
if compiler $g_debugging $nolock compile "$g_file"; then
|
||||||
run_postcompile ${VARDIR}/.restart
|
|
||||||
[ -n "$nolock" ] || mutex_on
|
[ -n "$nolock" ] || mutex_on
|
||||||
run_it ${VARDIR}/.restart $g_debugging restart
|
run_it ${VARDIR}/.restart $g_debugging restart
|
||||||
rc=$?
|
rc=$?
|
||||||
@ -1100,8 +1110,9 @@ refresh_command() {
|
|||||||
|
|
||||||
[ -n "$STARTUP_ENABLED" ] || not_configured_error "Startup is disabled"
|
[ -n "$STARTUP_ENABLED" ] || not_configured_error "Startup is disabled"
|
||||||
|
|
||||||
if compiler $g_debugging $nolock compile ${VARDIR}/.refresh; then
|
g_file="${VARDIR}/.refresh"
|
||||||
run_postcompile ${VARDIR}/.refresh
|
|
||||||
|
if compiler $g_debugging $nolock compile "$g_file"; then
|
||||||
[ -n "$nolock" ] || mutex_on
|
[ -n "$nolock" ] || mutex_on
|
||||||
run_it ${VARDIR}/.refresh $g_debugging refresh
|
run_it ${VARDIR}/.refresh $g_debugging refresh
|
||||||
rc=$?
|
rc=$?
|
||||||
@ -1209,7 +1220,9 @@ safe_commands() {
|
|||||||
command="restart"
|
command="restart"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! compiler $g_debugging nolock compile ${VARDIR}/.$command; then
|
g_file="${VARDIR}/.$command"
|
||||||
|
|
||||||
|
if ! compiler $g_debugging nolock compile "$g_file"; then
|
||||||
status=$?
|
status=$?
|
||||||
exit $status
|
exit $status
|
||||||
fi
|
fi
|
||||||
@ -1340,7 +1353,9 @@ try_command() {
|
|||||||
command="restart"
|
command="restart"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! compiler $g_debugging $nolock compile ${VARDIR}/.$command; then
|
g_file="${VARDIR}/.$command"
|
||||||
|
|
||||||
|
if ! compiler $g_debugging $nolock compile "$g_file"; then
|
||||||
status=$?
|
status=$?
|
||||||
exit $status
|
exit $status
|
||||||
fi
|
fi
|
||||||
@ -1534,7 +1549,9 @@ reload_command() # $* = original arguments less the command.
|
|||||||
|
|
||||||
[ -n "$litedir" ] || litedir=${VARLIB}/${g_program}-lite
|
[ -n "$litedir" ] || litedir=${VARLIB}/${g_program}-lite
|
||||||
|
|
||||||
if compiler $g_debugging compiler $g_shorewalldir/firewall && \
|
g_file="$g_shorewalldir/firewall"
|
||||||
|
|
||||||
|
if compiler $g_debugging compiler "$g_file" && \
|
||||||
progress_message3 "Copying $file and ${file}.conf to ${system}:${litedir}..." && \
|
progress_message3 "Copying $file and ${file}.conf to ${system}:${litedir}..." && \
|
||||||
rcp_command "$g_shorewalldir/firewall $g_shorewalldir/firewall.conf" ${litedir}
|
rcp_command "$g_shorewalldir/firewall $g_shorewalldir/firewall.conf" ${litedir}
|
||||||
then
|
then
|
||||||
@ -1623,7 +1640,9 @@ export_command() # $* = original arguments less the command.
|
|||||||
|
|
||||||
g_export=Yes
|
g_export=Yes
|
||||||
|
|
||||||
if compiler $g_debugging compile $g_shorewalldir/firewall && \
|
g_file="$g_shorewalldir/firewall"
|
||||||
|
|
||||||
|
if compiler $g_debugging compile "$g_file" && \
|
||||||
echo "Copying $file and ${file}.conf to ${target#*@}..." && \
|
echo "Copying $file and ${file}.conf to ${target#*@}..." && \
|
||||||
scp $g_shorewalldir/firewall $g_shorewalldir/firewall.conf $target
|
scp $g_shorewalldir/firewall $g_shorewalldir/firewall.conf $target
|
||||||
then
|
then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user