Yet more shorewall/shorewall6 unification

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2011-05-23 16:41:51 -07:00
parent 471d405f7d
commit 016f7d9f2a
2 changed files with 29 additions and 12 deletions

View File

@ -337,6 +337,7 @@ uptodate() {
# Run the compiler # Run the compiler
# #
compiler() { compiler() {
local pc
pc=$g_libexec/shorewall/compiler.pl pc=$g_libexec/shorewall/compiler.pl
if [ $(id -u) -ne 0 ]; then if [ $(id -u) -ne 0 ]; then
@ -870,6 +871,7 @@ refresh_command() {
safe_commands() { safe_commands() {
local finished local finished
finished=0 finished=0
local command
# test is the shell supports timed read # test is the shell supports timed read
read -t 0 junk 2> /dev/null read -t 0 junk 2> /dev/null
@ -972,7 +974,7 @@ safe_commands() {
[ -n "$nolock" ] || mutex_on [ -n "$nolock" ] || mutex_on
if ${VARDIR}/.$command $g_debugging $command; then if run_it ${VARDIR}/.$command $g_debugging $command; then
echo -n "Do you want to accept the new firewall configuration? [y/n] " echo -n "Do you want to accept the new firewall configuration? [y/n] "
@ -980,9 +982,9 @@ safe_commands() {
echo "New configuration has been accepted" echo "New configuration has been accepted"
else else
if [ "$command" = "restart" ]; then if [ "$command" = "restart" ]; then
${VARDIR}/.safe restore run_it ${VARDIR}/.safe restore
else else
${VARDIR}/.$command clear run_it ${VARDIR}/.$command clear
fi fi
[ -n "$nolock" ] || mutex_off [ -n "$nolock" ] || mutex_off
@ -1108,13 +1110,13 @@ try_command() {
[ -n "$nolock" ] || mutex_on [ -n "$nolock" ] || mutex_on
if ${VARDIR}/.$command $command && [ -n "$timeout" ]; then if run_it ${VARDIR}/.$command $command && [ -n "$timeout" ]; then
sleep $timeout sleep $timeout
if [ "$command" = "restart" ]; then if [ "$command" = "restart" ]; then
${VARDIR}/.try restore run_it ${VARDIR}/.try restore
else else
${VARDIR}/.$command clear run_it ${VARDIR}/.$command clear
fi fi
fi fi
@ -1669,9 +1671,9 @@ case "$COMMAND" in
start_command $@ start_command $@
;; ;;
stop|clear) stop|clear)
get_config
[ $# -ne 1 ] && usage 1 [ $# -ne 1 ] && usage 1
[ -x $g_firewall ] || fatal_error "Shorewall has never been started" get_config
[ -x $g_firewall ] || fatal_error "Shorewall6 has never been started"
[ -n "$nolock" ] || mutex_on [ -n "$nolock" ] || mutex_on
run_it $g_firewall $g_debugging $COMMAND run_it $g_firewall $g_debugging $COMMAND
[ -n "$nolock" ] || mutex_off [ -n "$nolock" ] || mutex_off

View File

@ -1261,7 +1261,7 @@ reload_command() # $* = original arguments less the command.
[ -n "$g_timestamp" ] && timestamp='-t' || timestamp= [ -n "$g_timestamp" ] && timestamp='-t' || timestamp=
if shorewall6 $g_debugging $verbose $timestamp compile -e $compiler $directory $directory/firewall && \ if shorewall6 $g_debugging $verbose $timestamp compile -e $directory $directory/firewall && \
progress_message3 "Copying $file and ${file}.conf to ${system}:${litedir}..." && \ progress_message3 "Copying $file and ${file}.conf to ${system}:${litedir}..." && \
rcp_command "$directory/firewall $directory/firewall.conf" ${litedir} rcp_command "$directory/firewall $directory/firewall.conf" ${litedir}
then then
@ -1348,7 +1348,7 @@ export_command() # $* = original arguments less the command.
file=$(resolve_file $directory/firewall) file=$(resolve_file $directory/firewall)
if shorewall6 $g_debugging $verbose compile -e $compiler $directory $directory/firewall && \ if shorewall6 $g_debugging $verbose compile -e $directory $directory/firewall && \
echo "Copying $file and ${file}.conf to ${target#*@}..." && \ echo "Copying $file and ${file}.conf to ${target#*@}..." && \
scp $directory/firewall $directory/firewall.conf $target scp $directory/firewall $directory/firewall.conf $target
then then
@ -1391,8 +1391,23 @@ usage() # $1 = exit status
echo " restart [ -n ] [ -p ] [-d] [ -f ] [ -c ][ <directory> ]" echo " restart [ -n ] [ -p ] [-d] [ -f ] [ -c ][ <directory> ]"
echo " restore [ -n ] [ <file name> ]" echo " restore [ -n ] [ <file name> ]"
echo " save [ <file name> ]" echo " save [ <file name> ]"
echo " show [ -x ] [ -m ] [-f] [ -t {filter|mangle} ] [ {chain [<chain> [ <chain> ... ]|actions|capabilities|classifiers|config|connections|filters|ip|log [<regex>]|macros|mangle|nat|policies|raw|routing|tc|vardir|zones} ]" echo " show [ -x ] [ -t {filter|mangle|nat} ] [ {chain [<chain> [ <chain> ... ]"
echo " start [ -f ] [ -n ] [ <directory> ]" echo " show actions"
echo " show [ -f ] capabilities"
echo " show classifiers"
echo " show config"
echo " show connections"
echo " show filters"
echo " show ip"
echo " show [ -m ] log [<regex>]"
echo " show macro <macro>"
echo " show macros"
echo " show [ -x ] mangle|raw|routing"
echo " show policies"
echo " show tc [ device ]"
echo " show vardir"
echo " show zones"
echo " start [ -f ] [ -n ] [ -p ] [ <directory> ]"
echo " stop" echo " stop"
echo " status" echo " status"
echo " try <directory> [ <timeout> ]" echo " try <directory> [ <timeout> ]"