diff --git a/Shorewall/releasenotes.txt b/Shorewall/releasenotes.txt index 554c82a4e..293f3e34e 100644 --- a/Shorewall/releasenotes.txt +++ b/Shorewall/releasenotes.txt @@ -90,11 +90,11 @@ None. 5) A new AUTOMAKE option has been added to shorewall.conf and shorewall6.conf. When set to 'Yes', this option causes new behavior - during processing of the 'start' command; if no files in - /etc/shorewall/ (/etc/shorewall6) have changed since the last + during processing of the 'start' and 'restart' commands; if no + files in /etc/shorewall/ (/etc/shorewall6) have changed since the last 'start' or 'restart', then the compilation step is skipped and the - script used during the last 'start' or 'restart' is used to start - the firewall. + script used during the last 'start' or 'restart' is used to + start/restart the firewall. Note that the 'make' utility must be installed on the firewall system in order for AUTOMAKE=Yes to work correctly. diff --git a/Shorewall/shorewall b/Shorewall/shorewall index 730226074..5378e4dc9 100755 --- a/Shorewall/shorewall +++ b/Shorewall/shorewall @@ -402,6 +402,7 @@ compiler() { start_command() { local finished finished=0 + local restorefile do_it() { local rc @@ -504,6 +505,8 @@ start_command() { # # RESTOREFILE is exported by get_config() # + restorefile=$RESTOREFILE + if [ -z "$FAST" ]; then # # Autofast -- use the last compiled script @@ -515,6 +518,8 @@ start_command() { FAST= AUTOMAKE= fi + + RESTOREFILE=$restorefile else FAST= AUTOMAKE= @@ -716,6 +721,7 @@ restart_command() { finished=0 local rc rc=0 + local restorefile while [ $finished -eq 0 -a $# -gt 0 ]; do option=$1 @@ -787,27 +793,39 @@ restart_command() { export NOROUTES export PURGE - if [ -z "$FAST" ]; then - progress_message3 "Compiling..." + if [ -z "$FAST" -a -n "$AUTOMAKE" ]; then + if qt mywhich make; then + # + # RESTOREFILE is exported by get_config() + # + restorefile=$RESTOREFILE + RESTOREFILE=firewall + make -qf ${CONFDIR}/Makefile && FAST=Yes + RESTOREFILE=$restorefile + fi + fi - if compiler $debugging $nolock compile ${VARDIR}/.restart; then - [ -n "$nolock" ] || mutex_on - $SHOREWALL_SHELL ${VARDIR}/.restart $debugging restart - rc=$? - [ -n "$nolock" ] || mutex_off - else - rc=$? - logger -p kern.err "ERROR:Shorewall restart failed" - fi - else - [ -x ${VARDIR}/firewall ] || fatal_error "No ${VARDIR}/firewall file found" - [ -n "$nolock" ] || mutex_on - $SHOREWALL_SHELL ${VARDIR}/firewall $debugging restart - rc=$? - [ -n "$nolock" ] || mutex_off - fi + if [ -z "$FAST" ]; then + progress_message3 "Compiling..." - return $rc + if compiler $debugging $nolock compile ${VARDIR}/.restart; then + [ -n "$nolock" ] || mutex_on + $SHOREWALL_SHELL ${VARDIR}/.restart $debugging restart + rc=$? + [ -n "$nolock" ] || mutex_off + else + rc=$? + logger -p kern.err "ERROR:Shorewall restart failed" + fi + else + [ -x ${VARDIR}/firewall ] || fatal_error "No ${VARDIR}/firewall file found" + [ -n "$nolock" ] || mutex_on + $SHOREWALL_SHELL ${VARDIR}/firewall $debugging restart + rc=$? + [ -n "$nolock" ] || mutex_off + fi + + return $rc } #