diff --git a/Shorewall-init/install.sh b/Shorewall-init/install.sh index 94a349a24..387118d14 100755 --- a/Shorewall-init/install.sh +++ b/Shorewall-init/install.sh @@ -117,6 +117,8 @@ case "$LIBEXEC" in ;; esac +INITFILE="shorewall-init" + if [ -z "$BUILD" ]; then case $(uname) in CYGWIN*) @@ -149,12 +151,6 @@ case $BUILD in GROUP=$(id -gn) ;; MAC) - if [ -z "$DESTDIR" ]; then - DEST= - INIT= - SPARSE=Yes - fi - [ -z "$OWNER" ] && OWNER=root [ -z "$GROUP" ] && GROUP=wheel INSTALLD= @@ -177,7 +173,7 @@ case "$HOST" in ;; REDHAT) echo "Installing Redhat/Fedora-specific configuration..." - DEST=/etc/rc.d/init.d + INITDIR=/etc/rc.d/init.d ;; SLACKWARE) echo "Shorewall-init is currently not supported on Slackware" >&2 @@ -199,12 +195,8 @@ case "$HOST" in ;; esac -if [ -z "$DEST" ] ; then - DEST="/etc/init.d" -fi - -if [ -z "$INIT" ] ; then - INIT="shorewall-init" +if [ -z "$INITDIR" -a -n "$INITFILE" ] ; then + INITDIR="/etc/init.d" fi if [ -n "$DESTDIR" ]; then @@ -213,7 +205,7 @@ if [ -n "$DESTDIR" ]; then OWNERSHIP="" fi - install -d $OWNERSHIP -m 755 ${DESTDIR}${DEST} + install -d $OWNERSHIP -m 755 ${DESTDIR}${INITDIR} fi if [ -z "$DESTDIR" ]; then @@ -243,19 +235,10 @@ fi # # Install the Init Script # -case $HOST in - DEBIAN) - install_file init.debian.sh ${DESTDIR}/etc/init.d/shorewall-init 0544 - ;; - REDHAT) - install_file init.fedora.sh ${DESTDIR}/etc/init.d/shorewall-init 0544 - ;; - *) - install_file init.sh ${DESTDIR}${DEST}/$INIT 0544 - ;; -esac - -echo "Shorewall Init script installed in ${DESTDIR}${DEST}/$INIT" +if [ -n "$INITFILE" ]; then + install_file init.sh ${DESTDIR}${INITDIR}/$INITFILE 0544 + echo "Shorewall Init script installed in ${DESTDIR}${INITDIR}/$INITFILE" +fi # # Install the .service file @@ -282,7 +265,7 @@ chmod 644 ${DESTDIR}/usr/share/shorewall-init/version # if [ -z "$DESTDIR" ]; then rm -f /usr/share/shorewall-init/init - ln -s ${DEST}/${INIT} /usr/share/shorewall-init/init + ln -s ${INITDIR}/${INITFILE} /usr/share/shorewall-init/init fi if [ $HOST = DEBIAN ]; then @@ -381,7 +364,7 @@ if [ -z "$DESTDIR" ]; then else cant_autostart fi - elif [ "$INIT" != rc.firewall ]; then #Slackware starts this automatically + else cant_autostart fi diff --git a/Shorewall-lite/install.sh b/Shorewall-lite/install.sh index f320c6713..5dd199b52 100755 --- a/Shorewall-lite/install.sh +++ b/Shorewall-lite/install.sh @@ -137,6 +137,7 @@ esac # CYGWIN= INSTALLD='-D' +INITFILE=$PRODUCT T='-T' if [ -z "$BUILD" ]; then @@ -167,21 +168,10 @@ fi case $BUILD in CYGWIN*) - if [ -z "$DESTDIR" ]; then - DEST= - INIT= - fi - OWNER=$(id -un) GROUP=$(id -gn) ;; MAC) - if [ -z "$DESTDIR" ]; then - DEST= - INIT= - SPARSE=Yes - fi - [ -z "$OWNER" ] && OWNER=root [ -z "$GROUP" ] && GROUP=wheel INSTALLD= @@ -199,10 +189,12 @@ OWNERSHIP="-o $OWNER -g $GROUP" case "$HOST" in CYGWIN) - echo "Installing Cygwin-specific configuration..." + echo "$PRODUCT is not supported on Cygwin" >&2 + exit 1 ;; MAC) - echo "Installing Mac-specific configuration..."; + echo "$PRODUCT is not supported on OS X" >&2 + exit 1 ;; DEBIAN) echo "Installing Debian-specific configuration..." @@ -210,18 +202,18 @@ case "$HOST" in ;; REDHAT) echo "Installing Redhat/Fedora-specific configuration..." - DEST=/etc/rc.d/init.d + INITDIR=/etc/rc.d/init.d ;; SLACKWARE) echo "Installing Slackware-specific configuration..." - DEST="/etc/rc.d" + INITDIR="/etc/rc.d" + INITFILE="rc.firewall" MANDIR="/usr/man" - INIT="rc.firewall" ;; ARCHLINUX) echo "Installing ArchLinux-specific configuration..." - DEST="/etc/rc.d" - INIT="$PRODUCT" + INITDIR="/etc/rc.d" + INITFILE="$PRODUCT" ;; LINUX|SUSE) ;; @@ -231,13 +223,7 @@ case "$HOST" in ;; esac -if [ -z "$DEST" ] ; then - DEST="/etc/init.d" -fi - -if [ -z "$INIT" ] ; then - INIT="$PRODUCT" -fi +[ -z "$INITDIR" ] && INITDIR="/etc/init.d" if [ -n "$DESTDIR" ]; then if [ `id -u` != 0 ] ; then @@ -246,7 +232,7 @@ if [ -n "$DESTDIR" ]; then fi install -d $OWNERSHIP -m 755 ${DESTDIR}/sbin - install -d $OWNERSHIP -m 755 ${DESTDIR}${DEST} + install -d $OWNERSHIP -m 755 ${DESTDIR}${DESTFILE} if [ -n "$SYSTEMD" ]; then mkdir -p ${DESTDIR}/lib/systemd/system @@ -300,22 +286,8 @@ echo "$Product control program installed in ${DESTDIR}/sbin/$PRODUCT" # # Install the Firewall Script # -case $HOST in - DEBIAN) - install_file init.debian.sh ${DESTDIR}/etc/init.d/$PRODUCT 0544 - ;; - REDHAT) - install_file init.fedora.sh ${DESTDIR}/etc/init.d/$PRODUCT 0544 - ;; - ARCHLINUX) - install_file init.archlinux.sh ${DESTDIR}/${DEST}/$INIT 0544 - ;; - *) - install_file init.sh ${DESTDIR}/${DEST}/$INIT 0544 - ;; -esac - -echo "$Product script installed in ${DESTDIR}${DEST}/$INIT" +install_file init.sh ${DESTDIR}${INITDIR}/$INITFILE 0544 +echo "$Product script installed in ${DESTDIR}${INITDIR}/$INITFILE" # # Create /etc/$PRODUCT, /usr/share/$PRODUCT and /var/lib/$PRODUCT if needed @@ -449,7 +421,7 @@ chmod 644 ${DESTDIR}/usr/share/$PRODUCT/version if [ -z "$DESTDIR" ]; then rm -f /usr/share/$PRODUCT/init - ln -s ${DEST}/${INIT} /usr/share/$PRODUCT/init + ln -s ${INITDIR}/${INITFILE} /usr/share/$PRODUCT/init fi delete_file ${DESTDIR}/usr/share/$PRODUCT/lib.common @@ -496,7 +468,7 @@ if [ -z "$DESTDIR" ]; then else cant_autostart fi - elif [ "$INIT" != rc.firewall ]; then #Slackware starts this automatically + elif [ "$INITFILE" != rc.firewall ]; then #Slackware starts this automatically cant_autostart fi fi diff --git a/Shorewall/install.sh b/Shorewall/install.sh index 460da1dad..f83490b89 100755 --- a/Shorewall/install.sh +++ b/Shorewall/install.sh @@ -112,6 +112,8 @@ ANNOTATED= MANDIR=${MANDIR:-"/usr/share/man"} SPARSE= INSTALLD='-D' +INITFILE="$PRODUCT" + [ -n "${LIBEXEC:=/usr/share}" ] [ -n "${PERLLIB:=/usr/share/shorewall}" ] @@ -161,21 +163,10 @@ fi case $BUILD in CYGWIN*) - if [ -z "$DESTDIR" ]; then - DEST= - INIT= - fi - OWNER=$(id -un) GROUP=$(id -gn) ;; MAC) - if [ -z "$DESTDIR" ]; then - DEST= - INIT= - SPARSE=Yes - fi - [ -z "$OWNER" ] && OWNER=root [ -z "$GROUP" ] && GROUP=wheel INSTALLD= @@ -256,9 +247,11 @@ fi case "$HOST" in CYGWIN) echo "Installing Cygwin-specific configuration..." + INITFILE= ;; MAC) echo "Installing Mac-specific configuration..."; + INITFILE= ;; DEBIAN) echo "Installing Debian-specific configuration..." @@ -266,18 +259,18 @@ case "$HOST" in ;; REDHAT) echo "Installing Redhat/Fedora-specific configuration..." - DEST="/etc/rc.d/init.d" + INITDIR="/etc/rc.d/init.d" ;; SLACKWARE) echo "Installing Slackware-specific configuration..." - DEST="/etc/rc.d" + INITDIR="/etc/rc.d" MANDIR="/usr/man" - INIT="rc.firewall" + INITFILE="rc.firewall" ;; ARCHLINUX) echo "Installing ArchLinux-specific configuration..." - DEST="/etc/rc.d" - INIT="$PRODUCT" + INITDIR="/etc/rc.d" + INITFILE="$PRODUCT" ;; LINUX) ;; @@ -287,12 +280,8 @@ case "$HOST" in ;; esac -if [ -z "$DEST" ] ; then - DEST="/etc/init.d" -fi - -if [ -z "$INIT" ] ; then - INIT="$PRODUCT" +if [ -z "$INITDIR" -a -n "$INITFILE" ] ; then + INITDIR="/etc/init.d" fi if [ -n "$DESTDIR" ]; then @@ -304,7 +293,7 @@ if [ -n "$DESTDIR" ]; then fi install -d $OWNERSHIP -m 755 ${DESTDIR}/sbin - install -d $OWNERSHIP -m 755 ${DESTDIR}${DEST} + install -d $OWNERSHIP -m 755 ${DESTDIR}${INITDIR} else [ -x /usr/share/shorewall/compiler.pl ] || \ { echo " ERROR: Shorewall >= 4.3.5 is not installed" >&2; exit 1; } @@ -346,15 +335,6 @@ fi # Install the Firewall Script # case $HOST in - DEBIAN) - install_file init.debian.sh ${DESTDIR}/etc/init.d/$PRODUCT 0544 - ;; - REDHAT) - install_file init.fedora.sh ${DESTDIR}${DEST}/$PRODUCT 0544 - ;; - ARCHLINUX) - install_file init.archlinux.sh ${DESTDIR}${DEST}/$INIT 0544 - ;; SLACKWARE) if [ $PRODUCT = shorewall ]; then install_file init.slackware.firewall.sh ${DESTDIR}${DEST}/rc.firewall 0644 @@ -362,13 +342,13 @@ case $HOST in fi ;; *) - if [ -n "$INIT" ]; then - install_file init.sh ${DESTDIR}${DEST}/$INIT 0544 + if [ -n "$INITFILE" ]; then + install_file init.sh ${DESTDIR}${INITDIR}/$INITFILE 0544 fi ;; esac -[ -n "$INIT" ] && echo "$Product script installed in ${DESTDIR}${DEST}/$INIT" +[ -n "$INITFILE" ] && echo "$Product script installed in ${DESTDIR}${INITDIR}/$INITFILE" # # Create /etc/$PRODUCT and /var/lib/$PRODUCT if needed @@ -1084,7 +1064,7 @@ chmod 644 ${DESTDIR}/usr/share/$PRODUCT/version if [ -z "$DESTDIR" ]; then rm -f /usr/share/$PRODUCT/init - ln -s ${DEST}/${INIT} /usr/share/$PRODUCT/init + ln -s ${INITDIR}/${INITFILE} /usr/share/$PRODUCT/init fi # @@ -1153,7 +1133,7 @@ if [ -z "$DESTDIR" -a -n "$first_install" -a -z "${CYGWIN}${MAC}" ]; then else cant_autostart fi - elif [ "$INIT" != rc.f ]; then #Slackware starts this automatically + elif [ "$INITFILE" != rc.f ]; then #Slackware starts this automatically cant_autostart fi fi