mirror of
https://gitlab.com/shorewall/code.git
synced 2024-11-07 16:24:01 +01:00
Add a configure script
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
e1e4855211
commit
7ded1df94b
106
Shorewall-core/configure
vendored
Executable file
106
Shorewall-core/configure
vendored
Executable file
@ -0,0 +1,106 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Shorewall Packet Filtering Firewall RPM configuration program - V4.5
|
||||
#
|
||||
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
||||
#
|
||||
# (c) 2012 - 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.
|
||||
#
|
||||
# Usage: ./configure <vendor> [ <option>=<setting> ] ...
|
||||
#
|
||||
#
|
||||
################################################################################################
|
||||
declare -A params
|
||||
declare -A options
|
||||
declare -u pn
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "Usage: $0 <var>=<val> ..." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
getfileparams() {
|
||||
while read option; do
|
||||
case $option in
|
||||
\#*)
|
||||
;;
|
||||
*)
|
||||
on=${option%=*}
|
||||
ov=${option#*=}
|
||||
ov=${ov%#*}
|
||||
[ -n "$on" ] && options[${on}]="${ov}"
|
||||
;;
|
||||
esac
|
||||
|
||||
done
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
for p in $@; do
|
||||
p=${p#--}
|
||||
[ -n "${p}" ] && {
|
||||
pn=${p%=*}
|
||||
pv=${p#*=}
|
||||
[ -n ${pn} ] && params[${pn}]="${pv}"
|
||||
}
|
||||
done
|
||||
|
||||
vendor=${params[VENDOR]}
|
||||
if [ -z "$vendor" ]; then
|
||||
rcfile=shorewallrc.default
|
||||
vendor=linux
|
||||
else
|
||||
rcfile=shorewallrc.$vendor
|
||||
fi
|
||||
|
||||
getfileparams < $rcfile || exit 1
|
||||
|
||||
for p in ${!params[@]}; do
|
||||
options[${p}]="${params[${p}]}"
|
||||
options[${p}]="${params[${p}]}"
|
||||
done
|
||||
|
||||
echo "HOST=$vendor" > shorewallrc
|
||||
|
||||
for on in \
|
||||
PREFIX \
|
||||
SHAREDIR \
|
||||
LIBEXECDIR \
|
||||
PERLLIBDIR \
|
||||
CONFDIR \
|
||||
SBINDIR \
|
||||
MANDIR \
|
||||
INITDIR \
|
||||
INITSOURCE \
|
||||
INITFILE \
|
||||
AUXINITSOURCE \
|
||||
AUXINITFILE \
|
||||
SYSTEMD \
|
||||
SYSCONFILE \
|
||||
SYSCONFDIR \
|
||||
ANNOTATED \
|
||||
VARDIR
|
||||
do
|
||||
echo "$on=${options[${on}]}" >> shorewallrc
|
||||
done
|
||||
|
||||
cat shorewallrc
|
||||
|
||||
|
||||
|
@ -138,9 +138,6 @@ local file
|
||||
# Read the RC file
|
||||
#
|
||||
if [ $# -eq 0 ]; then
|
||||
#
|
||||
# Load packager's settings if any
|
||||
#
|
||||
if [ -f ./.shorewallrc ]; then
|
||||
. ./.shorewallrc || exit 1
|
||||
file=./.shorewallrc
|
||||
@ -163,11 +160,20 @@ elif [ $# -eq 1 ]; then
|
||||
/*|.*)
|
||||
;;
|
||||
*)
|
||||
file=./$file || 1
|
||||
file=./$file || exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
. $file
|
||||
|
||||
if [ -n "$RPM" -a -f config ]; then
|
||||
. $config || exit 1
|
||||
> shorewallrc
|
||||
for var in HOST SHAREDIR LIBEXECDIR PERLLIBDIR CONFDIR SBINDIR MANDIR INITDIR INITSOURCE INITFILE AUXINITSOURCE AUXINITFILE SYSTEMD SYSCONFFILE SYSCONFDIR ANNOTATED VARDIR; do
|
||||
eval echo $var=\$$var >> shorewallrc
|
||||
done
|
||||
file=shorewallrc
|
||||
fi
|
||||
else
|
||||
usage 1
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user