#!/bin/sh
#
#     Shorewall Packet Filtering Firewall Control Program - V4.4
#
#     This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
#
#     (c) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011 - 
#         Tom Eastep (teastep@shorewall.net)
#
#	Shorewall documentation is available at http://www.shorewall.net
#
#	This program is free software; you can redistribute it and/or modify
#	it under the terms of Version 2 of the GNU General Public License
#	as published by the Free Software Foundation.
#
#	This program is distributed in the hope that it will be useful,
#	but WITHOUT ANY WARRANTY; without even the implied warranty of
#	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#	GNU General Public License for more details.
#
#	You should have received a copy of the GNU General Public License
#	along with this program; if not, write to the Free Software
#	Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
#       For a list of supported commands, type 'shorewall help' or 'shorewall6 help'
#
################################################################################################
g_debugging=

if [ $# -gt 0 ] && [ "x$1" = "xdebug" -o "x$1" = "xtrace" ]; then
    g_debugging=$1
    shift
fi

g_nolock=

if [ $# -gt 0 ] && [ "$1" = "nolock" ]; then
    g_nolock=nolock
    shift
fi

g_noroutes=
g_purge=
g_ipt_options="-nv"
g_fast=
g_verbose_offset=0
g_use_verbosity=
g_debug=
g_export=
g_refreshchains=:none:
g_confess=
g_update=
g_convert=
g_annotate=
g_recovering=
g_timestamp=
g_libexec=/usr/share
g_perllib=/usr/share/shorewall
g_shorewalldir=

VERBOSE=
VERBOSITY=

g_program=$(basename $0)

if [ $g_program = shorewall6 ]; then
    SHAREDIR=/usr/share/shorewall6
    CONFDIR=/etc/shorewall6
    g_product="Shorewall6"
    g_family=6
    g_tool=
    g_basedir=/usr/share/shorewall
    g_lite=
elif [ $g_program = shorewall6-lite ]; then
    SHAREDIR=/usr/share/shorewall6-lite
    CONFDIR=/etc/shorewall6-lite
    g_product="Shorewall6 Lite"
    g_family=6
    g_base=shorewall6
    g_tool=ip6tables
    g_basedir=/usr/share/shorewall6-lite
    g_lite=Yes
elif [ $g_program = shorewall-lite ]; then
    SHAREDIR=/usr/share/shorewall-lite
    CONFDIR=/etc/shorewall-lite
    g_product="Shorewall Lite"
    g_family=4
    g_base=shorewall
    g_tool=iptables
    g_basedir=/usr/share/shorewall-lite
    g_lite=Yes
else
    g_program=shorewall
    SHAREDIR=/usr/share/shorewall
    CONFDIR=/etc/shorewall
    g_product="Shorewall"
    g_family=4
    g_tool=
    g_basedir=/usr/share/shorewall
    g_lite=
fi

if [ -z "$g_lite" ]; then
    for library in base cli cli-std; do
	. /usr/share/shorewall/lib.$library
    done
else
    for library in base cli; do
	. ${SHAREDIR}/lib.$library
    done
fi

shorewall_cli $@
