2012-03-27 23:33:49 +02:00
|
|
|
#!/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.
|
|
|
|
#
|
2012-04-10 19:20:53 +02:00
|
|
|
# Usage: ./configure <option>=<setting> ...
|
2012-03-27 23:33:49 +02:00
|
|
|
#
|
|
|
|
#
|
|
|
|
################################################################################################
|
|
|
|
declare -A params
|
|
|
|
declare -A options
|
|
|
|
|
|
|
|
getfileparams() {
|
|
|
|
while read option; do
|
|
|
|
case $option in
|
|
|
|
\#*)
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
on=${option%=*}
|
|
|
|
ov=${option#*=}
|
|
|
|
ov=${ov%#*}
|
|
|
|
[ -n "$on" ] && options[${on}]="${ov}"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
2012-03-29 02:01:43 +02:00
|
|
|
if [ $# -eq 0 ]; then
|
|
|
|
echo "Usage: $0 <var>=<val> ..." >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2012-03-27 23:33:49 +02:00
|
|
|
for p in $@; do
|
2012-03-30 03:53:21 +02:00
|
|
|
p=${p#--}
|
2012-03-29 16:40:15 +02:00
|
|
|
|
2012-03-30 03:53:21 +02:00
|
|
|
if [ -n "${p}" ]; then
|
2012-03-30 04:05:17 +02:00
|
|
|
declare -u pn
|
|
|
|
|
2012-03-30 03:53:21 +02:00
|
|
|
pn=${p%=*}
|
|
|
|
pv=${p#*=}
|
2012-03-29 16:40:15 +02:00
|
|
|
|
2012-03-30 03:53:21 +02:00
|
|
|
if [ -n "${pn}" ]; then
|
|
|
|
case ${pn} in
|
|
|
|
VENDOR)
|
|
|
|
pn=HOST
|
|
|
|
;;
|
|
|
|
SHAREDSTATEDIR)
|
|
|
|
pn=VARDIR
|
|
|
|
;;
|
|
|
|
DATADIR)
|
|
|
|
pn=SHAREDIR
|
|
|
|
;;
|
|
|
|
SYSCONFDIR)
|
|
|
|
pn=CONFDIR
|
|
|
|
;;
|
|
|
|
esac
|
2012-03-30 03:50:53 +02:00
|
|
|
|
2012-03-30 03:53:21 +02:00
|
|
|
params[${pn}]="${pv}"
|
|
|
|
fi
|
2012-03-29 16:40:15 +02:00
|
|
|
fi
|
2012-03-27 23:33:49 +02:00
|
|
|
done
|
|
|
|
|
2012-03-28 15:13:10 +02:00
|
|
|
vendor=${params[HOST]}
|
2012-03-29 02:01:43 +02:00
|
|
|
|
2012-03-27 23:33:49 +02:00
|
|
|
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 \
|
2012-04-01 19:47:24 +02:00
|
|
|
SYSCONFFILE \
|
2012-03-27 23:33:49 +02:00
|
|
|
SYSCONFDIR \
|
|
|
|
ANNOTATED \
|
|
|
|
VARDIR
|
|
|
|
do
|
|
|
|
echo "$on=${options[${on}]}" >> shorewallrc
|
|
|
|
done
|
|
|
|
|
|
|
|
cat shorewallrc
|