Add a postcompile script

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2012-09-02 08:28:02 -07:00
parent 3fbfafb6e3
commit 4f54cb34df

View File

@ -437,6 +437,21 @@ compiler() {
fi
}
#
# Run the postcompile user exit
#
run_postcompile() { # $1 is the compiled script
local script
script=$(find_file postcompile)
if [ -n "$script" ]; then
. $script $1
else
return 0
fi
}
#
# Start Command Executor
#
@ -457,6 +472,7 @@ start_command() {
progress_message3 "Compiling..."
if compiler $g_debugging $nolock compile ${VARDIR}/.start; then
run_postcompile ${VARDIR}/.start
[ -n "$nolock" ] || mutex_on
run_it ${VARDIR}/.start $g_debugging start
rc=$?
@ -666,7 +682,7 @@ compile_command() {
[ "x$file" = x- ] || progress_message3 "Compiling..."
compiler $g_debugging compile $file
compiler $g_debugging compile $file && run_postcompile $file
}
#
@ -932,6 +948,7 @@ restart_command() {
progress_message3 "Compiling..."
if compiler $g_debugging $nolock compile ${VARDIR}/.restart; then
run_postcompile ${VARDIR}/.restart
[ -n "$nolock" ] || mutex_on
run_it ${VARDIR}/.restart $g_debugging restart
rc=$?
@ -1023,6 +1040,7 @@ refresh_command() {
progress_message3 "Compiling..."
if compiler $g_debugging $nolock compile ${VARDIR}/.refresh; then
run_postcompile ${VARDIR}/.refresh
[ -n "$nolock" ] || mutex_on
run_it ${VARDIR}/.refresh $g_debugging refresh
rc=$?
@ -1137,6 +1155,8 @@ safe_commands() {
exit $status
fi
run_postcompile ${VARDIR}/.$command
case $command in
start)
RESTOREFILE=NONE
@ -1268,6 +1288,8 @@ try_command() {
exit $status
fi
run_postcompile ${VARDIR}/.restart
case $command in
start)
RESTOREFILE=NONE