From 4f54cb34df33114edfe8673ba7291a6b02008948 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Sun, 2 Sep 2012 08:28:02 -0700 Subject: [PATCH] Add a postcompile script Signed-off-by: Tom Eastep --- Shorewall/lib.cli-std | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/Shorewall/lib.cli-std b/Shorewall/lib.cli-std index 7f23ff344..32f7f0b05 100644 --- a/Shorewall/lib.cli-std +++ b/Shorewall/lib.cli-std @@ -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