Replace ${VARDIR}/firewall with $g_firewall in CLI

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2018-02-23 12:14:45 -08:00
parent c1a74b54fc
commit 8bc97bcd35
No known key found for this signature in database
GPG Key ID: 96E6B3F2423A4D10
2 changed files with 29 additions and 29 deletions

View File

@ -417,9 +417,9 @@ resolve_arptables() {
savesets() { savesets() {
local supported local supported
supported=$(run_it ${VARDIR}/firewall help | fgrep savesets ) supported=$(run_it $g_firewall help | fgrep savesets )
[ -n "$supported" ] && run_it ${VARDIR}/firewall savesets ${g_restorepath}-ipsets [ -n "$supported" ] && run_it $g_firewall savesets ${g_restorepath}-ipsets
} }
# #
@ -428,9 +428,9 @@ savesets() {
savesets1() { savesets1() {
local supported local supported
supported=$(run_it ${VARDIR}/firewall help | fgrep savesets ) supported=$(run_it $g_firewall help | fgrep savesets )
[ -n "$supported" ] && run_it ${VARDIR}/firewall savesets ${VARDIR}/ipsets.save && progress_message3 "The ipsets have been saved to ${VARDIR}/ipsets.save" [ -n "$supported" ] && run_it $g_firewall savesets ${VARDIR}/ipsets.save && progress_message3 "The ipsets have been saved to ${VARDIR}/ipsets.save"
} }
# #
@ -441,9 +441,9 @@ do_save() {
local arptables local arptables
status=0 status=0
if [ -f ${VARDIR}/firewall ]; then if [ -f $g_firewall ]; then
if $iptables_save | grep -v -- '-A dynamic.* -j ACCEPT' > ${VARDIR}/restore-$$; then if $iptables_save | grep -v -- '-A dynamic.* -j ACCEPT' > ${VARDIR}/restore-$$; then
cp -f ${VARDIR}/firewall $g_restorepath cp -f $g_firewall $g_restorepath
mv -f ${VARDIR}/restore-$$ ${g_restorepath}-iptables mv -f ${VARDIR}/restore-$$ ${g_restorepath}-iptables
chmod 700 $g_restorepath chmod 700 $g_restorepath
chmod 600 ${g_restorepath}-iptables chmod 600 ${g_restorepath}-iptables
@ -455,7 +455,7 @@ do_save() {
status=1 status=1
fi fi
else else
echo " ERROR: ${VARDIR}/firewall does not exist" >&2 echo " ERROR: $g_firewall does not exist" >&2
status=1 status=1
fi fi
@ -3947,7 +3947,7 @@ get_config() {
ensure_config_path ensure_config_path
[ -f ${VARDIR}/firewall.conf ] && . ${VARDIR}/firewall.conf [ -f $g_firewall.conf ] && . ${VARDIR}/firewall.conf
[ -n "$PATH" ] || PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin [ -n "$PATH" ] || PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
@ -4101,15 +4101,15 @@ start_command() {
rc=0 rc=0
[ -n "$g_nolock" ] || mutex_on [ -n "$g_nolock" ] || mutex_on
if [ -x ${VARDIR}/firewall ]; then if [ -x $g_firewall ]; then
if [ -n "$g_fast" -a -x ${VARDIR}/${RESTOREFILE} -a ! ${VARDIR}/firewall -nt ${VARDIR}/${RESTOREFILE} ]; then if [ -n "$g_fast" -a -x ${VARDIR}/${RESTOREFILE} -a ! $g_firewall -nt ${VARDIR}/${RESTOREFILE} ]; then
run_it ${VARDIR}/${RESTOREFILE} $g_debugging restore run_it ${VARDIR}/${RESTOREFILE} $g_debugging restore
else else
run_it ${VARDIR}/firewall $g_debugging start run_it $g_firewall $g_debugging start
fi fi
rc=$? rc=$?
else else
error_message "${VARDIR}/firewall is missing or is not executable" error_message "$g_firewall is missing or is not executable"
mylogger kern.err "ERROR:$g_product start failed" mylogger kern.err "ERROR:$g_product start failed"
rc=6 rc=6
fi fi
@ -4238,11 +4238,11 @@ restart_command() {
[ -n "$g_nolock" ] || mutex_on [ -n "$g_nolock" ] || mutex_on
if [ -x ${VARDIR}/firewall ]; then if [ -x $g_firewall ]; then
run_it ${VARDIR}/firewall $g_debugging $COMMAND run_it $g_firewall $g_debugging $COMMAND
rc=$? rc=$?
else else
error_message "${VARDIR}/firewall is missing or is not executable" error_message "$g_firewall is missing or is not executable"
mylogger kern.err "ERROR:$g_product $COMMAND failed" mylogger kern.err "ERROR:$g_product $COMMAND failed"
rc=6 rc=6
fi fi
@ -4252,10 +4252,10 @@ restart_command() {
} }
run_command() { run_command() {
if [ -x ${VARDIR}/firewall ] ; then if [ -x $g_firewall ] ; then
run_it ${VARDIR}/firewall $g_debugging $@ run_it $g_firewall $g_debugging $@
else else
fatal_error "${VARDIR}/firewall does not exist or is not executable" fatal_error "$g_firewall does not exist or is not executable"
fi fi
} }
@ -4640,7 +4640,7 @@ shorewall_cli() {
only_root only_root
get_config Yes get_config Yes
if product_is_started; then if product_is_started; then
run_it ${VARDIR}/firewall $g_debugging $@ run_it $g_firewall $g_debugging $@
else else
fatal_error "$g_product is not running" fatal_error "$g_product is not running"
fi fi

View File

@ -635,7 +635,7 @@ start_command() {
esac esac
if [ -n "${g_fast}${AUTOMAKE}" ]; then if [ -n "${g_fast}${AUTOMAKE}" ]; then
if ! uptodate ${VARDIR}/firewall; then if ! uptodate $g_firewall; then
g_fast= g_fast=
AUTOMAKE= AUTOMAKE=
fi fi
@ -643,7 +643,7 @@ start_command() {
if [ -n "$AUTOMAKE" ]; then if [ -n "$AUTOMAKE" ]; then
[ -n "$nolock" ] || mutex_on [ -n "$nolock" ] || mutex_on
run_it ${VARDIR}/firewall $g_debugging start run_it $g_firewall $g_debugging start
rc=$? rc=$?
[ -n "$nolock" ] || mutex_off [ -n "$nolock" ] || mutex_off
else else
@ -724,7 +724,7 @@ compile_command() {
case $# in case $# in
0) 0)
[ -n "$g_export" ] && g_file=firewall || g_file=${VARDIR}/firewall [ -n "$g_export" ] && g_file=firewall || g_file=$g_firewall
;; ;;
1) 1)
g_file=$1 g_file=$1
@ -1021,7 +1021,7 @@ restart_command() {
[ -n "$STARTUP_ENABLED" ] || not_configured_error "Startup is disabled" [ -n "$STARTUP_ENABLED" ] || not_configured_error "Startup is disabled"
if [ -z "$g_fast" -a -n "$AUTOMAKE" ]; then if [ -z "$g_fast" -a -n "$AUTOMAKE" ]; then
uptodate ${VARDIR}/firewall && g_fast=Yes uptodate $g_firewall && g_fast=Yes
fi fi
g_file="${VARDIR}/.${COMMAND}" g_file="${VARDIR}/.${COMMAND}"
@ -1037,9 +1037,9 @@ restart_command() {
mylogger kern.err "ERROR:$g_product ${COMMAND} failed" mylogger kern.err "ERROR:$g_product ${COMMAND} failed"
fi fi
else else
[ -x ${VARDIR}/firewall ] || fatal_error "No ${VARDIR}/firewall file found" [ -x $g_firewall ] || fatal_error "No $g_firewall file found"
[ -n "$nolock" ] || mutex_on [ -n "$nolock" ] || mutex_on
run_it ${VARDIR}/firewall $g_debugging $COMMAND run_it $g_firewall $g_debugging $COMMAND
rc=$? rc=$?
[ -n "$nolock" ] || mutex_off [ -n "$nolock" ] || mutex_off
fi fi
@ -1631,11 +1631,11 @@ export_command() # $* = original arguments less the command.
} }
run_command() { run_command() {
if [ -x ${VARDIR}/firewall ] ; then if [ -x $g_firewall ] ; then
uptodate ${VARDIR}/firewall || echo " WARNING: ${VARDIR}/firewall is not up to date" >&2 uptodate $g_firewall || echo " WARNING: $g_firewall is not up to date" >&2
run_it ${VARDIR}/firewall $g_debugging $@ run_it $g_firewall $g_debugging $@
else else
fatal_error "${VARDIR}/firewall does not exist or is not executable" fatal_error "$g_firewall does not exist or is not executable"
fi fi
} }