2010-05-17 00:35:22 +02:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Script to install Shoreline Firewall Init
|
|
|
|
#
|
|
|
|
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
|
|
|
#
|
2011-05-23 19:06:56 +02:00
|
|
|
# (c) 2000-2011 - Tom Eastep (teastep@shorewall.net)
|
2010-05-23 23:10:50 +02:00
|
|
|
# (c) 2010 - Roberto C. Sanchez (roberto@connexer.com)
|
2010-05-17 00:35:22 +02:00
|
|
|
#
|
|
|
|
# Shorewall documentation is available at http://shorewall.net
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of Version 2 of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
#
|
|
|
|
|
2011-07-13 16:10:07 +02:00
|
|
|
VERSION=xxx #The Build script inserts the actual version.
|
2010-05-17 00:35:22 +02:00
|
|
|
|
|
|
|
usage() # $1 = exit status
|
|
|
|
{
|
|
|
|
ME=$(basename $0)
|
|
|
|
echo "usage: $ME"
|
|
|
|
echo " $ME -v"
|
|
|
|
echo " $ME -h"
|
|
|
|
exit $1
|
|
|
|
}
|
|
|
|
|
|
|
|
split() {
|
|
|
|
local ifs
|
|
|
|
ifs=$IFS
|
|
|
|
IFS=:
|
|
|
|
set -- $1
|
|
|
|
echo $*
|
|
|
|
IFS=$ifs
|
|
|
|
}
|
|
|
|
|
|
|
|
qt()
|
|
|
|
{
|
|
|
|
"$@" >/dev/null 2>&1
|
|
|
|
}
|
|
|
|
|
|
|
|
mywhich() {
|
|
|
|
local dir
|
|
|
|
|
|
|
|
for dir in $(split $PATH); do
|
|
|
|
if [ -x $dir/$1 ]; then
|
|
|
|
echo $dir/$1
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
return 2
|
|
|
|
}
|
|
|
|
|
|
|
|
run_install()
|
|
|
|
{
|
2010-05-24 00:34:42 +02:00
|
|
|
if ! install $*; then
|
2010-05-17 00:35:22 +02:00
|
|
|
echo
|
|
|
|
echo "ERROR: Failed to install $*" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
cant_autostart()
|
|
|
|
{
|
|
|
|
echo
|
|
|
|
echo "WARNING: Unable to configure shorewall init to start automatically at boot" >&2
|
|
|
|
}
|
|
|
|
|
|
|
|
delete_file() # $1 = file to delete
|
|
|
|
{
|
|
|
|
rm -f $1
|
|
|
|
}
|
|
|
|
|
|
|
|
install_file() # $1 = source $2 = target $3 = mode
|
|
|
|
{
|
2010-05-29 19:50:39 +02:00
|
|
|
run_install $T $OWNERSHIP -m $3 $1 ${2}
|
2010-05-17 00:35:22 +02:00
|
|
|
}
|
|
|
|
|
2012-02-23 19:07:02 +01:00
|
|
|
cd "$(dirname $0)"
|
|
|
|
|
|
|
|
#
|
|
|
|
# Load packager's settings if any
|
|
|
|
#
|
|
|
|
[ -f ../shorewall-pkg.config ] && . ../shorewall-pkg.config
|
|
|
|
|
2010-06-01 15:42:11 +02:00
|
|
|
[ -n "$DESTDIR" ] || DESTDIR="$PREFIX"
|
|
|
|
|
2010-05-17 00:35:22 +02:00
|
|
|
while [ $# -gt 0 ] ; do
|
|
|
|
case "$1" in
|
|
|
|
-h|help|?)
|
|
|
|
usage 0
|
|
|
|
;;
|
|
|
|
-v)
|
|
|
|
echo "Shorewall Init Installer Version $VERSION"
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
usage 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
|
|
|
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
|
|
|
|
|
2011-04-17 20:20:26 +02:00
|
|
|
[ -n "${LIBEXEC:=/usr/share}" ]
|
2011-05-14 14:31:19 +02:00
|
|
|
|
|
|
|
case "$LIBEXEC" in
|
|
|
|
/*)
|
|
|
|
;;
|
|
|
|
*)
|
2012-02-21 01:11:28 +01:00
|
|
|
echo "The LIBEXEC setting must be an absolute path name" >&2
|
|
|
|
exit 1
|
2011-05-14 14:31:19 +02:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2012-02-21 21:34:41 +01:00
|
|
|
INITFILE="shorewall-init"
|
|
|
|
|
2012-02-22 22:32:10 +01:00
|
|
|
if [ -z "$BUILD" ]; then
|
2012-02-17 22:22:06 +01:00
|
|
|
case $(uname) in
|
2012-02-22 22:32:10 +01:00
|
|
|
cygwin*)
|
|
|
|
BUILD=cygwin
|
2012-02-17 22:22:06 +01:00
|
|
|
;;
|
|
|
|
Darwin)
|
2012-02-22 22:32:10 +01:00
|
|
|
BUILD=apple
|
2012-02-17 22:22:06 +01:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
if [ -f /etc/debian_version ]; then
|
2012-02-22 22:32:10 +01:00
|
|
|
BUILD=debian
|
2012-02-17 22:22:06 +01:00
|
|
|
elif [ -f /etc/redhat-release ]; then
|
2012-02-22 22:32:10 +01:00
|
|
|
BUILD=redhat
|
2012-02-18 00:26:02 +01:00
|
|
|
elif [ -f /etc/SuSE-release ]; then
|
2012-02-22 22:32:10 +01:00
|
|
|
BUILD=suse
|
2012-02-17 22:22:06 +01:00
|
|
|
elif [ -f /etc/slackware-version ] ; then
|
2012-02-22 22:32:10 +01:00
|
|
|
BUILD=slackware
|
2012-02-17 22:22:06 +01:00
|
|
|
elif [ -f /etc/arch-release ] ; then
|
2012-02-22 22:32:10 +01:00
|
|
|
BUILD=archlinux
|
2012-02-17 22:22:06 +01:00
|
|
|
else
|
2012-02-22 22:32:10 +01:00
|
|
|
BUILD=linux
|
2012-02-17 22:22:06 +01:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
2012-02-22 22:32:10 +01:00
|
|
|
[ -n "$OWNER" ] || OWNER=$(id -un)
|
|
|
|
[ -n "$GROUP" ] || GROUP=$(id -gn)
|
|
|
|
|
|
|
|
case $BUILD in
|
|
|
|
apple)
|
2010-05-29 19:50:39 +02:00
|
|
|
T=
|
2012-02-17 22:22:06 +01:00
|
|
|
;;
|
2012-02-22 22:32:10 +01:00
|
|
|
debian|redhat|suse|slackware|archlinux)
|
|
|
|
;;
|
2010-05-17 00:35:22 +02:00
|
|
|
*)
|
2012-02-22 22:32:10 +01:00
|
|
|
[ -n "$BUILD" ] && echo "ERROR: Unknown BUILD environment ($BUILD)" >&2 || echo "ERROR: Unknown BUILD environment"
|
|
|
|
exit 1
|
2010-05-17 00:35:22 +02:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
OWNERSHIP="-o $OWNER -g $GROUP"
|
|
|
|
|
2012-02-22 22:32:10 +01:00
|
|
|
[ -n "$HOST" ] || HOST=$BUILD
|
2012-02-17 22:22:06 +01:00
|
|
|
|
2012-02-22 22:32:10 +01:00
|
|
|
case "$HOST" in
|
|
|
|
debian)
|
2012-02-17 22:22:06 +01:00
|
|
|
echo "Installing Debian-specific configuration..."
|
|
|
|
SPARSE=yes
|
|
|
|
;;
|
2012-02-22 22:32:10 +01:00
|
|
|
redhat|redhat)
|
2012-02-21 01:11:28 +01:00
|
|
|
echo "Installing Redhat/Fedora-specific configuration..."
|
2012-02-22 22:32:10 +01:00
|
|
|
[ -n "$INITDIR" ] || INITDIR=/etc/rc.d/init.d
|
2012-02-17 22:22:06 +01:00
|
|
|
;;
|
2012-02-22 22:32:10 +01:00
|
|
|
slackware)
|
2012-02-17 22:22:06 +01:00
|
|
|
echo "Shorewall-init is currently not supported on Slackware" >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
2012-02-22 22:32:10 +01:00
|
|
|
archlinux)
|
2012-02-17 22:22:06 +01:00
|
|
|
echo "Shorewall-init is currently not supported on Arch Linux" >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
2012-02-22 22:32:10 +01:00
|
|
|
suse|suse)
|
2012-02-17 22:22:06 +01:00
|
|
|
echo "Installing SuSE-specific configuration..."
|
|
|
|
;;
|
2012-02-22 22:32:10 +01:00
|
|
|
linux)
|
2012-02-17 22:22:06 +01:00
|
|
|
echo "ERROR: Shorewall-init is not supported on this system" >&2
|
|
|
|
;;
|
|
|
|
*)
|
2012-02-22 22:32:10 +01:00
|
|
|
echo "ERROR: Unsupported HOST distribution: \"$HOST\"" >&2
|
2012-02-17 22:22:06 +01:00
|
|
|
exit 1;
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2012-02-29 17:39:27 +01:00
|
|
|
[ -z "$TARGET" ] && TARGET=$HOST
|
|
|
|
|
2012-02-21 21:34:41 +01:00
|
|
|
if [ -z "$INITDIR" -a -n "$INITFILE" ] ; then
|
|
|
|
INITDIR="/etc/init.d"
|
2012-02-20 19:08:42 +01:00
|
|
|
fi
|
|
|
|
|
2010-06-01 15:42:11 +02:00
|
|
|
if [ -n "$DESTDIR" ]; then
|
2010-05-17 00:35:22 +02:00
|
|
|
if [ `id -u` != 0 ] ; then
|
|
|
|
echo "Not setting file owner/group permissions, not running as root."
|
|
|
|
OWNERSHIP=""
|
|
|
|
fi
|
|
|
|
|
2012-02-21 21:34:41 +01:00
|
|
|
install -d $OWNERSHIP -m 755 ${DESTDIR}${INITDIR}
|
2010-05-17 00:35:22 +02:00
|
|
|
fi
|
|
|
|
|
2011-08-23 23:07:44 +02:00
|
|
|
if [ -z "$DESTDIR" ]; then
|
2012-02-29 17:39:27 +01:00
|
|
|
if [ -d /lib/systemd/system ]; then
|
2011-08-23 23:07:44 +02:00
|
|
|
SYSTEMD=Yes
|
2012-02-23 19:59:10 +01:00
|
|
|
INITFILE=
|
2011-08-23 23:07:44 +02:00
|
|
|
fi
|
|
|
|
elif [ -n "$SYSTEMD" ]; then
|
|
|
|
mkdir -p ${DESTDIR}/lib/systemd/system
|
2012-02-23 19:59:10 +01:00
|
|
|
INITFILE=
|
2011-08-23 23:07:44 +02:00
|
|
|
fi
|
|
|
|
|
2010-05-17 00:35:22 +02:00
|
|
|
echo "Installing Shorewall Init Version $VERSION"
|
|
|
|
|
|
|
|
#
|
|
|
|
# Check for /usr/share/shorewall-init/version
|
|
|
|
#
|
2010-06-01 15:42:11 +02:00
|
|
|
if [ -f ${DESTDIR}/usr/share/shorewall-init/version ]; then
|
2010-05-17 00:35:22 +02:00
|
|
|
first_install=""
|
|
|
|
else
|
|
|
|
first_install="Yes"
|
|
|
|
fi
|
|
|
|
|
2012-02-23 19:59:10 +01:00
|
|
|
if [ -n "$INITFILE" ]; then
|
|
|
|
#
|
|
|
|
# Install the Init Script
|
|
|
|
#
|
|
|
|
case $TARGET in
|
|
|
|
debian)
|
|
|
|
install_file init.debian.sh ${DESTDIR}${INITDIR}/${INITFILE} 0544
|
|
|
|
;;
|
|
|
|
redhat)
|
|
|
|
install_file init.fedora.sh ${DESTDIR}${INITDIR}/${INITFILE} 0544
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
install_file init.sh ${DESTDIR}${INITDIR}/${INITFILE} 0544
|
|
|
|
;;
|
|
|
|
esac
|
2010-05-17 00:35:22 +02:00
|
|
|
|
2012-03-01 16:21:17 +01:00
|
|
|
echo "Shorewall-init script installed in ${DESTDIR}${INITDIR}/${INITFILE}"
|
2012-02-23 19:59:10 +01:00
|
|
|
fi
|
2011-08-23 23:07:44 +02:00
|
|
|
#
|
|
|
|
# Install the .service file
|
|
|
|
#
|
|
|
|
if [ -n "$SYSTEMD" ]; then
|
|
|
|
run_install $OWNERSHIP -m 600 shorewall-init.service ${DESTDIR}/lib/systemd/system/shorewall-init.service
|
|
|
|
echo "Service file installed as ${DESTDIR}/lib/systemd/system/shorewall-init.service"
|
2012-02-29 17:39:27 +01:00
|
|
|
if [ -n "$DESTDIR" ]; then
|
|
|
|
mkdir -p ${DESTDIR}/sbin/
|
|
|
|
chmod 755 ${DESTDIR}/sbin
|
|
|
|
fi
|
|
|
|
run_install $OWNERSHIP -m 700 shorewall-init ${DESTDIR}/sbin/shorewall-init
|
2012-03-01 16:21:17 +01:00
|
|
|
echo "CLI installed as ${DESTDIR}/sbin/shorewall-init"
|
2011-08-23 23:07:44 +02:00
|
|
|
fi
|
|
|
|
|
2010-05-17 00:35:22 +02:00
|
|
|
#
|
|
|
|
# Create /usr/share/shorewall-init if needed
|
|
|
|
#
|
2010-06-01 15:42:11 +02:00
|
|
|
mkdir -p ${DESTDIR}/usr/share/shorewall-init
|
|
|
|
chmod 755 ${DESTDIR}/usr/share/shorewall-init
|
2010-05-17 00:35:22 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# Create the version file
|
|
|
|
#
|
2010-06-01 15:42:11 +02:00
|
|
|
echo "$VERSION" > ${DESTDIR}/usr/share/shorewall-init/version
|
|
|
|
chmod 644 ${DESTDIR}/usr/share/shorewall-init/version
|
2010-05-17 00:35:22 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# Remove and create the symbolic link to the init script
|
|
|
|
#
|
2010-06-01 15:42:11 +02:00
|
|
|
if [ -z "$DESTDIR" ]; then
|
2010-05-17 00:35:22 +02:00
|
|
|
rm -f /usr/share/shorewall-init/init
|
2012-02-21 21:34:41 +01:00
|
|
|
ln -s ${INITDIR}/${INITFILE} /usr/share/shorewall-init/init
|
2010-05-17 00:35:22 +02:00
|
|
|
fi
|
|
|
|
|
2012-02-22 22:32:10 +01:00
|
|
|
if [ $HOST = debian ]; then
|
2010-06-01 15:42:11 +02:00
|
|
|
if [ -n "${DESTDIR}" ]; then
|
|
|
|
mkdir -p ${DESTDIR}/etc/network/if-up.d/
|
|
|
|
mkdir -p ${DESTDIR}/etc/network/if-post-down.d/
|
2010-05-24 00:34:42 +02:00
|
|
|
fi
|
|
|
|
|
2010-06-01 15:42:11 +02:00
|
|
|
if [ ! -f ${DESTDIR}/etc/default/shorewall-init ]; then
|
|
|
|
if [ -n "${DESTDIR}" ]; then
|
|
|
|
mkdir ${DESTDIR}/etc/default
|
2010-05-24 00:34:42 +02:00
|
|
|
fi
|
|
|
|
|
2010-06-01 15:42:11 +02:00
|
|
|
install_file sysconfig ${DESTDIR}/etc/default/shorewall-init 0644
|
2010-05-19 00:30:53 +02:00
|
|
|
fi
|
|
|
|
else
|
2010-06-01 15:42:11 +02:00
|
|
|
if [ -n "$DESTDIR" ]; then
|
|
|
|
mkdir -p ${DESTDIR}/etc/sysconfig
|
2010-05-24 00:34:42 +02:00
|
|
|
|
2010-05-27 15:49:49 +02:00
|
|
|
if [ -z "$RPM" ]; then
|
2012-02-22 22:32:10 +01:00
|
|
|
if [ $HOST = suse ]; then
|
2010-06-01 15:42:11 +02:00
|
|
|
mkdir -p ${DESTDIR}/etc/sysconfig/network/if-up.d
|
|
|
|
mkdir -p ${DESTDIR}/etc/sysconfig/network/if-down.d
|
2010-05-27 15:49:49 +02:00
|
|
|
else
|
2010-06-01 15:42:11 +02:00
|
|
|
mkdir -p ${DESTDIR}/etc/NetworkManager/dispatcher.d
|
2010-05-27 15:49:49 +02:00
|
|
|
fi
|
2010-05-24 00:34:42 +02:00
|
|
|
fi
|
2010-05-17 00:35:22 +02:00
|
|
|
fi
|
|
|
|
|
2010-06-01 15:42:11 +02:00
|
|
|
if [ -d ${DESTDIR}/etc/sysconfig -a ! -f ${DESTDIR}/etc/sysconfig/shorewall-init ]; then
|
|
|
|
install_file sysconfig ${DESTDIR}/etc/sysconfig/shorewall-init 0644
|
2010-05-17 00:35:22 +02:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2010-05-23 21:53:56 +02:00
|
|
|
#
|
|
|
|
# Install the ifupdown script
|
|
|
|
#
|
2010-05-24 00:34:42 +02:00
|
|
|
|
2011-04-17 20:20:26 +02:00
|
|
|
mkdir -p ${DESTDIR}${LIBEXEC}/shorewall-init
|
2010-05-27 01:45:09 +02:00
|
|
|
|
2011-04-17 20:20:26 +02:00
|
|
|
install_file ifupdown.sh ${DESTDIR}${LIBEXEC}/shorewall-init/ifupdown 0544
|
2010-05-23 21:53:56 +02:00
|
|
|
|
2010-06-01 15:42:11 +02:00
|
|
|
if [ -d ${DESTDIR}/etc/NetworkManager ]; then
|
|
|
|
install_file ifupdown.sh ${DESTDIR}/etc/NetworkManager/dispatcher.d/01-shorewall 0544
|
2010-05-23 21:53:56 +02:00
|
|
|
fi
|
|
|
|
|
2012-02-22 22:32:10 +01:00
|
|
|
case $HOST in
|
|
|
|
debian)
|
2012-02-17 22:22:06 +01:00
|
|
|
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
|
|
|
|
;;
|
2012-02-22 22:32:10 +01:00
|
|
|
suse)
|
2012-02-17 22:22:06 +01:00
|
|
|
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
|
|
|
|
;;
|
2012-02-22 22:32:10 +01:00
|
|
|
redhat)
|
2012-02-17 22:22:06 +01:00
|
|
|
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"
|
2012-02-22 22:32:10 +01:00
|
|
|
elif [ -z "$DESTDIR" ]; then
|
2012-02-17 22:22:06 +01:00
|
|
|
install_file ifupdown.sh ${DESTDIR}/sbin/ifup-local 0544
|
|
|
|
install_file ifupdown.sh ${DESTDIR}/sbin/ifdown-local 0544
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
2010-05-23 23:44:35 +02:00
|
|
|
|
2010-06-01 15:42:11 +02:00
|
|
|
if [ -z "$DESTDIR" ]; then
|
2010-05-17 00:35:22 +02:00
|
|
|
if [ -n "$first_install" ]; then
|
2012-02-22 22:32:10 +01:00
|
|
|
if [ $HOST = debian ]; then
|
2010-10-13 17:42:35 +02:00
|
|
|
|
|
|
|
update-rc.d shorewall-init defaults
|
2010-06-25 20:14:55 +02:00
|
|
|
|
2010-05-17 00:35:22 +02:00
|
|
|
echo "Shorewall Init will start automatically at boot"
|
|
|
|
else
|
2011-08-23 23:07:44 +02:00
|
|
|
if [ -n "$SYSTEMD" ]; then
|
|
|
|
if systemctl enable shorewall-init; then
|
|
|
|
echo "Shorewall Init will start automatically at boot"
|
|
|
|
fi
|
|
|
|
elif [ -x /sbin/insserv -o -x /usr/sbin/insserv ]; then
|
2010-05-17 00:35:22 +02:00
|
|
|
if insserv /etc/init.d/shorewall-init ; then
|
|
|
|
echo "Shorewall Init will start automatically at boot"
|
|
|
|
else
|
|
|
|
cant_autostart
|
|
|
|
fi
|
|
|
|
elif [ -x /sbin/chkconfig -o -x /usr/sbin/chkconfig ]; then
|
|
|
|
if chkconfig --add shorewall-init ; then
|
|
|
|
echo "Shorewall Init will start automatically in run levels as follows:"
|
|
|
|
chkconfig --list shorewall-init
|
|
|
|
else
|
|
|
|
cant_autostart
|
|
|
|
fi
|
|
|
|
elif [ -x /sbin/rc-update ]; then
|
|
|
|
if rc-update add shorewall-init default; then
|
|
|
|
echo "Shorewall Init will start automatically at boot"
|
|
|
|
else
|
|
|
|
cant_autostart
|
|
|
|
fi
|
2012-02-21 21:34:41 +01:00
|
|
|
else
|
2010-05-17 00:35:22 +02:00
|
|
|
cant_autostart
|
|
|
|
fi
|
2010-12-05 18:11:08 +01:00
|
|
|
|
2010-12-05 01:01:16 +01:00
|
|
|
fi
|
2010-05-17 00:35:22 +02:00
|
|
|
fi
|
2010-05-23 23:10:50 +02:00
|
|
|
else
|
|
|
|
if [ -n "$first_install" ]; then
|
2012-02-22 22:32:10 +01:00
|
|
|
if [ $HOST = debian ]; then
|
2010-06-01 15:42:11 +02:00
|
|
|
if [ -n "${DESTDIR}" ]; then
|
|
|
|
mkdir -p ${DESTDIR}/etc/rcS.d
|
2010-05-24 00:34:42 +02:00
|
|
|
fi
|
|
|
|
|
2010-06-25 20:14:55 +02:00
|
|
|
ln -sf ../init.d/shorewall-init ${DESTDIR}/etc/rcS.d/S38shorewall-init
|
2010-05-23 23:10:50 +02:00
|
|
|
echo "Shorewall Init will start automatically at boot"
|
|
|
|
fi
|
|
|
|
fi
|
2010-12-05 18:11:08 +01:00
|
|
|
fi
|
2010-12-04 21:06:05 +01:00
|
|
|
|
2010-12-05 18:11:08 +01:00
|
|
|
if [ -f ${DESTDIR}/etc/ppp ]; then
|
2012-02-22 22:32:10 +01:00
|
|
|
case $HOST in
|
|
|
|
debian|suse)
|
2012-02-17 22:22:06 +01:00
|
|
|
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
|
|
|
|
;;
|
2012-02-22 22:32:10 +01:00
|
|
|
redhat)
|
2012-02-17 22:22:06 +01:00
|
|
|
#
|
|
|
|
# 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
|
2010-12-05 18:11:08 +01:00
|
|
|
else
|
2012-02-17 22:22:06 +01:00
|
|
|
cp -fp ${DESTDIR}${LIBEXEC}/shorewall-init/ifupdown $FILE
|
2010-12-05 18:11:08 +01:00
|
|
|
fi
|
2012-02-17 22:22:06 +01:00
|
|
|
done
|
|
|
|
;;
|
|
|
|
esac
|
2010-05-17 00:35:22 +02:00
|
|
|
fi
|
|
|
|
#
|
|
|
|
# Report Success
|
|
|
|
#
|
|
|
|
echo "shorewall Init Version $VERSION Installed"
|