diff --git a/Shorewall-core/install.sh b/Shorewall-core/install.sh index 1b3ee963f..b04548868 100755 --- a/Shorewall-core/install.sh +++ b/Shorewall-core/install.sh @@ -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 diff --git a/Shorewall-core/lib.base b/Shorewall-core/lib.base index 2ec014c1d..76aeeb94f 100644 --- a/Shorewall-core/lib.base +++ b/Shorewall-core/lib.base @@ -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" diff --git a/Shorewall-core/lib.cli b/Shorewall-core/lib.cli index f532716ee..d44cf111b 100644 --- a/Shorewall-core/lib.cli +++ b/Shorewall-core/lib.cli @@ -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} diff --git a/Shorewall-init/shorewall-init b/Shorewall-init/shorewall-init index f34de5ee0..4a190899c 100644 --- a/Shorewall-init/shorewall-init +++ b/Shorewall-init/shorewall-init @@ -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 diff --git a/Shorewall-lite/shorewall-lite b/Shorewall-lite/shorewall-lite index 698e698bd..bbad1fbde 100755 --- a/Shorewall-lite/shorewall-lite +++ b/Shorewall-lite/shorewall-lite @@ -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} diff --git a/Shorewall/shorewall b/Shorewall/shorewall index 7cbca8e00..5bcc979bc 100755 --- a/Shorewall/shorewall +++ b/Shorewall/shorewall @@ -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"