From 30cf344be04626cca6fda5636d9ad998e01b6963 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Sun, 12 Feb 2012 11:47:08 -0800 Subject: [PATCH 1/4] Unify 4.4/4.5 documentation Index Signed-off-by: Tom Eastep --- docs/Documentation_Index.xml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/docs/Documentation_Index.xml b/docs/Documentation_Index.xml index ebc957339..3045d41b0 100644 --- a/docs/Documentation_Index.xml +++ b/docs/Documentation_Index.xml @@ -5,7 +5,7 @@ - Shorewall 4.5 Documentation + Shorewall 4.4/4.5 Documentation @@ -55,7 +55,7 @@ - + Linux Containers (LXC) @@ -285,7 +285,7 @@ Port Information - + @@ -294,7 +294,7 @@ Port Knocking and Other Uses of the 'Recent Match' - + @@ -303,7 +303,7 @@ PPTP - + @@ -312,7 +312,7 @@ Proxy ARP - + @@ -322,7 +322,7 @@ QuickStart Guides - + @@ -330,7 +330,7 @@ Release Model - + @@ -339,7 +339,7 @@ Requirements - + @@ -348,7 +348,7 @@ Routing and Shorewall - + @@ -357,7 +357,7 @@ Routing on One Interface - + @@ -366,7 +366,7 @@ Samba - + @@ -376,7 +376,7 @@ Shorewall Init - + @@ -386,7 +386,7 @@ Shorewall Lite - + From 29fcb9b08f243b1069ee498b3d2a8da870508f77 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Mon, 13 Feb 2012 12:57:07 -0800 Subject: [PATCH 2/4] Apply Simon Mater's patch for LIBEXEC/PERLLIB Signed-off-by: Tom Eastep --- Shorewall-core/install.sh | 9 +++++++++ Shorewall-lite/install.sh | 2 -- Shorewall/install.sh | 9 --------- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/Shorewall-core/install.sh b/Shorewall-core/install.sh index 933de2ed2..6e12a3397 100755 --- a/Shorewall-core/install.sh +++ b/Shorewall-core/install.sh @@ -263,6 +263,15 @@ for f in lib.* ; do install_file $f ${DESTDIR}/usr/share/shorewall/$f 0644 echo "Library ${f#*.} file installed as ${DESTDIR}/usr/share/shorewall/$f" done + +if [ -z "$MACHOST" ]; then + eval sed -i \'s\|g_libexec=.\*\|g_libexec=$LIBEXEC\|\' ${DESTDIR}/usr/share/shorewall/lib.cli + eval sed -i \'s\|g_perllib=.\*\|g_perllib=$PERLLIB\|\' ${DESTDIR}/usr/share/shorewall/lib.cli +else + eval sed -i \'\' -e \'s\|g_libexec=.\*\|g_libexec=$LIBEXEC\|\' ${DESTDIR}/usr/share/shorewall/lib.cli + eval sed -i \'\' -e \'s\|g_perllib=.\*\|g_perllib=$PERLLIB\|\' ${DESTDIR}/usr/share/shorewall/lib.cli +fi + # # Symbolically link 'functions' to lib.base # diff --git a/Shorewall-lite/install.sh b/Shorewall-lite/install.sh index b82db7e3a..796b7929c 100755 --- a/Shorewall-lite/install.sh +++ b/Shorewall-lite/install.sh @@ -238,8 +238,6 @@ delete_file ${DESTDIR}/usr/share/$PRODUCT/xmodules install_file $PRODUCT ${DESTDIR}/sbin/$PRODUCT 0544 -eval sed -i \'``s\|g_libexec=.\*\|g_libexec=$LIBEXEC\|\' ${DESTDIR}/sbin/$PRODUCT - echo "$Product control program installed in ${DESTDIR}/sbin/$PRODUCT" # diff --git a/Shorewall/install.sh b/Shorewall/install.sh index 6c101d690..f5506e750 100755 --- a/Shorewall/install.sh +++ b/Shorewall/install.sh @@ -310,18 +310,9 @@ fi if [ -z "$CYGWIN" ]; then install_file $PRODUCT ${DESTDIR}/sbin/$PRODUCT 0755 - if [ -z "$MACHOST" ]; then - eval sed -i \'s\|g_libexec=.\*\|g_libexec=$LIBEXEC\|\' ${DESTDIR}/sbin/$PRODUCT - eval sed -i \'s\|g_perllib=.\*\|g_perllib=$PERLLIB\|\' ${DESTDIR}/sbin/$PRODUCT - else - eval sed -i \'\' -e \'s\|g_libexec=.\*\|g_libexec=$LIBEXEC\|\' ${DESTDIR}/sbin/$PRODUCT - eval sed -i \'\' -e \'s\|g_perllib=.\*\|g_perllib=$PERLLIB\|\' ${DESTDIR}/sbin/$PRODUCT - fi echo "$PRODUCT control program installed in ${DESTDIR}/sbin/$PRODUCT" else install_file $PRODUCT ${DESTDIR}/bin/$PRODUCT 0755 - eval sed -i \'s\|g_libexec=.\*\|g_libexec=$LIBEXEC\|\' ${DESTDIR}/bin/$PRODUCT - eval sed -i \'s\|g_perllib=.\*\|g_perllib=$PERLLIB\|\' ${DESTDIR}/bin/$PRODUCT echo "$PRODUCT control program installed in ${DESTDIR}/bin/$PRODUCT" fi From 7bf6419a7bff21af09e1ef21e1dddbd5d1bae087 Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Wed, 15 Feb 2012 17:19:54 -0800 Subject: [PATCH 3/4] Install the correct init script on Fedora --- Shorewall-init/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Shorewall-init/install.sh b/Shorewall-init/install.sh index 57c0c5649..04199930f 100755 --- a/Shorewall-init/install.sh +++ b/Shorewall-init/install.sh @@ -213,7 +213,7 @@ fi if [ -n "$DEBIAN" ]; then install_file init.debian.sh ${DESTDIR}/etc/init.d/shorewall-init 0544 elif [ -n "$FEDORA" ]; then - install_file init.debian.sh ${DESTDIR}/etc/init.d/shorewall-init 0544 + install_file init.sh ${DESTDIR}/etc/init.d/shorewall-init 0544 #elif [ -n "$ARCHLINUX" ]; then # install_file init.archlinux.sh ${DESTDIR}${DEST}/$INIT 0544 else From 33b0821f8d85db34b1ce2cf028f49ee1057db50f Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Fri, 17 Feb 2012 13:22:06 -0800 Subject: [PATCH 4/4] Separate install system from target system in the install.sh scripts Signed-off-by: Tom Eastep --- Shorewall-init/install.sh | 213 ++++++++++++++++++++++++-------------- Shorewall-lite/install.sh | 119 +++++++++++++++------ Shorewall/install.sh | 173 ++++++++++++++++++------------- 3 files changed, 326 insertions(+), 179 deletions(-) diff --git a/Shorewall-init/install.sh b/Shorewall-init/install.sh index 04199930f..9ffefe5dc 100755 --- a/Shorewall-init/install.sh +++ b/Shorewall-init/install.sh @@ -131,16 +131,51 @@ case "$LIBEXEC" in ;; esac -# -# Determine where to install the firewall script -# +if [ -n "INSTALLSYS" ]; then + case $(uname) in + CYGWIN*) + INSTALLSYS=CYGWIN + ;; + Darwin) + INSTALLSYS=MAC + ;; + *) + if [ -f /etc/debian_version ]; then + INSTALLSYS=DEBIAN + elif [ -f /etc/redhat-release ]; then + if [ -d /etc/sysconfig/network-scripts/ ]; then + INSTALLSYS=REDHAT + else + INSTALLSYS=FEDORA + fi + elif [ -f /etc/slackware-version ] ; then + INSTALLSYS=SLACKWARE + elif [ -f /etc/arch-release ] ; then + INSTALLSYS=ARCHLINUX + else + INSTALLSYS= + fi + ;; + esac +fi + +case $INSTALLSYS in + CYGWIN*) + OWNER=$(id -un) + GROUP=$(id -gn) + ;; + MAC) + if [ -z "$DESTDIR" ]; then + DEST= + INIT= + SPARSE=Yes + fi -case $(uname) in - Darwin) [ -z "$OWNER" ] && OWNER=root [ -z "$GROUP" ] && GROUP=wheel + INSTALLD= T= - ;; + ;; *) [ -z "$OWNER" ] && OWNER=root [ -z "$GROUP" ] && GROUP=root @@ -149,6 +184,39 @@ esac OWNERSHIP="-o $OWNER -g $GROUP" +[ -n "$TARGET" ] || TARGET=$INSTALLSYS + +case "$TARGET" in + DEBIAN) + echo "Installing Debian-specific configuration..." + SPARSE=yes + ;; + FEDORA) + echo "Installing Fedora-specific configuration..." + ;; + REDHAT) + echo "Installing Redhat-specific configuration..." + ;; + SLACKWARE) + echo "Shorewall-init is currently not supported on Slackware" >&2 + exit 1 + ;; + ARCHLINUX) + echo "Shorewall-init is currently not supported on Arch Linux" >&2 + exit 1 + ;; + SUSE) + echo "Installing SuSE-specific configuration..." + ;; + LINUX) + echo "ERROR: Shorewall-init is not supported on this system" >&2 + ;; + *) + echo "ERROR: Unsupported TARGET distribution: \"$TARGET\"" >&2 + exit 1; + ;; +esac + if [ -n "$DESTDIR" ]; then if [ `id -u` != 0 ] ; then echo "Not setting file owner/group permissions, not running as root." @@ -156,31 +224,6 @@ if [ -n "$DESTDIR" ]; then fi install -d $OWNERSHIP -m 755 ${DESTDIR}${DEST} -elif [ -f /etc/debian_version ]; then - DEBIAN=yes -elif [ -f /etc/SuSE-release ]; then - SUSE=Yes -elif [ -f /etc/redhat-release ]; then - FEDORA=Yes -elif [ -f /etc/slackware-version ] ; then - echo "Shorewall-init is currently not supported on Slackware" >&2 - exit 1 -# DEST="/etc/rc.d" -# INIT="rc.firewall" -elif [ -f /etc/arch-release ] ; then - echo "Shorewall-init is currently not supported on Arch Linux" >&2 - exit 1 -# DEST="/etc/rc.d" -# INIT="shorewall-init" -# ARCHLINUX=yes -elif [ -d /etc/sysconfig/network-scripts/ ]; then - # - # Assume RedHat-based - # - REDHAT=Yes -else - echo "Unknown distribution: Shorewall-init support is not available" >&2 - exit 1 fi if [ -z "$DESTDIR" ]; then @@ -210,15 +253,17 @@ fi # # Install the Init Script # -if [ -n "$DEBIAN" ]; then - install_file init.debian.sh ${DESTDIR}/etc/init.d/shorewall-init 0544 -elif [ -n "$FEDORA" ]; then - install_file init.sh ${DESTDIR}/etc/init.d/shorewall-init 0544 -#elif [ -n "$ARCHLINUX" ]; then -# install_file init.archlinux.sh ${DESTDIR}${DEST}/$INIT 0544 -else - install_file init.sh ${DESTDIR}${DEST}/$INIT 0544 -fi +case $TARGET in + DEBIAN) + install_file init.debian.sh ${DESTDIR}/etc/init.d/shorewall-init 0544 + ;; + REDHAT|FEDORA) + 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" @@ -250,7 +295,7 @@ if [ -z "$DESTDIR" ]; then ln -s ${DEST}/${INIT} /usr/share/shorewall-init/init fi -if [ -n "$DEBIAN" ]; then +if [ $TARGET = DEBIAN ]; then if [ -n "${DESTDIR}" ]; then mkdir -p ${DESTDIR}/etc/network/if-up.d/ mkdir -p ${DESTDIR}/etc/network/if-post-down.d/ @@ -268,7 +313,7 @@ else mkdir -p ${DESTDIR}/etc/sysconfig if [ -z "$RPM" ]; then - if [ -n "$SUSE" ]; then + if [ $TARGET = SUSE ]; then mkdir -p ${DESTDIR}/etc/sysconfig/network/if-up.d mkdir -p ${DESTDIR}/etc/sysconfig/network/if-down.d else @@ -294,24 +339,30 @@ if [ -d ${DESTDIR}/etc/NetworkManager ]; then install_file ifupdown.sh ${DESTDIR}/etc/NetworkManager/dispatcher.d/01-shorewall 0544 fi -if [ -n "$DEBIAN" ]; then - install_file ifupdown.sh ${DESTDIR}/etc/network/if-up.d/shorewall 0544 - install_file ifupdown.sh ${DESTDIR}/etc/network/if-post-down.d/shorewall 0544 -elif [ -n "$SUSE" ]; then - install_file ifupdown.sh ${DESTDIR}/etc/sysconfig/network/if-up.d/shorewall 0544 - install_file ifupdown.sh ${DESTDIR}/etc/sysconfig/network/if-down.d/shorewall 0544 -elif [ -n "$REDHAT" ]; then - if [ -f ${DESTDIR}/sbin/ifup-local -o -f ${DESTDIR}/sbin/ifdown-local ]; then - echo "WARNING: /sbin/ifup-local and/or /sbin/ifdown-local already exist; up/down events will not be handled" - else - install_file ifupdown.sh ${DESTDIR}/sbin/ifup-local 0544 - install_file ifupdown.sh ${DESTDIR}/sbin/ifdown-local 0544 - fi -fi +case $TARGET in + DEBIAN) + install_file ifupdown.sh ${DESTDIR}/etc/network/if-up.d/shorewall 0544 + install_file ifupdown.sh ${DESTDIR}/etc/network/if-post-down.d/shorewall 0544 + ;; + SUSE) + if [ -z "$RPM" ]; then + install_file ifupdown.sh ${DESTDIR}/etc/sysconfig/network/if-up.d/shorewall 0544 + install_file ifupdown.sh ${DESTDIR}/etc/sysconfig/network/if-down.d/shorewall 0544 + fi + ;; + REDHAT) + if [ -f ${DESTDIR}/sbin/ifup-local -o -f ${DESTDIR}/sbin/ifdown-local ]; then + echo "WARNING: /sbin/ifup-local and/or /sbin/ifdown-local already exist; up/down events will not be handled" + else + install_file ifupdown.sh ${DESTDIR}/sbin/ifup-local 0544 + install_file ifupdown.sh ${DESTDIR}/sbin/ifdown-local 0544 + fi + ;; +esac if [ -z "$DESTDIR" ]; then if [ -n "$first_install" ]; then - if [ -n "$DEBIAN" ]; then + if [ $TARGET = DEBIAN ]; then update-rc.d shorewall-init defaults @@ -348,7 +399,7 @@ if [ -z "$DESTDIR" ]; then fi else if [ -n "$first_install" ]; then - if [ -n "$DEBIAN" ]; then + if [ $TARGET = DEBIAN ]; then if [ -n "${DESTDIR}" ]; then mkdir -p ${DESTDIR}/etc/rcS.d fi @@ -360,31 +411,33 @@ else fi if [ -f ${DESTDIR}/etc/ppp ]; then - if [ -n "$DEBIAN" ] -o -n "$SUSE" ]; then - for directory in ip-up.d ip-down.d ipv6-up.d ipv6-down.d; do - mkdir -p ${DESTDIR}/etc/ppp/$directory #SuSE doesn't create the IPv6 directories - cp -fp ${DESTDIR}${LIBEXEC}/shorewall-init/ifupdown ${DESTDIR}/etc/ppp/$directory/shorewall - done - elif [ -n "$REDHAT" ]; then - # - # Must use the dreaded ip_xxx.local file - # - for file in ip-up.local ip-down.local; do - FILE=${DESTDIR}/etc/ppp/$file - if [ -f $FILE ]; then - if fgrep -q Shorewall-based $FILE ; then - cp -fp ${DESTDIR}${LIBEXEC}/shorewall-init/ifupdown $FILE + case $TARGET in + DEBIAN|SUSE) + for directory in ip-up.d ip-down.d ipv6-up.d ipv6-down.d; do + mkdir -p ${DESTDIR}/etc/ppp/$directory #SuSE doesn't create the IPv6 directories + cp -fp ${DESTDIR}${LIBEXEC}/shorewall-init/ifupdown ${DESTDIR}/etc/ppp/$directory/shorewall + done + ;; + REDHAT) + # + # Must use the dreaded ip_xxx.local file + # + for file in ip-up.local ip-down.local; do + FILE=${DESTDIR}/etc/ppp/$file + if [ -f $FILE ]; then + if fgrep -q Shorewall-based $FILE ; then + cp -fp ${DESTDIR}${LIBEXEC}/shorewall-init/ifupdown $FILE + else + echo "$FILE already exists -- ppp devices will not be handled" + break + fi else - echo "$FILE already exists -- ppp devices will not be handled" - break + cp -fp ${DESTDIR}${LIBEXEC}/shorewall-init/ifupdown $FILE fi - else - cp -fp ${DESTDIR}${LIBEXEC}/shorewall-init/ifupdown $FILE - fi - done - fi + done + ;; + esac fi - # # Report Success # diff --git a/Shorewall-lite/install.sh b/Shorewall-lite/install.sh index 796b7929c..ddd0b8315 100755 --- a/Shorewall-lite/install.sh +++ b/Shorewall-lite/install.sh @@ -149,7 +149,31 @@ CYGWIN= INSTALLD='-D' T='-T' -case $(uname) in +if [ -n "INSTALLSYS" ]; then + case $(uname) in + CYGWIN*) + INSTALLSYS=CYGWIN + ;; + Darwin) + INSTALLSYS=MAC + ;; + *) + if [ -f /etc/debian_version ]; then + INSTALLSYS=DEBIAN + elif [ -f /etc/redhat-release ]; then + INSTALLSYS=FEDORA + elif [ -f /etc/slackware-version ] ; then + INSTALLSYS=SLACKWARE + elif [ -f /etc/arch-release ] ; then + INSTALLSYS=ARCHLINUX + else + INSTALLSYS=LINUX + fi + ;; + esac +fi + +case $INSTALLSYS in CYGWIN*) if [ -z "$DESTDIR" ]; then DEST= @@ -159,10 +183,18 @@ case $(uname) in OWNER=$(id -un) GROUP=$(id -gn) ;; - Darwin) + MAC) + if [ -z "$DESTDIR" ]; then + DEST= + INIT= + SPARSE=Yes + fi + + [ -z "$OWNER" ] && OWNER=root + [ -z "$GROUP" ] && GROUP=wheel INSTALLD= T= - ;; + ;; *) [ -z "$OWNER" ] && OWNER=root [ -z "$GROUP" ] && GROUP=root @@ -171,6 +203,41 @@ esac OWNERSHIP="-o $OWNER -g $GROUP" +[ -n "$TARGET" ] || TARGET=$INSTALLSYS + +case "$TARGET" in + CYGWIN) + echo "Installing Cygwin-specific configuration..." + ;; + MAC) + echo "Installing Mac-specific configuration..."; + ;; + DEBIAN) + echo "Installing Debian-specific configuration..." + SPARSE=yes + ;; + FEDORA) + echo "Installing Redhat/Fedora-specific configuration..." + ;; + SLACKWARE) + echo "Installing Slackware-specific configuration..." + DEST="/etc/rc.d" + MANDIR="/usr/man" + INIT="rc.firewall" + ;; + ARCHLINUX) + echo "Installing ArchLinux-specific configuration..." + DEST="/etc/rc.d" + INIT="$PRODUCT" + ;; + LINUX) + ;; + *) + echo "ERROR: Unknown TARGET \"$TARGET\"" >&2 + exit 1; + ;; +esac + if [ -n "$DESTDIR" ]; then if [ `id -u` != 0 ] ; then echo "Not setting file owner/group permissions, not running as root." @@ -179,20 +246,11 @@ if [ -n "$DESTDIR" ]; then install -d $OWNERSHIP -m 755 ${DESTDIR}/sbin install -d $OWNERSHIP -m 755 ${DESTDIR}${DEST} -elif [ -d /etc/apt -a -e /usr/bin/dpkg ]; then - DEBIAN=yes -elif [ -f /etc/redhat-release ]; then - FEDORA=yes -elif [ -f /etc/slackware-version ] ; then - DEST="/etc/rc.d" - INIT="rc.firewall" -elif [ -f /etc/arch-release ] ; then - DEST="/etc/rc.d" - INIT="$PRODUCT" - ARCHLINUX=yes -fi -if [ -z "$DESTDIR" ]; then + if [ -n "$SYSTEMD" ]; then + mkdir -p ${DESTDIR}/lib/systemd/system + fi +else if [ ! -f /usr/share/shorewall/coreversion ]; then echo "$PRODUCT $VERSION requires Shorewall Core which does not appear to be installed" >&2 exit 1 @@ -201,8 +259,6 @@ if [ -z "$DESTDIR" ]; then if [ -f /lib/systemd/system ]; then SYSTEMD=Yes fi -elif [ -n "$SYSTEMD" ]; then - mkdir -p ${DESTDIR}/lib/systemd/system fi echo "Installing $Product Version $VERSION" @@ -243,15 +299,20 @@ echo "$Product control program installed in ${DESTDIR}/sbin/$PRODUCT" # # Install the Firewall Script # -if [ -n "$DEBIAN" ]; then - install_file init.debian.sh ${DESTDIR}/etc/init.d/$PRODUCT 0544 -elif [ -n "$FEDORA" ]; then - install_file init.fedora.sh ${DESTDIR}/etc/init.d/$PRODUCT 0544 -elif [ -n "$ARCHLINUX" ]; then - install_file init.archlinux.sh ${DESTDIR}/${DEST}/$INIT 0544 -else - install_file init.sh ${DESTDIR}/${DEST}/$INIT 0544 -fi +case $TARGET in + DEBIAN) + install_file init.debian.sh ${DESTDIR}/etc/init.d/$PRODUCT 0544 + ;; + FEDORA) + 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" @@ -287,7 +348,7 @@ if [ ! -f ${DESTDIR}/etc/$PRODUCT/$PRODUCT.conf ]; then echo "Config file installed as ${DESTDIR}/etc/$PRODUCT/$PRODUCT.conf" fi -if [ -n "$ARCHLINUX" ] ; then +if [ $TARGET = ARCHLINUX ] ; then sed -e 's!LOGFILE=/var/log/messages!LOGFILE=/var/log/messages.log!' -i ${DESTDIR}/etc/$PRODUCT/$PRODUCT.conf fi @@ -398,7 +459,7 @@ if [ -z "$DESTDIR" ]; then touch /var/log/$PRODUCT-init.log if [ -n "$first_install" ]; then - if [ -n "$DEBIAN" ]; then + if [ $TARGET = DEBIAN ]; then run_install $OWNERSHIP -m 0644 default.debian /etc/default/$PRODUCT update-rc.d $PRODUCT defaults diff --git a/Shorewall/install.sh b/Shorewall/install.sh index f5506e750..b269f468e 100755 --- a/Shorewall/install.sh +++ b/Shorewall/install.sh @@ -119,9 +119,6 @@ if [ -z "$INIT" ] ; then fi ANNOTATED= -CYGWIN= -MAC= -MACHOST= MANDIR=${MANDIR:-"/usr/share/man"} SPARSE= INSTALLD='-D' @@ -144,7 +141,31 @@ case "$PERLLIB" in ;; esac -case $(uname) in +if [ -n "INSTALLSYS" ]; then + case $(uname) in + CYGWIN*) + INSTALLSYS=CYGWIN + ;; + Darwin) + INSTALLSYS=MAC + ;; + *) + if [ -f /etc/debian_version ]; then + INSTALLSYS=DEBIAN + elif [ -f /etc/redhat-release ]; then + INSTALLSYS=FEDORA + elif [ -f /etc/slackware-version ] ; then + INSTALLSYS=SLACKWARE + elif [ -f /etc/arch-release ] ; then + INSTALLSYS=ARCHLINUX + else + INSTALLSYS=LINUX + fi + ;; + esac +fi + +case $INSTALLSYS in CYGWIN*) if [ -z "$DESTDIR" ]; then DEST= @@ -153,10 +174,8 @@ case $(uname) in OWNER=$(id -un) GROUP=$(id -gn) - CYGWIN=Yes - SPARSE=Yes ;; - Darwin) + MAC) if [ -z "$DESTDIR" ]; then DEST= INIT= @@ -165,8 +184,6 @@ case $(uname) in [ -z "$OWNER" ] && OWNER=root [ -z "$GROUP" ] && GROUP=wheel - MAC=Yes - MACHOST=Yes INSTALLD= T= ;; @@ -229,8 +246,54 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin # Determine where to install the firewall script # +if [ $PRODUCT = shorewall ]; then + # + # Verify that Perl is installed + # + if ! perl -c Perl/compiler.pl; then + echo "ERROR: $Product $VERSION requires Perl which either is not installed or is not able to compile the $Product perl code" >&2 + echo " Try perl -c $PWD/Perl/compiler.pl" >&2 + exit 1 + fi +fi + +[ -n "$TARGET" ] || TARGET=$INSTALLSYS + +case "$TARGET" in + CYGWIN) + echo "Installing Cygwin-specific configuration..." + ;; + MAC) + echo "Installing Mac-specific configuration..."; + ;; + DEBIAN) + echo "Installing Debian-specific configuration..." + SPARSE=yes + ;; + FEDORA) + echo "Installing Redhat/Fedora-specific configuration..." + ;; + SLACKWARE) + echo "Installing Slackware-specific configuration..." + DEST="/etc/rc.d" + MANDIR="/usr/man" + INIT="rc.firewall" + ;; + ARCHLINUX) + echo "Installing ArchLinux-specific configuration..." + DEST="/etc/rc.d" + INIT="$PRODUCT" + ;; + LINUX) + ;; + *) + echo "ERROR: Unknown TARGET \"$TARGET\"" >&2 + exit 1; + ;; +esac + if [ -n "$DESTDIR" ]; then - if [ -z "$CYGWIN" ]; then + if [ $INSTALLSYS != CYGWIN ]; then if [ `id -u` != 0 ] ; then echo "Not setting file owner/group permissions, not running as root." OWNERSHIP="" @@ -239,49 +302,9 @@ if [ -n "$DESTDIR" ]; then install -d $OWNERSHIP -m 755 ${DESTDIR}/sbin install -d $OWNERSHIP -m 755 ${DESTDIR}${DEST} - - CYGWIN= - MAC= -else - if [ $PRODUCT = shorewall ]; then - # - # Verify that Perl is installed - # - if ! perl -c Perl/compiler.pl; then - echo "ERROR: $Product $VERSION requires Perl which either is not installed or is not able to compile the $Product perl code" >&2 - echo " Try perl -c $PWD/Perl/compiler.pl" >&2 - exit 1 - fi - else - [ -x /usr/share/shorewall/compiler.pl ] || \ - { echo " ERROR: Shorewall >= 4.3.5 is not installed" >&2; exit 1; } - fi - - if [ -n "$CYGWIN" ]; then - echo "Installing Cygwin-specific configuration..." - elif [ -n "$MAC" ]; then - echo "Installing Mac-specific configuration..." - else - if [ -f /etc/debian_version ]; then - echo "Installing Debian-specific configuration..." - DEBIAN=yes - SPARSE=yes - elif [ -f /etc/redhat-release ]; then - echo "Installing Redhat/Fedora-specific configuration..." - FEDORA=yes - elif [ -f /etc/slackware-version ] ; then - echo "Installing Slackware-specific configuration..." - DEST="/etc/rc.d" - MANDIR="/usr/man" - SLACKWARE=yes - INIT="rc.firewall" - elif [ -f /etc/arch-release ] ; then - echo "Installing ArchLinux-specific configuration..." - DEST="/etc/rc.d" - INIT="$PRODUCT" - ARCHLINUX=yes - fi - fi +elif [ -z "$DESTDIR" ]; then + [ -x /usr/share/shorewall/compiler.pl ] || \ + { echo " ERROR: Shorewall >= 4.3.5 is not installed" >&2; exit 1; } fi if [ -z "$DESTDIR" ]; then @@ -308,7 +331,7 @@ if [ -z "${DESTDIR}" -a $PRODUCT = shorewall -a ! -f /usr/share/$PRODUCT/corever exit 1 fi -if [ -z "$CYGWIN" ]; then +if [ $TARGET != CYGWIN ]; then install_file $PRODUCT ${DESTDIR}/sbin/$PRODUCT 0755 echo "$PRODUCT control program installed in ${DESTDIR}/sbin/$PRODUCT" else @@ -319,18 +342,28 @@ fi # # Install the Firewall Script # -if [ -n "$DEBIAN" ]; then - install_file init.debian.sh ${DESTDIR}/etc/init.d/$PRODUCT 0544 -elif [ -n "$FEDORA" ]; then - install_file init.fedora.sh ${DESTDIR}/etc/init.d/$PRODUCT 0544 -elif [ -n "$ARCHLINUX" ]; then - install_file init.archlinux.sh ${DESTDIR}${DEST}/$INIT 0544 -elif [ -n "$SLACKWARE" -a $PRODUCT = shorewall ]; then - install_file init.slackware.firewall.sh ${DESTDIR}${DEST}/rc.firewall 0644 - install_file init.slackware.$PRODUCT.sh ${DESTDIR}${DEST}/rc.$PRODUCT 0644 -elif [ -n "$INIT" ]; then - install_file init.sh ${DESTDIR}${DEST}/$INIT 0544 -fi +case $TARGET in + DEBIAN) + install_file init.debian.sh ${DESTDIR}/etc/init.d/$PRODUCT 0544 + ;; + FEDORA) + install_file init.fedora.sh ${DESTDIR}/etc/init.d/$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 + install_file init.slackware.$PRODUCT.sh ${DESTDIR}${DEST}/rc.$PRODUCT 0644 + fi + ;; + *) + if [ -n "$INIT" ]; then + install_file init.sh ${DESTDIR}${DEST}/$INIT 0544 + fi + ;; +esac [ -n "$INIT" ] && echo "$Product script installed in ${DESTDIR}${DEST}/$INIT" @@ -427,7 +460,7 @@ run_install $OWNERSHIP -m 0644 $PRODUCT.conf.annotated ${DESTDIR}/usr/share/$PRO if [ ! -f ${DESTDIR}/etc/$PRODUCT/$PRODUCT.conf ]; then run_install $OWNERSHIP -m 0644 $PRODUCT.conf${suffix} ${DESTDIR}/etc/$PRODUCT/$PRODUCT.conf - if [ -n "$DEBIAN" ] && mywhich perl; then + if [ $TARGET = DEBIAN ] && mywhich perl; then # # Make a Debian-like $PRODUCT.conf # @@ -438,7 +471,7 @@ if [ ! -f ${DESTDIR}/etc/$PRODUCT/$PRODUCT.conf ]; then fi -if [ -n "$ARCHLINUX" ] ; then +if [ $TARGET = ARCHLINUX ] ; then sed -e 's!LOGFILE=/var/log/messages!LOGFILE=/var/log/messages.log!' -i ${DESTDIR}/etc/$PRODUCT/$PRODUCT.conf fi @@ -1081,7 +1114,7 @@ if [ -d ${DESTDIR}/etc/logrotate.d ]; then fi if [ -z "$DESTDIR" -a -n "$first_install" -a -z "${CYGWIN}${MAC}" ]; then - if [ -n "$DEBIAN" ]; then + if [ $TARGET = DEBIAN ]; then run_install $OWNERSHIP -m 0644 default.debian /etc/default/$PRODUCT update-rc.d $PRODUCT defaults @@ -1117,7 +1150,7 @@ if [ -z "$DESTDIR" -a -n "$first_install" -a -z "${CYGWIN}${MAC}" ]; then else cant_autostart fi - elif [ "$INIT" != rc.firewall ]; then #Slackware starts this automatically + elif [ "$INIT" != rc.f ]; then #Slackware starts this automatically cant_autostart fi fi