From fead683f18d9859f5df301876be35083a8602c51 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Fri, 30 Mar 2012 16:21:37 -0700 Subject: [PATCH] Modify init scripts if ${SHAREDIR} is non-standard Signed-off-by: Tom Eastep --- Shorewall-init/ifupdown.sh | 5 +++++ Shorewall-init/init.debian.sh | 12 ++++-------- Shorewall-init/init.sh | 9 ++++----- Shorewall-init/install.sh | 1 + Shorewall-lite/init.debian.sh | 12 ++++-------- Shorewall-lite/init.fedora.sh | 11 ++++------- Shorewall-lite/init.sh | 10 ++++------ Shorewall-lite/install.sh | 13 +++++++++---- Shorewall/init.debian.sh | 11 ++++------- Shorewall/init.fedora.sh | 11 ++++------- Shorewall/init.sh | 10 ++++------ Shorewall/install.sh | 4 ++-- Shorewall6-lite/init.debian.sh | 9 ++++----- Shorewall6-lite/init.fedora.sh | 11 ++++------- Shorewall6-lite/init.sh | 14 ++++---------- Shorewall6/init.debian.sh | 11 ++++------- Shorewall6/init.fedora.sh | 12 +++++------- Shorewall6/init.sh | 16 ++++------------ 18 files changed, 74 insertions(+), 108 deletions(-) diff --git a/Shorewall-init/ifupdown.sh b/Shorewall-init/ifupdown.sh index c9ce4d091..cf99eb67a 100644 --- a/Shorewall-init/ifupdown.sh +++ b/Shorewall-init/ifupdown.sh @@ -71,6 +71,11 @@ Debian_SuSE_ppp() { IFUPDOWN=0 PRODUCTS= +# +# The installer may alter this +# +. /usr/share/shorewall/shorewallrc + if [ -f /etc/default/shorewall-init ]; then . /etc/default/shorewall-init elif [ -f /etc/sysconfig/shorewall-init ]; then diff --git a/Shorewall-init/init.debian.sh b/Shorewall-init/init.debian.sh index 9ae8f2ab2..032575e8e 100755 --- a/Shorewall-init/init.debian.sh +++ b/Shorewall-init/init.debian.sh @@ -62,14 +62,10 @@ not_configured () { exit 0 } -#determine where the files were installed -if [ -f ~/.shorewallrc ]; then - . ~/.shorewallrc || exit 1 - SRWL=${SBIN}/shorewall-init -else - CONFDIR=/etc - SYSCONFDIR=/etc/default -fi +# +# The installer may alter this +# +. /usr/share/shorewall/shorewallrc # check if shorewall-init is configured or not if [ -f "$SYSCONFDIR/shorewall-init" ] diff --git a/Shorewall-init/init.sh b/Shorewall-init/init.sh index ee8d7bc8f..86932e974 100755 --- a/Shorewall-init/init.sh +++ b/Shorewall-init/init.sh @@ -53,11 +53,10 @@ else exit 0 fi -if [ ~/.shorewallrc ]; then - . ~/.shorewallrc || exit 1 -else - VARDIR=/var/lib -fi +# +# The installer may alter this +# +. /usr/share/shorewall/shorewallrc # Initialize the firewall shorewall_start () { diff --git a/Shorewall-init/install.sh b/Shorewall-init/install.sh index d63ffb5ad..f6d43a90f 100755 --- a/Shorewall-init/install.sh +++ b/Shorewall-init/install.sh @@ -262,6 +262,7 @@ fi # if [ -n "$INITFILE" ]; then install_file $INITSOURCE ${DESTDIR}${INITDIR}/$INITFILE 0544 + [ "${SHAREDIR}" = /usr/share ] || eval sed -i \'s\|/usr/share/|${SHAREDIR}/|\' ${DESTDIR}${INITDIR}/$INITFILE if [ -n "${AUXINITSOURCE}" ]; then install_file $INITSOURCE ${DESTDIR}${INITDIR}/$AUXINITFILE 0544 diff --git a/Shorewall-lite/init.debian.sh b/Shorewall-lite/init.debian.sh index 2f7b90441..883ef70d1 100755 --- a/Shorewall-lite/init.debian.sh +++ b/Shorewall-lite/init.debian.sh @@ -57,14 +57,10 @@ not_configured () { exit 0 } -#determine where the files were installed -if [ -f ~/.shorewallrc ]; then - . ~/.shorewallrc || exit 1 - SRWL=${SBIN}/shorewall-lite -else - CONFDIR=/etc - SYSCONFDIR=/etc/default -fi +# +# The installer may alter this +# +. /usr/share/shorewall/shorewallrc # parse the shorewall params file in order to use params in # /etc/default/shorewall diff --git a/Shorewall-lite/init.fedora.sh b/Shorewall-lite/init.fedora.sh index c5b10a269..a8a1cccd5 100644 --- a/Shorewall-lite/init.fedora.sh +++ b/Shorewall-lite/init.fedora.sh @@ -20,13 +20,10 @@ # Source function library. . /etc/rc.d/init.d/functions -#determine where the files were installed -if [ -f ~/.shorewallrc ]; then - . ~/.shorewallrc || exit 1 -else - SBINDIR=/sbin - SYSCONFDIR=/etc/default -fi +# +# The installer may alter this +# +. /usr/share/shorewall/shorewallrc prog="shorewall-lite" shorewall="${SBINDIR}/$prog" diff --git a/Shorewall-lite/init.sh b/Shorewall-lite/init.sh index 3d342cc14..b1284e273 100755 --- a/Shorewall-lite/init.sh +++ b/Shorewall-lite/init.sh @@ -62,12 +62,10 @@ usage() { ################################################################################ OPTIONS= -if [ ~/.shorewallrc ]; then - . ~/.shorewallrc || exit 1 -else - SBINDIR=/sbin - SYSCONFDIR=/etc/sysconfig -fi +# +# The installer may alter this +# +. /usr/share/shorewall/shorewallrc if [ -f ${SYSCONFDIR}/shorewall-lite ]; then . ${SYSCONFDIR}/shorewall-lite diff --git a/Shorewall-lite/install.sh b/Shorewall-lite/install.sh index b5ee045af..0e8cc4833 100755 --- a/Shorewall-lite/install.sh +++ b/Shorewall-lite/install.sh @@ -339,21 +339,26 @@ if [ -n "$DESTDIR" ]; then fi if [ -n "$INITFILE" ]; then + + initfile="${DESTDIR}/${INITDIR}/${INITFILE}" + case $TARGET in debian) - install_file init.debian.sh ${DESTDIR}${INITDIR}/${INITFILE} 0544 + install_file init.debian.sh "$initfile" 0544 ;; redhat) - install_file init.fedora.sh ${DESTDIR}${INITDIR}/${INITFILE} 0544 + install_file init.fedora.sh "$initfile" 0544 ;; archlinux) - install_file init.archlinux.sh ${DESTDIR}${INITDIR}/${INITFILE} 0544 + install_file init.archlinux.sh "$initfile" 0544 ;; *) - install_file init.sh ${DESTDIR}${INITDIR}/${INITFILE} 0544 + install_file init.sh "$initfile" 0544 ;; esac + [ "${SHAREDIR} = /usr/share ] || eval sed -i \'s\|/usr/share/|${SHAREDIR}/|\' "$initfile" + echo "$Product init script installed in ${DESTDIR}${INITDIR}/${INITFILE}" fi # diff --git a/Shorewall/init.debian.sh b/Shorewall/init.debian.sh index 8a78d09e9..6950e84d1 100755 --- a/Shorewall/init.debian.sh +++ b/Shorewall/init.debian.sh @@ -53,13 +53,10 @@ not_configured () { exit 0 } -#determine where the files were installed -if [ -f ~/.shorewallrc ]; then - . ~/.shorewallrc || exit 1 - SRWL=${SBIN}/shorewall -else - SYSCONFDIR=/etc/default -fi +# +# The installer may alter this +# +. /usr/share/shorewall/shorewallrc # check if shorewall is configured or not if [ -f "${SYSCONFDIR}/shorewall" ] diff --git a/Shorewall/init.fedora.sh b/Shorewall/init.fedora.sh index a6bd2b73c..bd8072750 100644 --- a/Shorewall/init.fedora.sh +++ b/Shorewall/init.fedora.sh @@ -20,13 +20,10 @@ # Source function library. . /etc/rc.d/init.d/functions -#determine where the files were installed -if [ -f ~/.shorewallrc ]; then - . ~/.shorewallrc || exit 1 -else - SBINDIR=/sbin - SYSCONFDIR=/etc/default -fi +# +# The installer may alter this +# +. /usr/share/shorewall/shorewallrc prog="shorewall" shorewall="${SBINDIR}/$prog" diff --git a/Shorewall/init.sh b/Shorewall/init.sh index b96c7319c..152663232 100755 --- a/Shorewall/init.sh +++ b/Shorewall/init.sh @@ -63,12 +63,10 @@ usage() { ################################################################################ OPTIONS="-v0" -if [ ~/.shorewallrc ]; then - . ~/.shorewallrc || exit 1 -else - SBINDIR=/sbin - SYSCONFDIR=/etc/sysconfig -fi +# +# The installer may alter this +# +. /usr/share/shorewall/shorewallrc if [ -f ${SYSCONFDIR}/shorewall ]; then . ${SYSCONFDIR}/shorewall diff --git a/Shorewall/install.sh b/Shorewall/install.sh index 2b2b96b22..337213b3d 100755 --- a/Shorewall/install.sh +++ b/Shorewall/install.sh @@ -295,7 +295,6 @@ fi install -d $OWNERSHIP -m 755 ${DESTDIR}${SBINDIR} [ -n "${INITFILE}" ] && install -d $OWNERSHIP -m 755 ${DESTDIR}${INITDIR} - if [ -z "$DESTDIR" -a $PRODUCT != shorewall ]; then [ -x ${LIBEXECDIR}/shorewall/compiler.pl ] || \ { echo " ERROR: Shorewall >= 4.5.0 is not installed" >&2; exit 1; } @@ -325,7 +324,8 @@ echo "$PRODUCT control program installed in ${DESTDIR}${SBINDIR}/$PRODUCT" # if [ -n "$INITFILE" ]; then install_file $INITSOURCE ${DESTDIR}${INITDIR}/$INITFILE 0544 - + [ "${SHAREDIR}" = /usr/share ] || eval sed -i \'s\|/usr/share/|${SHAREDIR}/|\' ${DESTDIR}${INITDIR}/$INITFILE + if [ -n "${AUXINITSOURCE}" ]; then install_file $INITSOURCE ${DESTDIR}${INITDIR}/$INITFILE 0544 fi diff --git a/Shorewall6-lite/init.debian.sh b/Shorewall6-lite/init.debian.sh index e11aa3cda..59caf6efd 100755 --- a/Shorewall6-lite/init.debian.sh +++ b/Shorewall6-lite/init.debian.sh @@ -78,11 +78,10 @@ else not_configured fi -#determine where the files were installed -if [ -f ~/.shorewallrc ]; then - . ~/.shorewallrc || exit 1 - [ -n "$SBIN" ] && SRWL=${SBIN}/shorewall6-lite -fi +# +# The installer may alter this +# +. /usr/share/shorewall/shorewallrc # start the firewall shorewall6_start () { diff --git a/Shorewall6-lite/init.fedora.sh b/Shorewall6-lite/init.fedora.sh index c8912f730..6d2e6bd86 100644 --- a/Shorewall6-lite/init.fedora.sh +++ b/Shorewall6-lite/init.fedora.sh @@ -20,13 +20,10 @@ # Source function library. . /etc/rc.d/init.d/functions -#determine where the files were installed -if [ -f ~/.shorewallrc ]; then - . ~/.shorewallrc || exit 1 -else - SBINDIR=/sbin - SYSCONFDIR=/etc/default -fi +# +# The installer may alter this +# +. /usr/share/shorewall/shorewallrc prog="shorewall6-lite" shorewall="${SBINDIR}/$prog" diff --git a/Shorewall6-lite/init.sh b/Shorewall6-lite/init.sh index 6de96a233..9e681b4eb 100755 --- a/Shorewall6-lite/init.sh +++ b/Shorewall6-lite/init.sh @@ -62,16 +62,10 @@ usage() { ################################################################################ OPTIONS= -if [ ~/.shorewallrc ]; then - . ~/.shorewallrc || exit 1 -else - SBINDIR=/sbin - SYSCONFDIR=/etc/sysconfig -fi - -if [ -f ${SYSCONFDIR}/shorewall6-lite ]; then - . ${SYSCONFDIR}/shorewall6-lite -fi +# +# The installer may alter this +# +. /usr/share/shorewall/shorewallrc export SHOREWALL_INIT_SCRIPT=1 diff --git a/Shorewall6/init.debian.sh b/Shorewall6/init.debian.sh index 3590d2670..a6538d950 100755 --- a/Shorewall6/init.debian.sh +++ b/Shorewall6/init.debian.sh @@ -54,13 +54,10 @@ not_configured () { exit 0 } -#determine where the files were installed -if [ -f ~/.shorewallrc ]; then - . ~/.shorewallrc || exit 1 - [ -n "$SBIN" ] && SRWL=${SBIN}/shorewall6 -else - SYSCONFDIR=/etc/default -fi +# +# The installer may alter this +# +. /usr/share/shorewall/shorewallrc # check if shorewall is configured or not if [ -f "${SYSCONFDIR}/shorewall6" ] diff --git a/Shorewall6/init.fedora.sh b/Shorewall6/init.fedora.sh index 5aa46aaaa..3a4e4619f 100644 --- a/Shorewall6/init.fedora.sh +++ b/Shorewall6/init.fedora.sh @@ -20,13 +20,11 @@ # Source function library. . /etc/rc.d/init.d/functions -#determine where the files were installed -if [ -f ~/.shorewallrc ]; then - . ~/.shorewallrc || exit 1 -else - SBINDIR=/sbin - SYSCONFDIR=/etc/default -fi +# +# The installer may alter this +# +. /usr/share/shorewall/shorewallrc + prog="shorewall6" shorewall="${SBINDIR}/$prog" logger="logger -i -t $prog" diff --git a/Shorewall6/init.sh b/Shorewall6/init.sh index 5d08a5065..93d36ede8 100755 --- a/Shorewall6/init.sh +++ b/Shorewall6/init.sh @@ -63,18 +63,10 @@ usage() { ################################################################################ OPTIONS="-v0" -if [ ~/.shorewallrc ]; then - . ~/.shorewallrc || exit 1 -else - SBINDIR=/sbin - SYSCONFDIR=/etc/sysconfig -fi - -if [ -f /etc/sysconfig/shorewall6 ]; then - . /etc/sysconfig/shorewall6 -elif [ -f /etc/default/shorewall6 ] ; then - . /etc/default/shorewall6 -fi +# +# The installer may alter this +# +. /usr/share/shorewall/shorewallrc export SHOREWALL_INIT_SCRIPT=1