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)
|
2012-03-25 16:49:52 +02:00
|
|
|
echo "usage: $ME [ <configuration-file> ]"
|
2010-05-17 00:35:22 +02:00
|
|
|
echo " $ME -v"
|
|
|
|
echo " $ME -h"
|
|
|
|
exit $1
|
|
|
|
}
|
|
|
|
|
2012-03-24 21:05:39 +01:00
|
|
|
fatal_error()
|
|
|
|
{
|
|
|
|
echo " ERROR: $@" >&2
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2010-05-17 00:35:22 +02:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2012-03-24 21:05:39 +01:00
|
|
|
require()
|
2010-05-17 00:35:22 +02:00
|
|
|
{
|
2012-03-24 21:05:39 +01:00
|
|
|
eval [ -n "\$$1" ] || fatal_error "Required option $1 not set"
|
2010-05-17 00:35:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
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)"
|
|
|
|
|
2012-03-24 21:05:39 +01:00
|
|
|
PRODUCT=shorewall-init
|
|
|
|
|
2012-02-23 19:07:02 +01:00
|
|
|
#
|
2012-03-24 21:05:39 +01:00
|
|
|
# Parse the run line
|
2012-02-23 19:07:02 +01:00
|
|
|
#
|
2012-03-24 21:05:39 +01:00
|
|
|
finished=0
|
2010-06-01 15:42:11 +02:00
|
|
|
|
2012-03-24 21:05:39 +01:00
|
|
|
while [ $finished -eq 0 ] ; do
|
2010-05-17 00:35:22 +02:00
|
|
|
case "$1" in
|
2012-03-24 21:05:39 +01:00
|
|
|
-*)
|
|
|
|
option=${option#-}
|
|
|
|
|
|
|
|
while [ -n "$option" ]; do
|
|
|
|
case $option in
|
|
|
|
h)
|
|
|
|
usage 0
|
|
|
|
;;
|
|
|
|
v)
|
|
|
|
echo "Shorewall-init Firewall Installer Version $VERSION"
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
usage 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
shift
|
2010-05-17 00:35:22 +02:00
|
|
|
;;
|
|
|
|
*)
|
2012-03-24 21:05:39 +01:00
|
|
|
finished=1
|
2010-05-17 00:35:22 +02:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2012-03-24 21:05:39 +01:00
|
|
|
#
|
|
|
|
# Read the RC file
|
|
|
|
#
|
|
|
|
if [ $# -eq 0 ]; then
|
|
|
|
#
|
|
|
|
# Load packager's settings if any
|
|
|
|
#
|
2012-04-01 02:40:18 +02:00
|
|
|
if [ -f ./shorewallrc ]; then
|
|
|
|
. ./shorewallrc || exit 1
|
2012-03-24 21:05:39 +01:00
|
|
|
file=~/.shorewallrc
|
2012-04-01 02:40:18 +02:00
|
|
|
elif [ -f ~/.shorewallrc ]; then
|
|
|
|
. ~/.shorewallrc || exit 1
|
2012-03-31 23:42:01 +02:00
|
|
|
file=./.shorewallrc
|
|
|
|
else
|
2012-03-25 16:49:52 +02:00
|
|
|
fatal_error "No configuration file specified and ~/.shorewallrc not found"
|
2012-03-24 21:05:39 +01:00
|
|
|
fi
|
|
|
|
elif [ $# -eq 1 ]; then
|
|
|
|
file=$1
|
|
|
|
case $file in
|
|
|
|
/*|.*)
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
file=./$file
|
|
|
|
;;
|
|
|
|
esac
|
2010-05-17 00:35:22 +02:00
|
|
|
|
2012-03-24 21:05:39 +01:00
|
|
|
. $file
|
|
|
|
else
|
|
|
|
usage 1
|
|
|
|
fi
|
2011-05-14 14:31:19 +02:00
|
|
|
|
2012-03-24 21:05:39 +01:00
|
|
|
for var in SHAREDIR LIBEXECDIR CONFDIR SBINDIR VARDIR; do
|
|
|
|
require $var
|
|
|
|
done
|
2011-05-14 14:31:19 +02:00
|
|
|
|
2012-03-24 21:05:39 +01:00
|
|
|
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/local/sbin
|
2012-02-21 21:34:41 +01:00
|
|
|
|
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..."
|
|
|
|
;;
|
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-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
|
|
|
|
|
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
|
|
|
|
|
|
|
|
echo "Installing Shorewall Init Version $VERSION"
|
|
|
|
|
|
|
|
#
|
|
|
|
# Check for /usr/share/shorewall-init/version
|
|
|
|
#
|
2012-03-24 21:05:39 +01:00
|
|
|
if [ -f ${DESTDIR}${SHAREDIR}/shorewall-init/version ]; then
|
2010-05-17 00:35:22 +02:00
|
|
|
first_install=""
|
|
|
|
else
|
|
|
|
first_install="Yes"
|
|
|
|
fi
|
|
|
|
|
2012-03-24 21:05:39 +01:00
|
|
|
#
|
|
|
|
# Install the Firewall Script
|
|
|
|
#
|
2012-02-23 19:59:10 +01:00
|
|
|
if [ -n "$INITFILE" ]; then
|
2012-03-24 21:05:39 +01:00
|
|
|
install_file $INITSOURCE ${DESTDIR}${INITDIR}/$INITFILE 0544
|
2012-04-01 19:47:24 +02:00
|
|
|
[ "${SHAREDIR}" = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${INITDIR}/$INITFILE
|
2012-03-24 21:05:39 +01:00
|
|
|
|
|
|
|
if [ -n "${AUXINITSOURCE}" ]; then
|
|
|
|
install_file $INITSOURCE ${DESTDIR}${INITDIR}/$AUXINITFILE 0544
|
|
|
|
fi
|
2010-05-17 00:35:22 +02:00
|
|
|
|
2012-03-24 21:05:39 +01:00
|
|
|
echo "Shorewall-init script installed in ${DESTDIR}${INITDIR}/$INITFILE"
|
2012-02-23 19:59:10 +01:00
|
|
|
fi
|
2012-03-24 21:05:39 +01:00
|
|
|
|
2011-08-23 23:07:44 +02:00
|
|
|
#
|
|
|
|
# Install the .service file
|
|
|
|
#
|
|
|
|
if [ -n "$SYSTEMD" ]; then
|
2012-03-30 22:56:59 +02:00
|
|
|
mkdir -p ${DESTDIR}${SYSTEMD}
|
2012-03-24 21:05:39 +01:00
|
|
|
run_install $OWNERSHIP -m 600 shorewall-init.service ${DESTDIR}${SYSTEMD}/shorewall-init.service
|
|
|
|
echo "Service file installed as ${DESTDIR}${SYSTEMD}/shorewall-init.service"
|
2012-02-29 17:39:27 +01:00
|
|
|
if [ -n "$DESTDIR" ]; then
|
2012-03-24 21:05:39 +01:00
|
|
|
mkdir -p ${DESTDIR}${SBINDIR}
|
|
|
|
chmod 755 ${DESTDIR}${SBINDIR}
|
2012-02-29 17:39:27 +01:00
|
|
|
fi
|
2012-03-24 21:05:39 +01:00
|
|
|
run_install $OWNERSHIP -m 700 shorewall-init ${DESTDIR}${SBINDIR}/shorewall-init
|
|
|
|
echo "CLI installed as ${DESTDIR}${SBINDIR}/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-03-24 21:05:39 +01:00
|
|
|
ln -s ${INITDIR}/${INITFILE} ${SHAREDIR}/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/
|
2012-06-01 20:56:48 +02:00
|
|
|
mkdir -p ${DESTDIR}/etc/network/if-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
|
2012-03-31 23:42:01 +02:00
|
|
|
mkdir -p ${DESTDIR}${SYSCONFDIR}
|
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
|
2012-03-31 23:42:01 +02:00
|
|
|
mkdir -p ${DESTDIR}${SYSCONFDIR}/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
|
|
|
|
|
2012-03-31 23:42:01 +02:00
|
|
|
if [ -d ${DESTDIR}${SYSCONFDIR} -a ! -f ${DESTDIR}${SYSCONFDIR}/shorewall-init ]; then
|
|
|
|
install_file sysconfig ${DESTDIR}${SYSCONFDIR}/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
|
|
|
|
2012-03-31 23:42:01 +02:00
|
|
|
cp ifupdown.sh ifupdown
|
|
|
|
|
2012-06-01 17:10:41 +02:00
|
|
|
[ "${SHAREDIR}" = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ifupdown
|
2012-03-31 23:42:01 +02:00
|
|
|
|
2012-03-24 21:05:39 +01:00
|
|
|
mkdir -p ${DESTDIR}${LIBEXECDIR}/shorewall-init
|
2010-05-27 01:45:09 +02:00
|
|
|
|
2012-03-31 23:42:01 +02:00
|
|
|
install_file ifupdown ${DESTDIR}${LIBEXECDIR}/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
|
2012-03-31 23:42:01 +02:00
|
|
|
install_file ifupdown ${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-03-31 23:42:01 +02:00
|
|
|
install_file ifupdown ${DESTDIR}/etc/network/if-up.d/shorewall 0544
|
2012-06-01 20:56:48 +02:00
|
|
|
install_file ifupdown ${DESTDIR}/etc/network/if-down.d/shorewall 0544
|
2012-06-02 18:25:20 +02:00
|
|
|
install_file ifupdown ${DESTDIR}/etc/network/if-post-down.d/shorewall 0544
|
2012-02-17 22:22:06 +01:00
|
|
|
;;
|
2012-02-22 22:32:10 +01:00
|
|
|
suse)
|
2012-02-17 22:22:06 +01:00
|
|
|
if [ -z "$RPM" ]; then
|
2012-03-31 23:42:01 +02:00
|
|
|
install_file ifupdown ${DESTDIR}${SYSCONFDIR}/network/if-up.d/shorewall 0544
|
|
|
|
install_file ifupdown ${DESTDIR}${SYSCONFDIR}/network/if-down.d/shorewall 0544
|
2012-02-17 22:22:06 +01:00
|
|
|
fi
|
|
|
|
;;
|
2012-02-22 22:32:10 +01:00
|
|
|
redhat)
|
2012-03-24 21:05:39 +01:00
|
|
|
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"
|
2012-02-22 22:32:10 +01:00
|
|
|
elif [ -z "$DESTDIR" ]; then
|
2012-03-31 23:42:01 +02:00
|
|
|
install_file ifupdown ${DESTDIR}${SBINDIR}/ifup-local 0544
|
|
|
|
install_file ifupdown ${DESTDIR}${SBINDIR}/ifdown-local 0544
|
2012-02-17 22:22:06 +01:00
|
|
|
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
|
|
|
|
2012-06-01 04:15:23 +02:00
|
|
|
update-rc.d shorewall-init enable
|
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
|
2012-03-24 21:05:39 +01:00
|
|
|
elif [ -x ${SBINDIR}/insserv -o -x /usr${SBINDIR}/insserv ]; then
|
2012-03-31 23:42:01 +02:00
|
|
|
if insserv ${INITDIR}/shorewall-init ; then
|
2010-05-17 00:35:22 +02:00
|
|
|
echo "Shorewall Init will start automatically at boot"
|
|
|
|
else
|
|
|
|
cant_autostart
|
|
|
|
fi
|
2012-03-24 21:05:39 +01:00
|
|
|
elif [ -x ${SBINDIR}/chkconfig -o -x /usr${SBINDIR}/chkconfig ]; then
|
2010-05-17 00:35:22 +02:00
|
|
|
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
|
2012-03-24 21:05:39 +01:00
|
|
|
elif [ -x ${SBINDIR}/rc-update ]; then
|
2010-05-17 00:35:22 +02:00
|
|
|
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 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
|
|
|
|
|
2012-03-31 23:42:01 +02:00
|
|
|
ln -sf ../init.d/shorewall-init ${DESTDIR}${CONFDIR}/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
|
|
|
|
2012-03-30 21:02:25 +02:00
|
|
|
[ -z "${DESTDIR}" ] && [ ! -f ~/.shorewallrc ] && cp ${SHAREDIR}/shorewall/shorewallrc .
|
|
|
|
|
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
|
2012-03-31 23:42:01 +02:00
|
|
|
cp -fp ${DESTDIR}${LIBEXECDIR}/shorewall-init/ifupdown ${DESTDIR}${CONFDIR}/ppp/$directory/shorewall
|
2012-02-17 22:22:06 +01:00
|
|
|
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
|
2012-03-24 21:05:39 +01:00
|
|
|
cp -fp ${DESTDIR}${LIBEXECDIR}/shorewall-init/ifupdown $FILE
|
2012-02-17 22:22:06 +01:00
|
|
|
else
|
|
|
|
echo "$FILE already exists -- ppp devices will not be handled"
|
|
|
|
break
|
|
|
|
fi
|
2010-12-05 18:11:08 +01:00
|
|
|
else
|
2012-03-24 21:05:39 +01:00
|
|
|
cp -fp ${DESTDIR}${LIBEXECDIR}/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"
|