2009-03-02 04:25:16 +01:00
|
|
|
###############################################################################
|
|
|
|
# Code imported from /usr/share/shorewall/prog.footer
|
|
|
|
###############################################################################
|
2009-02-22 18:30:14 +01:00
|
|
|
#
|
|
|
|
# Give Usage Information
|
|
|
|
#
|
|
|
|
usage() {
|
2011-08-26 01:00:27 +02:00
|
|
|
echo "Usage: $0 [ options ] <command>"
|
2012-01-07 22:53:41 +01:00
|
|
|
echo
|
2011-08-26 01:00:27 +02:00
|
|
|
echo "<command> is one of:"
|
|
|
|
echo " start"
|
|
|
|
echo " stop"
|
|
|
|
echo " clear"
|
|
|
|
echo " disable <interface>"
|
|
|
|
echo " down <interface>"
|
|
|
|
echo " enable <interface>"
|
|
|
|
echo " reset"
|
2015-04-28 22:02:12 +02:00
|
|
|
echo " reenable <interface>"
|
2011-08-26 01:00:27 +02:00
|
|
|
echo " refresh"
|
2015-07-26 18:59:49 +02:00
|
|
|
echo " reload"
|
2011-08-26 01:00:27 +02:00
|
|
|
echo " restart"
|
2014-07-29 20:35:32 +02:00
|
|
|
echo " run <command> [ <parameter> ... ]"
|
2011-08-26 01:00:27 +02:00
|
|
|
echo " status"
|
|
|
|
echo " up <interface>"
|
2014-09-28 20:19:41 +02:00
|
|
|
echo " savesets <file>"
|
2015-05-21 18:00:11 +02:00
|
|
|
echo " call <function> [ <parameter> ... ]"
|
2011-08-26 01:00:27 +02:00
|
|
|
echo " version"
|
2010-06-07 18:16:56 +02:00
|
|
|
echo
|
2010-03-06 17:45:43 +01:00
|
|
|
echo "Options are:"
|
|
|
|
echo
|
|
|
|
echo " -v and -q Standard Shorewall verbosity controls"
|
2013-08-13 16:03:20 +02:00
|
|
|
echo " -n Don't update routing configuration"
|
2010-03-06 17:45:43 +01:00
|
|
|
echo " -p Purge Conntrack Table"
|
|
|
|
echo " -t Timestamp progress Messages"
|
2014-11-01 17:37:57 +01:00
|
|
|
echo " -c Save/restore iptables counters"
|
2010-03-06 17:45:43 +01:00
|
|
|
echo " -V <verbosity> Set verbosity explicitly"
|
|
|
|
echo " -R <file> Override RESTOREFILE setting"
|
2009-02-22 18:30:14 +01:00
|
|
|
exit $1
|
|
|
|
}
|
2012-01-07 22:53:41 +01:00
|
|
|
|
2015-07-26 18:59:49 +02:00
|
|
|
start_command() {
|
|
|
|
if product_is_started; then
|
|
|
|
error_message "$g_product is already Running"
|
|
|
|
status=0
|
|
|
|
else
|
|
|
|
progress_message3 "Starting $g_product...."
|
|
|
|
detect_configuration
|
|
|
|
define_firewall
|
|
|
|
status=$?
|
|
|
|
if [ $status -eq 0 ]; then
|
|
|
|
[ -n "$SUBSYSLOCK" ] && touch $SUBSYSLOCK
|
|
|
|
progress_message3 "done."
|
|
|
|
fi
|
2012-01-07 22:53:41 +01:00
|
|
|
fi
|
|
|
|
|
2015-07-26 18:59:49 +02:00
|
|
|
return $status
|
|
|
|
}
|
|
|
|
|
|
|
|
stop_command() {
|
|
|
|
progress_message3 "Stopping $g_product...."
|
|
|
|
detect_configuration
|
|
|
|
stop_firewall
|
|
|
|
[ -n "$SUBSYSLOCK" ] && rm -f $SUBSYSLOCK
|
|
|
|
progress_message3 "done."
|
2012-01-07 22:53:41 +01:00
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
2015-07-27 18:19:52 +02:00
|
|
|
reload_command() {
|
|
|
|
if product_is_started; then
|
|
|
|
progress_message3 "Reloading $g_product...."
|
|
|
|
else
|
|
|
|
error_message "$g_product is not running"
|
|
|
|
progress_message3 "Starting $g_product...."
|
|
|
|
COMMAND=start
|
|
|
|
fi
|
|
|
|
|
|
|
|
detect_configuration
|
|
|
|
define_firewall
|
|
|
|
status=$?
|
|
|
|
if [ -n "$SUBSYSLOCK" ]; then
|
|
|
|
[ $status -eq 0 ] && touch $SUBSYSLOCK || rm -f $SUBSYSLOCK
|
|
|
|
fi
|
|
|
|
|
|
|
|
[ $status -eq 0 ] && progress_message3 "done."
|
|
|
|
}
|
|
|
|
|
2009-02-22 18:30:14 +01:00
|
|
|
################################################################################
|
|
|
|
# E X E C U T I O N B E G I N S H E R E #
|
|
|
|
################################################################################
|
|
|
|
#
|
|
|
|
# Start trace if first arg is "debug" or "trace"
|
|
|
|
#
|
2012-03-06 00:21:10 +01:00
|
|
|
g_debug_iptables=
|
|
|
|
|
2009-08-20 23:32:15 +02:00
|
|
|
if [ $# -gt 1 ]; then
|
2009-02-22 18:30:14 +01:00
|
|
|
if [ "x$1" = "xtrace" ]; then
|
|
|
|
set -x
|
|
|
|
shift
|
|
|
|
elif [ "x$1" = "xdebug" ]; then
|
2012-03-06 00:21:10 +01:00
|
|
|
g_debug_iptables=Yes
|
2009-02-22 18:30:14 +01:00
|
|
|
shift
|
|
|
|
fi
|
|
|
|
fi
|
2010-03-01 17:32:59 +01:00
|
|
|
#
|
2012-01-07 22:53:41 +01:00
|
|
|
# Map VERBOSE to VERBOSITY for compatibility with old Shorewall[6]-lite installations
|
2010-03-01 17:32:59 +01:00
|
|
|
#
|
2010-03-01 15:57:04 +01:00
|
|
|
[ -z "$VERBOSITY" ] && [ -n "$VERBOSE" ] && VERBOSITY=$VERBOSE
|
2010-03-03 18:50:07 +01:00
|
|
|
#
|
|
|
|
# Map other old exported variables
|
|
|
|
#
|
|
|
|
g_purge=$PURGE
|
|
|
|
g_noroutes=$NOROUTES
|
|
|
|
g_timestamp=$TIMESTAMP
|
|
|
|
g_recovering=$RECOVERING
|
2014-10-31 19:36:53 +01:00
|
|
|
#
|
|
|
|
# These two variables contain the high-order and low-order parts respectively of
|
|
|
|
# an SHA1 digest of this file. The digest is generated before the two following
|
|
|
|
# lines are updated to contain the value of that digest.
|
|
|
|
#
|
|
|
|
g_sha1sum1=
|
|
|
|
g_sha1sum2=
|
2014-11-01 17:37:57 +01:00
|
|
|
#
|
|
|
|
# Other Globals
|
|
|
|
#
|
|
|
|
g_counters=
|
2015-06-26 23:32:43 +02:00
|
|
|
g_compiled=
|
|
|
|
g_file=
|
2016-02-21 18:54:37 +01:00
|
|
|
g_docker=
|
2010-03-01 02:58:01 +01:00
|
|
|
|
2009-02-22 18:30:14 +01:00
|
|
|
initialize
|
|
|
|
|
2009-06-05 22:49:23 +02:00
|
|
|
if [ -n "$STARTUP_LOG" ]; then
|
2009-11-03 18:34:21 +01:00
|
|
|
touch $STARTUP_LOG
|
|
|
|
chmod 0600 $STARTUP_LOG
|
2009-06-07 17:07:56 +02:00
|
|
|
if [ ${SHOREWALL_INIT_SCRIPT:-0} -eq 1 ]; then
|
2009-06-05 22:49:23 +02:00
|
|
|
#
|
|
|
|
# We're being run by a startup script that isn't redirecting STDOUT
|
|
|
|
# Redirect it to the log
|
|
|
|
#
|
2009-06-07 17:07:56 +02:00
|
|
|
exec 2>>$STARTUP_LOG
|
2009-06-05 22:49:23 +02:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2009-02-22 18:30:14 +01:00
|
|
|
finished=0
|
|
|
|
|
|
|
|
while [ $finished -eq 0 -a $# -gt 0 ]; do
|
|
|
|
option=$1
|
|
|
|
case $option in
|
|
|
|
-*)
|
|
|
|
option=${option#-}
|
|
|
|
|
|
|
|
[ -z "$option" ] && usage 1
|
|
|
|
|
|
|
|
while [ -n "$option" ]; do
|
|
|
|
case $option in
|
|
|
|
v*)
|
2010-03-22 23:41:32 +01:00
|
|
|
[ $VERBOSITY -lt 2 ] && VERBOSITY=$(($VERBOSITY + 1 ))
|
2009-02-22 18:30:14 +01:00
|
|
|
option=${option#v}
|
|
|
|
;;
|
|
|
|
q*)
|
2010-03-22 23:41:32 +01:00
|
|
|
[ $VERBOSITY -gt -1 ] && VERBOSITY=$(($VERBOSITY - 1 ))
|
2009-02-22 18:30:14 +01:00
|
|
|
option=${option#q}
|
|
|
|
;;
|
|
|
|
n*)
|
2010-03-03 18:50:07 +01:00
|
|
|
g_noroutes=Yes
|
2009-02-22 18:30:14 +01:00
|
|
|
option=${option#n}
|
|
|
|
;;
|
2010-03-01 00:25:25 +01:00
|
|
|
t*)
|
2010-03-03 18:50:07 +01:00
|
|
|
g_timestamp=Yes
|
2010-03-01 00:25:25 +01:00
|
|
|
option=${option#t}
|
2010-06-07 18:16:56 +02:00
|
|
|
;;
|
2010-03-02 23:49:31 +01:00
|
|
|
p*)
|
2010-03-06 17:12:04 +01:00
|
|
|
g_purge=Yes
|
2010-03-02 23:49:31 +01:00
|
|
|
option=${option#p}
|
|
|
|
;;
|
2010-03-01 00:25:25 +01:00
|
|
|
r*)
|
2010-03-03 18:50:07 +01:00
|
|
|
g_recovering=Yes
|
2010-03-01 00:25:25 +01:00
|
|
|
option=${option#r}
|
|
|
|
;;
|
2014-11-01 17:37:57 +01:00
|
|
|
c*)
|
|
|
|
g_counters=Yes
|
|
|
|
option=${option#c}
|
|
|
|
;;
|
2010-03-01 00:25:25 +01:00
|
|
|
V*)
|
|
|
|
option=${option#V}
|
2010-03-01 01:42:50 +01:00
|
|
|
|
|
|
|
if [ -z "$option" -a $# -gt 0 ]; then
|
|
|
|
shift
|
|
|
|
option=$1
|
|
|
|
fi
|
|
|
|
|
2010-03-01 00:25:25 +01:00
|
|
|
if [ -n "$option" ]; then
|
|
|
|
case $option in
|
|
|
|
-1|0|1|2)
|
2010-03-01 02:58:01 +01:00
|
|
|
VERBOSITY=$option
|
2010-03-01 00:25:25 +01:00
|
|
|
option=
|
|
|
|
;;
|
|
|
|
*)
|
2010-03-01 01:42:50 +01:00
|
|
|
startup_error "Invalid -V option value ($option)"
|
2010-03-01 00:25:25 +01:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
else
|
2010-03-01 01:42:50 +01:00
|
|
|
startup_error "Missing -V option value"
|
2010-03-01 00:25:25 +01:00
|
|
|
fi
|
|
|
|
;;
|
2010-03-02 23:49:31 +01:00
|
|
|
R*)
|
|
|
|
option=${option#R}
|
|
|
|
|
|
|
|
if [ -z "$option" -a $# -gt 0 ]; then
|
|
|
|
shift
|
|
|
|
option=$1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -n "$option" ]; then
|
|
|
|
case $option in
|
2010-06-07 18:16:56 +02:00
|
|
|
*/*)
|
2010-03-02 23:49:31 +01:00
|
|
|
startup_error "-R must specify a simple file name: $option"
|
|
|
|
;;
|
|
|
|
.safe|.try|NONE)
|
|
|
|
;;
|
|
|
|
.*)
|
|
|
|
error_message "ERROR: Reserved File Name: $RESTOREFILE"
|
|
|
|
exit 2
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
else
|
|
|
|
startup_error "Missing -R option value"
|
|
|
|
fi
|
|
|
|
|
|
|
|
RESTOREFILE=$option
|
|
|
|
option=
|
|
|
|
;;
|
2009-02-22 18:30:14 +01:00
|
|
|
*)
|
|
|
|
usage 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
finished=1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
COMMAND="$1"
|
|
|
|
|
|
|
|
case "$COMMAND" in
|
|
|
|
start)
|
|
|
|
[ $# -ne 1 ] && usage 2
|
2015-07-26 18:59:49 +02:00
|
|
|
start_command
|
2009-02-22 18:30:14 +01:00
|
|
|
;;
|
|
|
|
stop)
|
|
|
|
[ $# -ne 1 ] && usage 2
|
2015-07-26 18:59:49 +02:00
|
|
|
stop_command
|
2009-02-22 18:30:14 +01:00
|
|
|
;;
|
|
|
|
reset)
|
2012-01-07 22:53:41 +01:00
|
|
|
if ! product_is_started ; then
|
2010-03-02 21:34:36 +01:00
|
|
|
error_message "$g_product is not running"
|
2009-02-22 18:30:14 +01:00
|
|
|
status=2
|
2015-07-26 18:59:49 +02:00
|
|
|
elif [ $# -eq 1 ]; then
|
|
|
|
$g_tool -Z
|
|
|
|
$g_tool -t mangle -Z
|
|
|
|
date > ${VARDIR}/restarted
|
|
|
|
status=0
|
|
|
|
progress_message3 "$g_product Counters Reset"
|
|
|
|
else
|
|
|
|
shift
|
|
|
|
status=0
|
2015-09-11 23:16:16 +02:00
|
|
|
table=filter
|
2015-07-26 18:59:49 +02:00
|
|
|
for chain in $@; do
|
2015-09-11 23:16:16 +02:00
|
|
|
case $chain in
|
|
|
|
*:*)
|
|
|
|
table=${chain%:*}
|
|
|
|
chain=${chain#*:}
|
|
|
|
case $table in
|
|
|
|
raw|nat|mangle|filter)
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
error_message "ERROR: Invalid table name ($table)"
|
|
|
|
status=2
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
if [ $status -eq 0 ]; then
|
|
|
|
if chain_exists $chain $table; then
|
|
|
|
if qt $g_tool -t $table -Z $chain; then
|
|
|
|
progress_message3 "Completed counter reset of $table chain $chain"
|
|
|
|
else
|
|
|
|
error_message "ERROR: Reset of $table chain $chain failed"
|
|
|
|
status=2
|
|
|
|
break
|
|
|
|
fi
|
2009-02-22 18:30:14 +01:00
|
|
|
else
|
2015-09-11 23:16:16 +02:00
|
|
|
error_message "WARNING: $table chain $chain does not exist"
|
2009-02-22 18:30:14 +01:00
|
|
|
fi
|
2015-07-26 18:59:49 +02:00
|
|
|
else
|
2015-09-11 23:16:16 +02:00
|
|
|
break;
|
2015-07-26 18:59:49 +02:00
|
|
|
fi
|
|
|
|
done
|
2009-02-22 18:30:14 +01:00
|
|
|
fi
|
|
|
|
;;
|
2015-07-26 18:59:49 +02:00
|
|
|
reload)
|
2009-02-22 18:30:14 +01:00
|
|
|
[ $# -ne 1 ] && usage 2
|
2015-07-27 18:19:52 +02:00
|
|
|
reload_command
|
2015-07-26 18:59:49 +02:00
|
|
|
;;
|
|
|
|
restart)
|
|
|
|
[ $# -ne 1 ] && usage 2
|
2015-07-27 18:19:52 +02:00
|
|
|
|
2015-10-12 20:45:58 +02:00
|
|
|
if [ "$RESTART" = restart ]; then
|
2015-07-27 18:19:52 +02:00
|
|
|
COMMAND=stop stop_command && COMMAND=start start_command
|
|
|
|
else
|
|
|
|
COMMAND=reload
|
|
|
|
reload_command
|
|
|
|
fi
|
2009-02-22 18:30:14 +01:00
|
|
|
;;
|
|
|
|
refresh)
|
|
|
|
[ $# -ne 1 ] && usage 2
|
2012-01-07 22:53:41 +01:00
|
|
|
if product_is_started; then
|
2010-03-02 21:34:36 +01:00
|
|
|
progress_message3 "Refreshing $g_product...."
|
2015-07-26 18:59:49 +02:00
|
|
|
detect_configuration
|
|
|
|
define_firewall
|
|
|
|
status=$?
|
|
|
|
[ $status -eq 0 ] && progress_message3 "done."
|
2009-02-22 18:30:14 +01:00
|
|
|
else
|
2010-03-02 21:34:36 +01:00
|
|
|
echo "$g_product is not running" >&2
|
2009-02-22 18:30:14 +01:00
|
|
|
status=2
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
restore)
|
|
|
|
[ $# -ne 1 ] && usage 2
|
2015-07-26 18:59:49 +02:00
|
|
|
detect_configuration
|
|
|
|
define_firewall
|
|
|
|
status=$?
|
|
|
|
if [ -n "$SUBSYSLOCK" ]; then
|
|
|
|
[ $status -eq 0 ] && touch $SUBSYSLOCK || rm -f $SUBSYSLOCK
|
|
|
|
fi
|
|
|
|
[ $status -eq 0 ] && progress_message3 "done."
|
2009-02-22 18:30:14 +01:00
|
|
|
;;
|
|
|
|
clear)
|
|
|
|
[ $# -ne 1 ] && usage 2
|
2010-03-02 21:34:36 +01:00
|
|
|
progress_message3 "Clearing $g_product...."
|
2015-07-26 18:59:49 +02:00
|
|
|
clear_firewall
|
|
|
|
status=0
|
|
|
|
if [ -n "$SUBSYSLOCK" ]; then
|
|
|
|
rm -f $SUBSYSLOCK
|
2010-05-11 02:13:32 +02:00
|
|
|
fi
|
2015-07-26 18:59:49 +02:00
|
|
|
progress_message3 "done."
|
2009-02-22 18:30:14 +01:00
|
|
|
;;
|
|
|
|
status)
|
|
|
|
[ $# -ne 1 ] && usage 2
|
2013-08-13 15:52:46 +02:00
|
|
|
[ $VERBOSITY -ge 1 ] && echo "$g_product-$SHOREWALL_VERSION Status at $(hostname) - $(date)" && echo
|
2012-01-07 22:53:41 +01:00
|
|
|
if product_is_started; then
|
2013-08-13 15:52:46 +02:00
|
|
|
[ $VERBOSITY -ge 1 ] && echo "$g_product is running"
|
2009-02-22 18:30:14 +01:00
|
|
|
status=0
|
|
|
|
else
|
2013-08-13 15:52:46 +02:00
|
|
|
[ $VERBOSITY -ge 1 ] && echo "$g_product is stopped"
|
2009-02-22 18:30:14 +01:00
|
|
|
status=4
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -f ${VARDIR}/state ]; then
|
|
|
|
state="$(cat ${VARDIR}/state)"
|
|
|
|
case $state in
|
2012-01-07 22:53:41 +01:00
|
|
|
Stopped*|Clear*)
|
2009-02-22 18:30:14 +01:00
|
|
|
status=3
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
else
|
|
|
|
state=Unknown
|
|
|
|
fi
|
2013-08-13 15:52:46 +02:00
|
|
|
[ $VERBOSITY -ge 1 ] && echo "State:$state" && echo
|
2009-02-22 18:30:14 +01:00
|
|
|
;;
|
2010-05-15 21:48:04 +02:00
|
|
|
up|down)
|
|
|
|
[ $# -eq 1 ] && exit 0
|
|
|
|
shift
|
|
|
|
[ $# -ne 1 ] && usage 2
|
2012-06-01 20:47:58 +02:00
|
|
|
mutex_on
|
|
|
|
( updown $1 )
|
|
|
|
mutex_off
|
2012-01-07 22:53:41 +01:00
|
|
|
status=0
|
2010-05-15 21:48:04 +02:00
|
|
|
;;
|
2011-08-26 01:00:27 +02:00
|
|
|
enable)
|
|
|
|
[ $# -eq 1 ] && exit 0
|
|
|
|
shift
|
|
|
|
[ $# -ne 1 ] && usage 2
|
2015-01-22 17:30:05 +01:00
|
|
|
mutex_on
|
2012-01-07 22:53:41 +01:00
|
|
|
if product_is_started; then
|
2015-04-26 00:46:19 +02:00
|
|
|
detect_configuration $1
|
2015-05-29 21:15:55 +02:00
|
|
|
enable_provider $1 Yes
|
2011-08-26 01:00:27 +02:00
|
|
|
fi
|
2015-01-22 17:30:05 +01:00
|
|
|
mutex_off
|
2011-08-26 01:00:27 +02:00
|
|
|
status=0
|
|
|
|
;;
|
|
|
|
disable)
|
|
|
|
[ $# -eq 1 ] && exit 0
|
|
|
|
shift
|
|
|
|
[ $# -ne 1 ] && usage 2
|
2015-01-22 17:30:05 +01:00
|
|
|
mutex_on
|
2012-01-07 22:53:41 +01:00
|
|
|
if product_is_started; then
|
2015-04-26 00:46:19 +02:00
|
|
|
detect_configuration $1
|
2015-05-29 21:15:55 +02:00
|
|
|
disable_provider $1 Yes
|
2011-08-26 01:00:27 +02:00
|
|
|
fi
|
2015-01-22 17:30:05 +01:00
|
|
|
mutex_off
|
2011-08-26 01:00:27 +02:00
|
|
|
status=0
|
|
|
|
;;
|
2015-04-28 22:02:12 +02:00
|
|
|
reenable)
|
|
|
|
[ $# -eq 1 ] && exit 0
|
|
|
|
shift
|
|
|
|
[ $# -ne 1 ] && usage 2
|
|
|
|
mutex_on
|
|
|
|
if product_is_started; then
|
|
|
|
detect_configuration $1
|
|
|
|
COMMAND=enable disable_provider $1 Yes
|
|
|
|
COMMAND=disable enable_provider $1 Yes
|
|
|
|
fi
|
|
|
|
mutex_off
|
|
|
|
status=0
|
|
|
|
;;
|
2014-07-28 16:04:56 +02:00
|
|
|
run)
|
2014-07-29 20:35:32 +02:00
|
|
|
if [ $# -gt 1 ]; then
|
|
|
|
shift
|
|
|
|
detect_configuration
|
2014-07-30 19:25:00 +02:00
|
|
|
run_init_exit
|
2014-07-29 20:35:32 +02:00
|
|
|
eval $@
|
|
|
|
status=$?
|
|
|
|
else
|
|
|
|
error_message "ERROR: Missing command"
|
|
|
|
fi
|
2014-07-28 16:04:56 +02:00
|
|
|
;;
|
2014-09-28 20:19:41 +02:00
|
|
|
savesets)
|
|
|
|
if [ $# -eq 2 ]; then
|
|
|
|
save_ipsets $2
|
2015-03-17 18:03:12 +01:00
|
|
|
status=$?
|
2014-09-28 20:19:41 +02:00
|
|
|
else
|
|
|
|
usage 2
|
|
|
|
fi
|
|
|
|
;;
|
2015-05-21 18:00:11 +02:00
|
|
|
call)
|
|
|
|
#
|
2015-05-21 19:38:35 +02:00
|
|
|
# Way to call functions in the generated script directly
|
2015-05-21 18:00:11 +02:00
|
|
|
#
|
|
|
|
detect_configuration
|
2015-05-21 19:38:35 +02:00
|
|
|
|
2015-05-21 18:00:11 +02:00
|
|
|
shift
|
2015-05-21 19:38:35 +02:00
|
|
|
|
|
|
|
if [ $# -gt 0 ]; then
|
|
|
|
#
|
|
|
|
# See what it is
|
|
|
|
#
|
|
|
|
if type $1 2> /dev/null | fgrep -q 'is a function'; then
|
|
|
|
#
|
|
|
|
# It's a shell function -- call it
|
|
|
|
#
|
|
|
|
$@
|
|
|
|
else
|
|
|
|
fatal_error "$1 is not a known shell function"
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
usage 1
|
|
|
|
fi
|
2015-05-21 18:00:11 +02:00
|
|
|
;;
|
2009-02-22 18:30:14 +01:00
|
|
|
version)
|
|
|
|
[ $# -ne 1 ] && usage 2
|
2010-03-02 17:02:10 +01:00
|
|
|
echo $SHOREWALL_VERSION
|
2009-02-22 18:30:14 +01:00
|
|
|
status=0
|
|
|
|
;;
|
|
|
|
help)
|
|
|
|
[ $# -ne 1 ] && usage 2
|
|
|
|
usage 0
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
usage 2
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit $status
|