Look in additional places for .shorewallrc

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2012-03-26 15:00:43 -07:00
parent fd82877312
commit 7b9c1d43cd
6 changed files with 54 additions and 14 deletions

View File

@ -315,8 +315,8 @@ chmod 644 ${DESTDIR}${SHAREDIR}/shorewall/coreversion
cp $file ${DESTDIR}${SHAREDIR}/shorewall/shorewallrc
if [ -z "${DESTDIR}" ]; then
[ -f ~/.shorewallrc ] || cp $file ~/.shorewallrc
if [ -z "${DESTDIR}" -n ${HOME} ]; then
[ -f ${HOME}/.shorewallrc ] || cp $file ${HOME}/.shorewallrc
fi
#
# Report Success

View File

@ -33,8 +33,17 @@ SHOREWALL_CAPVERSION=40502
[ -n "${g_program:=shorewall}" ]
if [ -z "$g_readrc" ]; then
if [ -f ~/.shorewallrc ]; then
if [ -f ./.shorewallrc ]; then
. ~/.shorewallrc || exit 1
elif [ -r /root/.shorewallrc ]; then
. /root/.shorewallrc || exit 1
elif [ -r /.shorewallrc ]; then
. /root/.shorewallrc || exit 1
elif [ -f ~/.shorewallrc ]; then
. ~/.shorewallrc || exit 1
elif - -f ${SHOREAWLLRC_HOME}/.shorewallrc; then
. ${SHOREAWLLRC_HOME}/.shorewallrc || exit 1
else
SHAREDIR=/usr/share
CONFDIR=/etc
@ -471,14 +480,14 @@ mktempfile() {
else
case "$MKTEMP" in
BSD)
mktemp /tmp/shorewall.XXXXXX
mktemp ${TMPDIR:-/tmp}/shorewall.XXXXXX
;;
STD)
mktemp -t shorewall.XXXXXX
;;
None)
rm -f /tmp/shorewall-$$
> /tmp/shorewall-$$ && echo /tmp/shorewall-$$
rm -f ${TMPDIR:-/tmp}/shorewall-$$
> ${TMPDIR:-}/shorewall-$$ && echo ${TMPDIR:-/tmp}/shorewall-$$
;;
*)
error_message "ERROR:Internal error in mktempfile"

View File

@ -25,8 +25,16 @@
#
if [ -z "$g_readrc" ]; then
if [ -f ~/.shorewallrc ]; then
if [ -f ./.shorewallrc ]; then
. ./.shorewallrc || exit 1
elif [ -f ~/.shorewallrc ]; then
. ~/.shorewallrc || exit 1
elif [ -r /root/.shorewallrc ]; then
. /root/.shorewallrc || exit 1
elif [ -r /.shorewallrc ]; then
. /root/.shorewallrc || exit 1
elif - -f ${SHOREAWLLRC_HOME}/.shorewallrc; then
. ${SHOREAWLLRC_HOME}/.shorewallrc || exit 1
else
SHAREDIR=/usr/share
CONFDIR=${CONFDIR}

View File

@ -23,10 +23,20 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
#########################################################################################
if [ -f ~/.shorewallrc ]; then
if [ -f ./.shorewallrc ]; then
. ./.shorewallrc || exit 1
elif [ -f ~/.shorewallrc ]; then
. ~/.shorewallrc || exit 1
elif [ -r /root/.shorewallrc ]; then
. /root/.shorewallrc || exit 1
elif [ -r /.shorewallrc ]; then
. /root/.shorewallrc || exit 1
elif - -f ${SHOREAWLLRC_HOME}/.shorewallrc; then
. ${SHOREAWLLRC_HOME}/.shorewallrc || exit 1
else
echo "ERROR: ./.shorewallrc not found" >&2
VARDIR=/var/lib
LIBEXECDIR=/usr/share
SYSCONFDIR=/etc/sysconfig
fi
# check if shorewall-init is configured or not
@ -48,8 +58,6 @@ shorewall_start () {
echo -n "Initializing \"Shorewall-based firewalls\": "
for PRODUCT in $PRODUCTS; do
VARDIR=/var/lib/$PRODUCT
[ -f /etc/$PRODUCT/vardir ] && . /etc/$PRODUCT/vardir
if [ -x ${VARDIR}/firewall ]; then
if ! /sbin/$PRODUCT status > /dev/null 2>&1; then
${VARDIR}/firewall stop || exit 1

View File

@ -27,8 +27,16 @@
################################################################################################
g_program=shorewall-lite
if [ -f ~/.shorewallrc ]; then
if [ -f ./.shorewallrc ]; then
. ./.shorewallrc || exit 1
elif [ -f ~/.shorewallrc ]; then
. ~/.shorewallrc || exit 1
elif [ -r /root/.shorewallrc ]; then
. /root/.shorewallrc || exit 1
elif [ -r /.shorewallrc ]; then
. /root/.shorewallrc || exit 1
elif - -f ${SHOREAWLLRC_HOME}/.shorewallrc; then
. ${SHOREAWLLRC_HOME}/.shorewallrc || exit 1
else
SHAREDIR=/usr/share
CONFDIR=${CONFDIR}

View File

@ -27,8 +27,16 @@
################################################################################################
g_program=shorewall
if [ -f ~/.shorewallrc ]; then
if [ -f ./.shorewallrc ]; then
. ./.shorewallrc || exit 1
elif [ -f ~/.shorewallrc ]; then
. ~/.shorewallrc || exit 1
elif [ -r /root/.shorewallrc ]; then
. /root/.shorewallrc || exit 1
elif [ -r /.shorewallrc ]; then
. /root/.shorewallrc || exit 1
elif - -f ${SHOREAWLLRC_HOME}/.shorewallrc; then
. ${SHOREAWLLRC_HOME}/.shorewallrc || exit 1
else
SHAREDIR=/usr/share
CONFDIR=${CONFDIR}
@ -36,7 +44,6 @@ else
VARDIR=/var/lib
LIBEXECDIR=/usr/share
PERLLIBDIR=/usr/share/shorewall
fi
g_libexec="$LIBEXECDIR"