From f2311f198769ecb1a544eb1ce10bc013733ce877 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Mon, 26 Mar 2012 17:01:55 -0700 Subject: [PATCH] Update install scripts to look for .shorewallrc in many places Signed-off-by: Tom Eastep --- Shorewall-core/install.sh | 16 +++++++++++++--- Shorewall-core/lib.base | 2 +- Shorewall-init/install.sh | 14 ++++++++++++-- Shorewall-lite/install.sh | 14 ++++++++++++-- Shorewall/install.sh | 17 +++++++++++++---- 5 files changed, 51 insertions(+), 12 deletions(-) diff --git a/Shorewall-core/install.sh b/Shorewall-core/install.sh index b04548868..de7539658 100755 --- a/Shorewall-core/install.sh +++ b/Shorewall-core/install.sh @@ -143,11 +143,21 @@ if [ $# -eq 0 ]; then # # Load packager's settings if any # - if [ -n "${DESTDIR}" -a -f ../shorewall-pkg.config ]; then - . ../shorewall-pkg.config || exit 1 + if [ -f ./.shorewallrc ]; then + . ./.shorewallrc || exit 1 + file=./.shorewallrc + elif [ -r /root/.shorewallrc ]; then + . /root/.shorewallrc || exit 1 + file=/root/.shoreallrc + elif [ -r /.shorewallrc ]; then + . /.shorewallrc || exit 1 + file =/.shoreallrc elif [ -f ~/.shorewallrc ]; then . ~/.shorewallrc || exit 1 file=~/.shorewallrc + elif - -f ${SHOREWALLRC_HOME}/.shorewallrc; then + . ${SHOREWALLRC_HOME}/.shorewallrc || exit 1 + file=${SHOREWALLRC_HOME}/.shorewallrc fi elif [ $# -eq 1 ]; then file=$1 @@ -155,7 +165,7 @@ elif [ $# -eq 1 ]; then /*|.*) ;; *) - file=./$file + file=./$file || 1 ;; esac diff --git a/Shorewall-core/lib.base b/Shorewall-core/lib.base index ab6e2947e..568ffe07b 100644 --- a/Shorewall-core/lib.base +++ b/Shorewall-core/lib.base @@ -35,7 +35,7 @@ SHOREWALL_CAPVERSION=40502 if [ -z "$g_readrc" ]; then if [ -f ./.shorewallrc ]; then - . ~/.shorewallrc || exit 1 + . ./.shorewallrc || exit 1 elif [ -r /root/.shorewallrc ]; then . /root/.shorewallrc || exit 1 elif [ -r /.shorewallrc ]; then diff --git a/Shorewall-init/install.sh b/Shorewall-init/install.sh index 27d1d0118..f96f57800 100755 --- a/Shorewall-init/install.sh +++ b/Shorewall-init/install.sh @@ -137,11 +137,21 @@ if [ $# -eq 0 ]; then # # Load packager's settings if any # - if [ -n "${DESTDIR}" -a -f ../shorewall-pkg.config ]; then - . ../shorewall-pkg.config || exit 1 + if [ -f ./.shorewallrc ]; then + . ./.shorewallrc || exit 1 + file=./.shorewallrc + elif [ -r /root/.shorewallrc ]; then + . /root/.shorewallrc || exit 1 + file=/root/.shoreallrc + elif [ -r /.shorewallrc ]; then + . /.shorewallrc || exit 1 + file =/.shoreallrc elif [ -f ~/.shorewallrc ]; then . ~/.shorewallrc || exit 1 file=~/.shorewallrc + elif - -f ${SHOREWALLRC_HOME}/.shorewallrc; then + . ${SHOREWALLRC_HOME}/.shorewallrc || exit 1 + file=${SHOREWALLRC_HOME}/.shorewallrc else fatal_error "No configuration file specified and ~/.shorewallrc not found" fi diff --git a/Shorewall-lite/install.sh b/Shorewall-lite/install.sh index ce098c477..5b482a3bb 100755 --- a/Shorewall-lite/install.sh +++ b/Shorewall-lite/install.sh @@ -152,11 +152,21 @@ if [ $# -eq 0 ]; then # # Load packager's settings if any # - if [ -n "${DESTDIR}" -a -f ../shorewall-pkg.config ]; then - . ../shorewall-pkg.config || exit 1 + if [ -f ./.shorewallrc ]; then + . ./.shorewallrc || exit 1 + file=./.shorewallrc + elif [ -r /root/.shorewallrc ]; then + . /root/.shorewallrc || exit 1 + file=/root/.shoreallrc + elif [ -r /.shorewallrc ]; then + . /.shorewallrc || exit 1 + file =/.shoreallrc elif [ -f ~/.shorewallrc ]; then . ~/.shorewallrc || exit 1 file=~/.shorewallrc + elif - -f ${SHOREWALLRC_HOME}/.shorewallrc; then + . ${SHOREWALLRC_HOME}/.shorewallrc || exit 1 + file=${SHOREWALLRC_HOME}/.shorewallrc else fatal_error "No configuration file specified and ~/.shorewallrc not found" fi diff --git a/Shorewall/install.sh b/Shorewall/install.sh index cbb6a20bf..ce68dfef2 100755 --- a/Shorewall/install.sh +++ b/Shorewall/install.sh @@ -175,14 +175,23 @@ if [ $# -eq 0 ]; then # # Load packager's settings if any # - if [ -n "${DESTDIR}" -a -f ../shorewall-pkg.config ]; then - . ../shorewall-pkg.config || exit 1 - file = ../shorewall-pkg.config + if [ -f ./.shorewallrc ]; then + . ./.shorewallrc || exit 1 + file=./.shorewallrc + elif [ -r /root/.shorewallrc ]; then + . /root/.shorewallrc || exit 1 + file=/root/.shoreallrc + elif [ -r /.shorewallrc ]; then + . /.shorewallrc || exit 1 + file =/.shoreallrc elif [ -f ~/.shorewallrc ]; then . ~/.shorewallrc || exit 1 file=~/.shorewallrc + elif - -f ${SHOREWALLRC_HOME}/.shorewallrc; then + . ${SHOREWALLRC_HOME}/.shorewallrc || exit 1 + file=${SHOREWALLRC_HOME}/.shorewallrc else - fatal_error "No configuration file specified and ~/.shorewallrc not found" + fatal_error "No configuration file specified and .shorewallrc not found" fi elif [ $# -eq 1 ]; then file=$1