From a7b18ca8754b244c1a57d6236835a8dd25d50050 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Mon, 28 Jul 2014 07:04:56 -0700 Subject: [PATCH] Implement 'run' command Signed-off-by: Tom Eastep --- Shorewall-core/lib.cli | 9 +++++++ Shorewall-lite/manpages/shorewall-lite.xml | 28 ++++++++++++++++++++ Shorewall/Perl/prog.footer | 5 ++++ Shorewall/lib.cli-std | 1 + Shorewall/manpages/shorewall.xml | 28 ++++++++++++++++++++ Shorewall6-lite/manpages/shorewall6-lite.xml | 28 ++++++++++++++++++++ Shorewall6/manpages/shorewall6.xml | 28 ++++++++++++++++++++ 7 files changed, 127 insertions(+) diff --git a/Shorewall-core/lib.cli b/Shorewall-core/lib.cli index 9cb05f8c2..fec65bcbe 100644 --- a/Shorewall-core/lib.cli +++ b/Shorewall-core/lib.cli @@ -3574,6 +3574,7 @@ usage() # $1 = exit status echo " start [ -f ] [ -p ] [ ]" echo " stop" echo " status [ -i ]" + echo " run [ function ... ]" echo " version [ -a ]" echo exit $1 @@ -3818,6 +3819,14 @@ shorewall_cli() { fatal_error "$g_product is not running" fi ;; + run) + get_config Yes + if [ -x ${VARDIR}/firewall ] ; then + run_it ${VARDIR}/firewall $g_debugging $@ + else + fatal_error "${VARDIR}/firewall does not exist or is not executable" + fi + ;; show|list|ls) get_config Yes No Yes shift diff --git a/Shorewall-lite/manpages/shorewall-lite.xml b/Shorewall-lite/manpages/shorewall-lite.xml index 78f26966d..eabc11694 100644 --- a/Shorewall-lite/manpages/shorewall-lite.xml +++ b/Shorewall-lite/manpages/shorewall-lite.xml @@ -317,6 +317,21 @@ filename + + shorewall-lite + + | + + -options + + + + function + + parameter ... + + shorewall-lite @@ -807,6 +822,19 @@ + + run + + + Added in Shorewall 4.6.3. Calls the named + function passing the supplied + parameters. The + function will normally be declared in + lib.private and is executed in the context of + the generated firewall script. + + + save diff --git a/Shorewall/Perl/prog.footer b/Shorewall/Perl/prog.footer index acdc06cda..8f64f1879 100644 --- a/Shorewall/Perl/prog.footer +++ b/Shorewall/Perl/prog.footer @@ -17,6 +17,7 @@ usage() { echo " reset" echo " refresh" echo " restart" + echo " run [ ... ]" echo " status" echo " up " echo " version" @@ -371,6 +372,10 @@ case "$COMMAND" in fi status=0 ;; + run) + shift + eval $@ + ;; version) [ $# -ne 1 ] && usage 2 echo $SHOREWALL_VERSION diff --git a/Shorewall/lib.cli-std b/Shorewall/lib.cli-std index d9a05a198..c1adefc07 100644 --- a/Shorewall/lib.cli-std +++ b/Shorewall/lib.cli-std @@ -1666,6 +1666,7 @@ usage() # $1 = exit status echo " reset [ ... ]" echo " restart [ -n ] [ -p ] [-d] [ -f ] [ -c ] [ -T ] [ -i ] [ ]" echo " restore [ -n ] [ ]" + echo " run [ ... ]" echo " safe-restart [ -t ] [ ]" echo " safe-start [ -t ] [ ]" echo " save [ ]" diff --git a/Shorewall/manpages/shorewall.xml b/Shorewall/manpages/shorewall.xml index 9b487741f..d16d726b5 100644 --- a/Shorewall/manpages/shorewall.xml +++ b/Shorewall/manpages/shorewall.xml @@ -457,6 +457,21 @@ filename + + shorewall + + | + + -options + + + + function + + parameter ... + + shorewall @@ -1409,6 +1424,19 @@ + + run + + + Added in Shorewall 4.6.3. Calls the named + function passing the supplied + parameters. The + function will normally be declared in + lib.private and is executed in the context of + the generated firewall script. + + + safe-restart diff --git a/Shorewall6-lite/manpages/shorewall6-lite.xml b/Shorewall6-lite/manpages/shorewall6-lite.xml index 1ee77742f..24f8708d6 100644 --- a/Shorewall6-lite/manpages/shorewall6-lite.xml +++ b/Shorewall6-lite/manpages/shorewall6-lite.xml @@ -317,6 +317,21 @@ filename + + shorewall6-lite + + | + + -options + + + + function + + parameter ... + + shorewall6-lite @@ -805,6 +820,19 @@ + + run + + + Added in Shorewall 4.6.3. Calls the named + function passing the supplied + parameters. The + function will normally be declared in + lib.private and is executed in the context of + the generated firewall script. + + + save diff --git a/Shorewall6/manpages/shorewall6.xml b/Shorewall6/manpages/shorewall6.xml index 17cad77b4..f5394a2be 100644 --- a/Shorewall6/manpages/shorewall6.xml +++ b/Shorewall6/manpages/shorewall6.xml @@ -406,6 +406,21 @@ filename + + shorewall6 + + | + + -options + + + + function + + parameter ... + + shorewall6 @@ -1290,6 +1305,19 @@ + + run + + + Added in Shorewall 4.6.3. Calls the named + function passing the supplied + parameters. The + function will normally be declared in + lib.private and is executed in the context of + the generated firewall script. + + + safe-restart