diff --git a/Shorewall/Perl/Shorewall/Rules.pm b/Shorewall/Perl/Shorewall/Rules.pm index cdd09abcb..2ed7e4b67 100644 --- a/Shorewall/Perl/Shorewall/Rules.pm +++ b/Shorewall/Perl/Shorewall/Rules.pm @@ -2260,16 +2260,16 @@ EOF kill $$ exit 2 else - RESTOREPATH=${VARDIR}/$RESTOREFILE + g_restorepath=${VARDIR}/$RESTOREFILE - if [ -x $RESTOREPATH ]; then + if [ -x $g_restorepath ]; then echo Restoring ${PRODUCT:=Shorewall}... RECOVERING=Yes export RECOVERING - if $RESTOREPATH restore; then - echo "$PRODUCT restored from $RESTOREPATH" + if $g_restorepath restore; then + echo "$PRODUCT restored from $g_restorepath" set_state "Started" else set_state "Unknown" diff --git a/Shorewall/lib.cli b/Shorewall/lib.cli index 33e9ceceb..2d06850db 100644 --- a/Shorewall/lib.cli +++ b/Shorewall/lib.cli @@ -273,10 +273,10 @@ do_save() { if [ -f ${VARDIR}/firewall ]; then if $iptables_save | iptablesbug > ${VARDIR}/restore-$$; then - cp -f ${VARDIR}/firewall $RESTOREPATH - mv -f ${VARDIR}/restore-$$ ${RESTOREPATH}-iptables - chmod +x $RESTOREPATH - echo " Currently-running Configuration Saved to $RESTOREPATH" + cp -f ${VARDIR}/firewall $g_restorepath + mv -f ${VARDIR}/restore-$$ ${g_restorepath}-iptables + chmod +x $g_restorepath + echo " Currently-running Configuration Saved to $g_restorepath" run_user_exit save else rm -f ${VARDIR}/restore-$$ @@ -317,7 +317,7 @@ do_save() { # # Don't save an 'empty' file # - grep -q '^-N' ${VARDIR}/ipsets.tmp && mv -f ${VARDIR}/ipsets.tmp ${RESTOREPATH}-ipsets + grep -q '^-N' ${VARDIR}/ipsets.tmp && mv -f ${VARDIR}/ipsets.tmp ${g_restorepath}-ipsets fi fi ;; @@ -343,8 +343,8 @@ save_config() { if shorewall_is_started ; then [ -d ${VARDIR} ] || mkdir -p ${VARDIR} - if [ -f $RESTOREPATH -a ! -x $RESTOREPATH ]; then - echo " ERROR: $RESTOREPATH exists and is not a saved $PRODUCT configuration" >&2 + if [ -f $g_restorepath -a ! -x $g_restorepath ]; then + echo " ERROR: $g_restorepath exists and is not a saved $PRODUCT configuration" >&2 else case $RESTOREFILE in capabilities|chains|default_route|firewall|firewall.conf|nat|proxyarp|restarted|rt_tables|save|state|undo_routing|zones) @@ -915,20 +915,20 @@ restore_command() { exit 2 fi - RESTOREPATH=${VARDIR}/$RESTOREFILE + g_restorepath=${VARDIR}/$RESTOREFILE export NOROUTES [ -n "$nolock" ] || mutex_on - if [ -x $RESTOREPATH ]; then + if [ -x $g_restorepath ]; then progress_message3 "Restoring Shorewall..." - $SHOREWALL_SHELL $RESTOREPATH restore && progress_message3 "$PRODUCT restored from ${VARDIR}/$RESTOREFILE" + $SHOREWALL_SHELL $g_restorepath restore && progress_message3 "$PRODUCT restored from ${VARDIR}/$RESTOREFILE" [ -n "$nolock" ] || mutex_off else - echo "File $RESTOREPATH: file not found" + echo "File $g_restorepath: file not found" [ -n "$nolock" ] || mutex_off exit 2 fi diff --git a/Shorewall/releasenotes.txt b/Shorewall/releasenotes.txt index eef1cb9c1..c84703604 100644 --- a/Shorewall/releasenotes.txt +++ b/Shorewall/releasenotes.txt @@ -292,6 +292,7 @@ None. IPT_OPTIONS PROFILE PURGE + RESTOREPATH RING_BELL TEST USE_VERBOSITY diff --git a/Shorewall/shorewall b/Shorewall/shorewall index 0de0b2410..6e1b2a1fe 100755 --- a/Shorewall/shorewall +++ b/Shorewall/shorewall @@ -506,13 +506,13 @@ start_command() { fi if [ -n "$g_fast" ]; then - RESTOREPATH=${VARDIR}/$RESTOREFILE + g_restorepath=${VARDIR}/$RESTOREFILE - if [ -x $RESTOREPATH ]; then + if [ -x $g_restorepath ]; then echo Restoring Shorewall... - $SHOREWALL_SHELL $RESTOREPATH restore + $SHOREWALL_SHELL $g_restorepath restore date > ${VARDIR}/restarted - progress_message3 Shorewall restored from $RESTOREPATH + progress_message3 Shorewall restored from $g_restorepath else do_it fi @@ -964,7 +964,7 @@ safe_commands() { ;; restart) export RESTOREFILE=.safe - RESTOREPATH=${VARDIR}/.safe + g_restorepath=${VARDIR}/.safe save_config progress_message3 "Restarting..." ;; @@ -1101,7 +1101,7 @@ try_command() { ;; restart) export RESTOREFILE=.try - RESTOREPATH=${VARDIR}/.try + g_restorepath=${VARDIR}/.try save_config progress_message3 "Restarting..." ;; @@ -1827,7 +1827,7 @@ case "$COMMAND" in ;; esac - RESTOREPATH=${VARDIR}/$RESTOREFILE + g_restorepath=${VARDIR}/$RESTOREFILE [ -n "$nolock" ] || mutex_on @@ -1853,15 +1853,14 @@ case "$COMMAND" in ;; esac + g_restorepath=${VARDIR}/$RESTOREFILE - RESTOREPATH=${VARDIR}/$RESTOREFILE - - if [ -x $RESTOREPATH ]; then - rm -f $RESTOREPATH - rm -f ${RESTOREPATH}-iptables - echo " $RESTOREPATH removed" - elif [ -f $RESTOREPATH ]; then - echo " $RESTOREPATH exists and is not a saved Shorewall configuration" + if [ -x $g_restorepath ]; then + rm -f $g_restorepath + rm -f ${g_restorepath}-iptables + echo " $g_restorepath removed" + elif [ -f $g_restorepath ]; then + echo " $g_restorepath exists and is not a saved Shorewall configuration" fi rm -f ${VARDIR}/save ;; diff --git a/Shorewall6/lib.cli b/Shorewall6/lib.cli index cb0cbbc1b..138146ed8 100644 --- a/Shorewall6/lib.cli +++ b/Shorewall6/lib.cli @@ -254,10 +254,10 @@ do_save() { if [ -f ${VARDIR}/firewall ]; then if $iptables_save > ${VARDIR}/restore-$$; then - cp -f ${VARDIR}/firewall $RESTOREPATH - mv -f ${VARDIR}/restore-$$ ${RESTOREPATH}-iptables - chmod +x $RESTOREPATH - echo " Currently-running Configuration Saved to $RESTOREPATH" + cp -f ${VARDIR}/firewall $g_restorepath + mv -f ${VARDIR}/restore-$$ ${g_restorepath}-iptables + chmod +x $g_restorepath + echo " Currently-running Configuration Saved to $g_restorepath" run_user_exit save else rm -f ${VARDIR}/restore-$$ @@ -284,8 +284,8 @@ save_config() { if shorewall6_is_started ; then [ -d ${VARDIR} ] || mkdir -p ${VARDIR} - if [ -f $RESTOREPATH -a ! -x $RESTOREPATH ]; then - echo " ERROR: $RESTOREPATH exists and is not a saved $PRODUCT configuration" >&2 + if [ -f $g_restorepath -a ! -x $g_restorepath ]; then + echo " ERROR: $g_restorepath exists and is not a saved $PRODUCT configuration" >&2 else case $RESTOREFILE in capabilities|chains|default_route|firewall|firewall.conf|nat|proxyarp|restarted|rt_tables|save|state|undo_routing|zones) @@ -791,27 +791,27 @@ restore_command() { exit 2 fi - RESTOREPATH=${VARDIR}/$RESTOREFILE + g_restorepath=${VARDIR}/$RESTOREFILE export NOROUTES [ -n "$nolock" ] || mutex_on - if [ -x $RESTOREPATH ]; then - if [ -x ${RESTOREPATH}-ipsets ] ; then + if [ -x $g_restorepath ]; then + if [ -x ${g_restorepath}-ipsets ] ; then echo Restoring Ipsets... $IP6TABLES -F $IP6TABLES -X - $SHOREWALL_SHELL ${RESTOREPATH}-ipsets + $SHOREWALL_SHELL ${g_restorepath}-ipsets fi progress_message3 "Restoring Shorewall6..." - $SHOREWALL_SHELL $RESTOREPATH restore && progress_message3 "$PRODUCT restored from ${VARDIR}/$RESTOREFILE" + $SHOREWALL_SHELL $g_restorepath restore && progress_message3 "$PRODUCT restored from ${VARDIR}/$RESTOREFILE" [ -n "$nolock" ] || mutex_off else - echo "File $RESTOREPATH: file not found" + echo "File $g_restorepath: file not found" [ -n "$nolock" ] || mutex_off exit 2 fi diff --git a/Shorewall6/shorewall6 b/Shorewall6/shorewall6 index 9c90e6523..3bb58c9d8 100755 --- a/Shorewall6/shorewall6 +++ b/Shorewall6/shorewall6 @@ -433,13 +433,13 @@ start_command() { fi if [ -n "$g_fast" ]; then - RESTOREPATH=${VARDIR}/$RESTOREFILE + g_restorepath=${VARDIR}/$RESTOREFILE - if [ -x $RESTOREPATH ]; then + if [ -x $g_restorepath ]; then echo Restoring Shorewall6... - $SHOREWALL_SHELL $RESTOREPATH restore + $SHOREWALL_SHELL $g_restorepath restore date > ${VARDIR}/restarted - progress_message3 Shorewall6 restored from $RESTOREPATH + progress_message3 Shorewall6 restored from $g_restorepath else do_it fi @@ -891,7 +891,7 @@ safe_commands() { ;; restart) export RESTOREFILE=.safe - RESTOREPATH=${VARDIR}/.safe + g_restorepath=${VARDIR}/.safe save_config progress_message3 "Restarting..." ;; @@ -1028,7 +1028,7 @@ try_command() { ;; restart) export RESTOREFILE=.try - RESTOREPATH=${VARDIR}/.try + g_restorepath=${VARDIR}/.try save_config progress_message3 "Restarting..." ;; @@ -1714,7 +1714,7 @@ case "$COMMAND" in ;; esac - RESTOREPATH=${VARDIR}/$RESTOREFILE + g_restorepath=${VARDIR}/$RESTOREFILE [ -n "$nolock" ] || mutex_on @@ -1740,21 +1740,20 @@ case "$COMMAND" in ;; esac + g_restorepath=${VARDIR}/$RESTOREFILE - RESTOREPATH=${VARDIR}/$RESTOREFILE + if [ -x $g_restorepath ]; then - if [ -x $RESTOREPATH ]; then - - if [ -x ${RESTOREPATH}-ipsets ]; then - rm -f ${RESTOREPATH}-ipsets - echo " ${RESTOREPATH}-ipsets removed" + if [ -x ${g_restorepath}-ipsets ]; then + rm -f ${g_restorepath}-ipsets + echo " ${g_restorepath}-ipsets removed" fi - rm -f $RESTOREPATH - rm -f ${RESTOREPATH}-iptables - echo " $RESTOREPATH removed" - elif [ -f $RESTOREPATH ]; then - echo " $RESTOREPATH exists and is not a saved Shorewall6 configuration" + rm -f $g_restorepath + rm -f ${g_restorepath}-iptables + echo " $g_restorepath removed" + elif [ -f $g_restorepath ]; then + echo " $g_restorepath exists and is not a saved Shorewall6 configuration" fi rm -f ${VARDIR}/save ;; diff --git a/docs/configuration_file_basics.xml b/docs/configuration_file_basics.xml index 1a174ea9c..1a4f8daa1 100644 --- a/docs/configuration_file_basics.xml +++ b/docs/configuration_file_basics.xml @@ -649,7 +649,7 @@ SHELL cat /etc/shorewall/rules.d/*.rules RECOVERING - RESTOREPATH + RESTOREPATH RING_BELL diff --git a/manpages/shorewall-params.xml b/manpages/shorewall-params.xml index 93af7324c..c1277ef15 100644 --- a/manpages/shorewall-params.xml +++ b/manpages/shorewall-params.xml @@ -66,7 +66,7 @@ RECOVERING - RESTOREPATH + RESTOREPATH RING_BELL diff --git a/manpages6/shorewall6-params.xml b/manpages6/shorewall6-params.xml index acfa73456..1db6a2144 100644 --- a/manpages6/shorewall6-params.xml +++ b/manpages6/shorewall6-params.xml @@ -67,7 +67,7 @@ RECOVERING - RESTOREPATH + RESTOREPATH RING_BELL