From b85880e8e60936ff909d4219b0e3cc581d6a6ae5 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Fri, 15 Mar 2013 10:53:36 -0700 Subject: [PATCH] Correct handling of install on RedHat and derivatives. Signed-off-by: Tom Eastep --- Shorewall-init/install.sh | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/Shorewall-init/install.sh b/Shorewall-init/install.sh index 912be9253..a48c37681 100755 --- a/Shorewall-init/install.sh +++ b/Shorewall-init/install.sh @@ -394,11 +394,23 @@ case $HOST in fi ;; redhat) - if [ -f ${DESTDIR}${SBINDIR}/ifup-local -o -f ${DESTDIR}${SBINDIR}/ifdown-local ]; then - echo "WARNING: ${SBINDIR}/ifup-local and/or ${SBINDIR}/ifdown-local already exist; up/down events will not be handled" - elif [ -z "$DESTDIR" ]; then - install_file ifupdown ${DESTDIR}${SBINDIR}/ifup-local 0544 - install_file ifupdown ${DESTDIR}${SBINDIR}/ifdown-local 0544 + if [ -z "$DESTDIR" ]; then + install_local= + + if [ -f ${SBINDIR}/ifup-local -o -f ${SBINDIR}/ifdown-local ]; then + if ! fgrep -q Shorewall-based ${SBINDIR}/ifup-local || ! fgrep -q Shorewall-based ${SBINDIR}/ifdown-local; then + echo "WARNING: ${SBINDIR}/ifup-local and/or ${SBINDIR}/ifdown-local already exist; up/down events will not be handled" + else + install_local=Yes + fi + else + install_local=Yes + fi + + if [ -n "$install_local" ]; then + install_file ifupdown ${DESTDIR}${SBINDIR}/ifup-local 0544 + install_file ifupdown ${DESTDIR}${SBINDIR}/ifdown-local 0544 + fi fi ;; esac