mirror of
https://gitlab.com/shorewall/code.git
synced 2024-12-25 23:59:01 +01:00
Rename setup_environment to setup_product_environment
- Default to first detected product - Verify that specified product is installed Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
bb5c3a50f5
commit
36517cdb1e
@ -26,7 +26,16 @@
|
||||
|
||||
SHOREWALL_LIBVERSION=40509
|
||||
|
||||
setup_environment() {
|
||||
#
|
||||
# Fatal Error
|
||||
#
|
||||
fatal_error() # $@ = Message
|
||||
{
|
||||
echo " ERROR: $@" >&2
|
||||
exit 2
|
||||
}
|
||||
|
||||
setup_product_environment() {
|
||||
g_basedir=${SHAREDIR}/shorewall
|
||||
|
||||
g_sharedir="$SHAREDIR"/$PRODUCT
|
||||
@ -60,11 +69,12 @@ setup_environment() {
|
||||
g_lite=Yes
|
||||
;;
|
||||
*)
|
||||
echo " ERROR: Unknown PRODUCT ($PRODUCT)" >&2
|
||||
exit 1
|
||||
fatal_error "Unknown PRODUCT ($PRODUCT)"
|
||||
;;
|
||||
esac
|
||||
|
||||
[ -f ${SHAREDIR}/${PRODUCT}/version ] || fatal_error "$g_product does not appear to be installed on this system"
|
||||
|
||||
if [ -z "${VARLIB}" ]; then
|
||||
VARLIB=${VARDIR}
|
||||
VARDIR=${VARLIB}/$g_program
|
||||
@ -74,7 +84,6 @@ setup_environment() {
|
||||
}
|
||||
|
||||
if [ -z "$PRODUCT" ]; then
|
||||
PRODUCT=shorewall
|
||||
#
|
||||
# This is modified by the installer when ${SHAREDIR} != /usr/share
|
||||
#
|
||||
@ -82,17 +91,18 @@ if [ -z "$PRODUCT" ]; then
|
||||
|
||||
g_basedir=${SHAREDIR}/shorewall
|
||||
|
||||
setup_environment
|
||||
fi
|
||||
if [ -f ${g_basedir}/version ]; then
|
||||
PRODUCT=shorewall
|
||||
elif [ -f ${SHAREDIR}/shorewall-lite/version ]; then
|
||||
PRODUCT=shorewall-lite
|
||||
elif [ -f ${SHAREDIR}/shorewall6-lite/version ]; then
|
||||
PRODUCT=shorewall6-lite
|
||||
else
|
||||
fatal_error "No Shorewall firewall product is installed"
|
||||
fi
|
||||
|
||||
#
|
||||
# Fatal Error
|
||||
#
|
||||
fatal_error() # $@ = Message
|
||||
{
|
||||
echo " ERROR: $@" >&2
|
||||
exit 2
|
||||
}
|
||||
setup_product_environment
|
||||
fi
|
||||
|
||||
#
|
||||
# Not configured Error
|
||||
|
@ -4495,7 +4495,7 @@ shorewall_cli() {
|
||||
usage 1
|
||||
fi
|
||||
|
||||
setup_environment
|
||||
setup_product_environment
|
||||
|
||||
[ -n "$g_lite" ] || . ${SHAREDIR}/shorewall/lib.cli-std
|
||||
|
||||
|
@ -56,7 +56,7 @@ g_basedir=${SHAREDIR}/shorewall
|
||||
|
||||
. ${SHAREDIR}/shorewall/lib.cli
|
||||
|
||||
setup_environment
|
||||
setup_product_environment
|
||||
|
||||
. ${SHAREDIR}/shorewall-lite/configpath
|
||||
|
||||
|
@ -42,7 +42,7 @@ g_basedir=${SHAREDIR}/shorewall
|
||||
|
||||
. $g_basedir/lib.cli
|
||||
|
||||
setup_environment
|
||||
setup_product_environment
|
||||
|
||||
CONFIG_PATH="$2"
|
||||
|
||||
|
@ -55,7 +55,7 @@ g_basedir=${SHAREDIR}/shorewall
|
||||
|
||||
. ${SHAREDIR}/shorewall/lib.cli
|
||||
|
||||
setup_environment
|
||||
setup_product_environment
|
||||
|
||||
. ${SHAREDIR}/shorewall-lite/configpath
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user