2009-11-04 15:58:49 +01:00
|
|
|
#!/bin/sh
|
2006-06-03 17:16:21 +02:00
|
|
|
#
|
2006-06-05 21:19:35 +02:00
|
|
|
# Script to install Shoreline Firewall Lite
|
2006-06-03 17:16:21 +02:00
|
|
|
#
|
2007-09-08 18:09:51 +02:00
|
|
|
# This program is under GPL [http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt]
|
2006-06-03 17:16:21 +02:00
|
|
|
#
|
2011-05-23 19:06:56 +02:00
|
|
|
# (c) 2000-2011 - Tom Eastep (teastep@shorewall.net)
|
2006-06-03 17:16:21 +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
|
2007-09-08 18:09:51 +02:00
|
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2006-06-03 17:16:21 +02:00
|
|
|
#
|
|
|
|
|
2011-07-13 16:10:07 +02:00
|
|
|
VERSION=xxx #The Build script inserts the actual version
|
2006-06-03 17:16:21 +02:00
|
|
|
|
|
|
|
usage() # $1 = exit status
|
|
|
|
{
|
|
|
|
ME=$(basename $0)
|
|
|
|
echo "usage: $ME"
|
|
|
|
echo " $ME -v"
|
|
|
|
echo " $ME -h"
|
|
|
|
exit $1
|
|
|
|
}
|
|
|
|
|
|
|
|
split() {
|
2008-03-14 03:07:28 +01:00
|
|
|
local ifs
|
|
|
|
ifs=$IFS
|
2006-06-03 17:16:21 +02:00
|
|
|
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()
|
|
|
|
{
|
|
|
|
if ! install $*; then
|
|
|
|
echo
|
|
|
|
echo "ERROR: Failed to install $*" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
cant_autostart()
|
|
|
|
{
|
|
|
|
echo
|
2012-01-04 16:17:58 +01:00
|
|
|
echo "WARNING: Unable to configure $Product to start automatically at boot" >&2
|
2006-06-03 17:16:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
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}
|
2006-06-03 17:16:21 +02:00
|
|
|
}
|
|
|
|
|
2012-01-04 16:17:58 +01:00
|
|
|
#
|
|
|
|
# Change to the directory containing this script
|
|
|
|
#
|
|
|
|
cd "$(dirname $0)"
|
|
|
|
|
|
|
|
if [ -f shorewall-lite ]; then
|
|
|
|
PRODUCT=shorewall-lite
|
|
|
|
Product="Shorewall Lite"
|
|
|
|
else
|
|
|
|
PRODUCT=shorewall6-lite
|
|
|
|
Product="Shorewall6 Lite"
|
|
|
|
fi
|
|
|
|
|
2010-06-01 15:42:11 +02:00
|
|
|
[ -n "$DESTDIR" ] || DESTDIR="$PREFIX"
|
|
|
|
|
2006-06-03 17:16:21 +02:00
|
|
|
#
|
|
|
|
# Parse the run line
|
|
|
|
#
|
|
|
|
# DEST is the SysVInit script directory
|
|
|
|
# INIT is the name of the script in the $DEST directory
|
|
|
|
#
|
|
|
|
if [ -z "$DEST" ] ; then
|
|
|
|
DEST="/etc/init.d"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$INIT" ] ; then
|
2012-01-04 16:17:58 +01:00
|
|
|
INIT="$PRODUCT"
|
2006-06-03 17:16:21 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
while [ $# -gt 0 ] ; do
|
|
|
|
case "$1" in
|
|
|
|
-h|help|?)
|
|
|
|
usage 0
|
|
|
|
;;
|
|
|
|
-v)
|
2012-01-04 16:17:58 +01:00
|
|
|
echo "$Product Firewall Installer Version $VERSION"
|
2006-06-03 17:16:21 +02:00
|
|
|
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
|
|
|
|
/*)
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
LIBEXEC=/usr/${LIBEXEC}
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2006-06-03 17:16:21 +02:00
|
|
|
#
|
|
|
|
# Determine where to install the firewall script
|
|
|
|
#
|
2009-07-25 16:44:53 +02:00
|
|
|
CYGWIN=
|
2010-05-09 01:32:03 +02:00
|
|
|
INSTALLD='-D'
|
2010-05-29 19:50:39 +02:00
|
|
|
T='-T'
|
2009-07-25 16:44:53 +02:00
|
|
|
|
|
|
|
case $(uname) in
|
|
|
|
CYGWIN*)
|
2010-06-01 15:42:11 +02:00
|
|
|
if [ -z "$DESTDIR" ]; then
|
2009-07-25 16:44:53 +02:00
|
|
|
DEST=
|
|
|
|
INIT=
|
|
|
|
fi
|
|
|
|
|
|
|
|
OWNER=$(id -un)
|
|
|
|
GROUP=$(id -gn)
|
|
|
|
;;
|
2010-05-09 01:32:03 +02:00
|
|
|
Darwin)
|
2010-05-29 19:57:27 +02:00
|
|
|
INSTALLD=
|
2010-05-29 19:50:39 +02:00
|
|
|
T=
|
2010-05-09 01:32:03 +02:00
|
|
|
;;
|
2009-07-25 16:44:53 +02:00
|
|
|
*)
|
|
|
|
[ -z "$OWNER" ] && OWNER=root
|
|
|
|
[ -z "$GROUP" ] && GROUP=root
|
|
|
|
;;
|
|
|
|
esac
|
2006-06-03 17:16:21 +02:00
|
|
|
|
|
|
|
OWNERSHIP="-o $OWNER -g $GROUP"
|
|
|
|
|
2010-06-01 15:42:11 +02:00
|
|
|
if [ -n "$DESTDIR" ]; then
|
2009-07-25 16:44:53 +02:00
|
|
|
if [ `id -u` != 0 ] ; then
|
|
|
|
echo "Not setting file owner/group permissions, not running as root."
|
|
|
|
OWNERSHIP=""
|
|
|
|
fi
|
|
|
|
|
2010-06-01 15:42:11 +02:00
|
|
|
install -d $OWNERSHIP -m 755 ${DESTDIR}/sbin
|
|
|
|
install -d $OWNERSHIP -m 755 ${DESTDIR}${DEST}
|
2006-12-24 01:53:12 +01:00
|
|
|
elif [ -d /etc/apt -a -e /usr/bin/dpkg ]; then
|
|
|
|
DEBIAN=yes
|
2011-08-22 18:05:40 +02:00
|
|
|
elif [ -f /etc/redhat-release ]; then
|
|
|
|
FEDORA=yes
|
2006-12-24 01:53:12 +01:00
|
|
|
elif [ -f /etc/slackware-version ] ; then
|
|
|
|
DEST="/etc/rc.d"
|
|
|
|
INIT="rc.firewall"
|
|
|
|
elif [ -f /etc/arch-release ] ; then
|
|
|
|
DEST="/etc/rc.d"
|
2012-01-04 16:17:58 +01:00
|
|
|
INIT="$PRODUCT"
|
2006-12-24 01:53:12 +01:00
|
|
|
ARCHLINUX=yes
|
2006-11-12 17:00:38 +01:00
|
|
|
fi
|
|
|
|
|
2011-08-23 23:07:44 +02:00
|
|
|
if [ -z "$DESTDIR" ]; then
|
2012-01-02 05:30:09 +01:00
|
|
|
if [ ! -f /usr/share/shorewall/coreversion ]; then
|
2012-01-04 16:17:58 +01:00
|
|
|
echo "$PRODUCT $VERSION requires Shorewall Core which does not appear to be installed" >&2
|
2012-01-02 05:30:09 +01:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2011-08-23 23:07:44 +02:00
|
|
|
if [ -f /lib/systemd/system ]; then
|
|
|
|
SYSTEMD=Yes
|
|
|
|
fi
|
|
|
|
elif [ -n "$SYSTEMD" ]; then
|
|
|
|
mkdir -p ${DESTDIR}/lib/systemd/system
|
|
|
|
fi
|
|
|
|
|
2012-01-04 16:17:58 +01:00
|
|
|
echo "Installing $Product Version $VERSION"
|
2006-06-03 17:16:21 +02:00
|
|
|
|
|
|
|
#
|
2012-01-04 16:17:58 +01:00
|
|
|
# Check for /etc/$PRODUCT
|
2006-06-03 17:16:21 +02:00
|
|
|
#
|
2012-01-04 16:17:58 +01:00
|
|
|
if [ -z "$DESTDIR" -a -d /etc/$PRODUCT ]; then
|
2012-01-02 05:30:09 +01:00
|
|
|
if [ ! -f /usr/share/shorewall/coreversion ]; then
|
2012-01-04 16:17:58 +01:00
|
|
|
echo "$PRODUCT $VERSION requires Shorewall Core which does not appear to be installed" >&2
|
2012-01-02 05:30:09 +01:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2012-01-04 16:17:58 +01:00
|
|
|
[ -f /etc/$PRODUCT/shorewall.conf ] && \
|
|
|
|
mv -f /etc/$PRODUCT/shorewall.conf /etc/$PRODUCT/$PRODUCT.conf
|
2006-06-03 17:16:21 +02:00
|
|
|
else
|
2012-01-04 16:17:58 +01:00
|
|
|
rm -rf ${DESTDIR}/etc/$PRODUCT
|
|
|
|
rm -rf ${DESTDIR}/usr/share/$PRODUCT
|
|
|
|
rm -rf ${DESTDIR}/var/lib/$PRODUCT
|
|
|
|
[ "$LIBEXEC" = /usr/share ] || rm -rf /usr/share/$PRODUCT/wait4ifup /usr/share/$PRODUCT/shorecap
|
2006-06-03 17:16:21 +02:00
|
|
|
fi
|
|
|
|
|
2010-04-07 22:16:16 +02:00
|
|
|
#
|
2012-01-04 16:17:58 +01:00
|
|
|
# Check for /sbin/$PRODUCT
|
2010-04-07 22:16:16 +02:00
|
|
|
#
|
2012-01-04 16:17:58 +01:00
|
|
|
if [ -f ${DESTDIR}/sbin/$PRODUCT ]; then
|
2010-04-07 22:16:16 +02:00
|
|
|
first_install=""
|
|
|
|
else
|
|
|
|
first_install="Yes"
|
|
|
|
fi
|
|
|
|
|
2012-01-04 16:17:58 +01:00
|
|
|
delete_file ${DESTDIR}/usr/share/$PRODUCT/xmodules
|
2006-09-07 22:48:40 +02:00
|
|
|
|
2012-01-04 16:17:58 +01:00
|
|
|
install_file $PRODUCT ${DESTDIR}/sbin/$PRODUCT 0544
|
2006-06-12 19:48:20 +02:00
|
|
|
|
2012-01-04 16:17:58 +01:00
|
|
|
eval sed -i \'``s\|g_libexec=.\*\|g_libexec=$LIBEXEC\|\' ${DESTDIR}/sbin/$PRODUCT
|
2011-04-03 18:56:30 +02:00
|
|
|
|
2012-01-04 16:17:58 +01:00
|
|
|
echo "$Product control program installed in ${DESTDIR}/sbin/$PRODUCT"
|
2006-06-12 19:48:20 +02:00
|
|
|
|
2006-06-03 17:16:21 +02:00
|
|
|
#
|
|
|
|
# Install the Firewall Script
|
|
|
|
#
|
|
|
|
if [ -n "$DEBIAN" ]; then
|
2012-01-04 16:17:58 +01:00
|
|
|
install_file init.debian.sh ${DESTDIR}/etc/init.d/$PRODUCT 0544
|
2011-08-22 18:05:40 +02:00
|
|
|
elif [ -n "$FEDORA" ]; then
|
2012-01-04 16:17:58 +01:00
|
|
|
install_file init.fedora.sh ${DESTDIR}/etc/init.d/$PRODUCT 0544
|
2006-06-03 17:16:21 +02:00
|
|
|
elif [ -n "$ARCHLINUX" ]; then
|
2011-08-26 20:02:20 +02:00
|
|
|
install_file init.archlinux.sh ${DESTDIR}/${DEST}/$INIT 0544
|
2006-06-03 17:16:21 +02:00
|
|
|
else
|
2011-08-26 20:02:20 +02:00
|
|
|
install_file init.sh ${DESTDIR}/${DEST}/$INIT 0544
|
2006-06-03 17:16:21 +02:00
|
|
|
fi
|
|
|
|
|
2012-01-04 16:17:58 +01:00
|
|
|
echo "$Product script installed in ${DESTDIR}${DEST}/$INIT"
|
2006-06-03 17:16:21 +02:00
|
|
|
|
|
|
|
#
|
2012-01-04 16:17:58 +01:00
|
|
|
# Create /etc/$PRODUCT, /usr/share/$PRODUCT and /var/lib/$PRODUCT if needed
|
2006-06-03 17:16:21 +02:00
|
|
|
#
|
2012-01-04 16:17:58 +01:00
|
|
|
mkdir -p ${DESTDIR}/etc/$PRODUCT
|
|
|
|
mkdir -p ${DESTDIR}/usr/share/$PRODUCT
|
|
|
|
mkdir -p ${DESTDIR}${LIBEXEC}/$PRODUCT
|
|
|
|
mkdir -p ${DESTDIR}/var/lib/$PRODUCT
|
2006-06-03 17:16:21 +02:00
|
|
|
|
2012-01-04 16:17:58 +01:00
|
|
|
chmod 755 ${DESTDIR}/etc/$PRODUCT
|
|
|
|
chmod 755 ${DESTDIR}/usr/share/$PRODUCT
|
2006-06-03 17:16:21 +02:00
|
|
|
|
2010-06-01 15:42:11 +02:00
|
|
|
if [ -n "$DESTDIR" ]; then
|
|
|
|
mkdir -p ${DESTDIR}/etc/logrotate.d
|
|
|
|
chmod 755 ${DESTDIR}/etc/logrotate.d
|
2009-11-03 19:06:10 +01:00
|
|
|
fi
|
|
|
|
|
2011-08-23 23:07:44 +02:00
|
|
|
#
|
|
|
|
# Install the .service file
|
|
|
|
#
|
|
|
|
if [ -n "$SYSTEMD" ]; then
|
2012-01-04 16:17:58 +01:00
|
|
|
run_install $OWNERSHIP -m 600 $PRODUCT.service ${DESTDIR}/lib/systemd/system/$PRODUCT.service
|
|
|
|
echo "Service file installed as ${DESTDIR}/lib/systemd/system/$PRODUCT.service"
|
2011-08-23 23:07:44 +02:00
|
|
|
fi
|
|
|
|
|
2006-06-03 17:16:21 +02:00
|
|
|
#
|
|
|
|
# Install the config file
|
|
|
|
#
|
2012-01-04 16:17:58 +01:00
|
|
|
if [ ! -f ${DESTDIR}/etc/$PRODUCT/$PRODUCT.conf ]; then
|
|
|
|
install_file $PRODUCT.conf ${DESTDIR}/etc/$PRODUCT/$PRODUCT.conf 0744
|
|
|
|
echo "Config file installed as ${DESTDIR}/etc/$PRODUCT/$PRODUCT.conf"
|
2006-06-03 17:16:21 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -n "$ARCHLINUX" ] ; then
|
2012-01-04 16:17:58 +01:00
|
|
|
sed -e 's!LOGFILE=/var/log/messages!LOGFILE=/var/log/messages.log!' -i ${DESTDIR}/etc/$PRODUCT/$PRODUCT.conf
|
2006-06-03 17:16:21 +02:00
|
|
|
fi
|
|
|
|
|
2006-06-05 19:13:48 +02:00
|
|
|
#
|
|
|
|
# Install the Makefile
|
|
|
|
#
|
2012-01-04 16:17:58 +01:00
|
|
|
run_install $OWNERSHIP -m 0600 Makefile ${DESTDIR}/etc/$PRODUCT
|
|
|
|
echo "Makefile installed as ${DESTDIR}/etc/$PRODUCT/Makefile"
|
2006-06-09 18:59:14 +02:00
|
|
|
|
2006-06-03 19:04:45 +02:00
|
|
|
#
|
|
|
|
# Install the default config path file
|
|
|
|
#
|
2012-01-04 16:17:58 +01:00
|
|
|
install_file configpath ${DESTDIR}/usr/share/$PRODUCT/configpath 0644
|
|
|
|
echo "Default config path file installed as ${DESTDIR}/usr/share/$PRODUCT/configpath"
|
2006-06-03 19:04:45 +02:00
|
|
|
|
2006-06-03 17:16:21 +02:00
|
|
|
#
|
2006-10-29 18:29:30 +01:00
|
|
|
# Install the libraries
|
2006-06-03 17:16:21 +02:00
|
|
|
#
|
2006-10-29 18:29:30 +01:00
|
|
|
for f in lib.* ; do
|
|
|
|
if [ -f $f ]; then
|
2012-01-04 16:17:58 +01:00
|
|
|
install_file $f ${DESTDIR}/usr/share/$PRODUCT/$f 0644
|
|
|
|
echo "Library ${f#*.} file installed as ${DESTDIR}/usr/share/$PRODUCT/$f"
|
2006-10-29 18:29:30 +01:00
|
|
|
fi
|
|
|
|
done
|
2006-09-05 16:29:47 +02:00
|
|
|
|
2012-01-04 16:17:58 +01:00
|
|
|
ln -sf lib.base ${DESTDIR}/usr/share/$PRODUCT/functions
|
2006-06-03 17:16:21 +02:00
|
|
|
|
2012-01-04 16:17:58 +01:00
|
|
|
echo "Common functions linked through ${DESTDIR}/usr/share/$PRODUCT/functions"
|
2006-06-03 17:16:21 +02:00
|
|
|
|
|
|
|
#
|
|
|
|
# Install Shorecap
|
|
|
|
#
|
|
|
|
|
2012-01-04 16:17:58 +01:00
|
|
|
install_file shorecap ${DESTDIR}${LIBEXEC}/$PRODUCT/shorecap 0755
|
2006-06-03 17:16:21 +02:00
|
|
|
|
|
|
|
echo
|
2012-01-04 16:17:58 +01:00
|
|
|
echo "Capability file builder installed in ${DESTDIR}${LIBEXEC}/$PRODUCT/shorecap"
|
2007-01-01 01:40:42 +01:00
|
|
|
|
2006-06-05 23:04:19 +02:00
|
|
|
#
|
2011-02-06 03:19:04 +01:00
|
|
|
# Install the Modules files
|
2006-06-05 23:04:19 +02:00
|
|
|
#
|
2010-05-24 01:26:14 +02:00
|
|
|
|
|
|
|
if [ -f modules ]; then
|
2012-01-04 16:17:58 +01:00
|
|
|
run_install $OWNERSHIP -m 0600 modules ${DESTDIR}/usr/share/$PRODUCT
|
|
|
|
echo "Modules file installed as ${DESTDIR}/usr/share/$PRODUCT/modules"
|
2010-05-24 01:26:14 +02:00
|
|
|
fi
|
2006-06-05 23:04:19 +02:00
|
|
|
|
2011-03-19 22:14:03 +01:00
|
|
|
if [ -f helpers ]; then
|
2012-01-04 16:17:58 +01:00
|
|
|
run_install $OWNERSHIP -m 0600 helpers ${DESTDIR}/usr/share/$PRODUCT
|
|
|
|
echo "Helper modules file installed as ${DESTDIR}/usr/share/$PRODUCT/helpers"
|
2011-03-19 22:14:03 +01:00
|
|
|
fi
|
|
|
|
|
2011-02-06 03:19:04 +01:00
|
|
|
for f in modules.*; do
|
2012-01-04 16:17:58 +01:00
|
|
|
run_install $OWNERSHIP -m 0644 $f ${DESTDIR}/usr/share/$PRODUCT/$f
|
|
|
|
echo "Module file $f installed as ${DESTDIR}/usr/share/$PRODUCT/$f"
|
2011-02-06 03:19:04 +01:00
|
|
|
done
|
|
|
|
|
2006-11-19 05:13:06 +01:00
|
|
|
#
|
|
|
|
# Install the Man Pages
|
|
|
|
#
|
|
|
|
|
2010-05-24 01:26:14 +02:00
|
|
|
if [ -d manpages ]; then
|
|
|
|
cd manpages
|
2006-11-19 05:13:06 +01:00
|
|
|
|
2010-06-01 15:42:11 +02:00
|
|
|
[ -n "$INSTALLD" ] || mkdir -p ${DESTDIR}/usr/share/man/man5/ ${DESTDIR}/usr/share/man/man8/
|
2010-05-09 01:32:03 +02:00
|
|
|
|
2010-05-24 01:26:14 +02:00
|
|
|
for f in *.5; do
|
|
|
|
gzip -c $f > $f.gz
|
2010-06-01 15:42:11 +02:00
|
|
|
run_install $T $INSTALLD $OWNERSHIP -m 0644 $f.gz ${DESTDIR}/usr/share/man/man5/$f.gz
|
|
|
|
echo "Man page $f.gz installed to ${DESTDIR}/usr/share/man/man5/$f.gz"
|
2010-05-24 01:26:14 +02:00
|
|
|
done
|
2006-11-19 05:13:06 +01:00
|
|
|
|
2010-05-24 01:26:14 +02:00
|
|
|
for f in *.8; do
|
|
|
|
gzip -c $f > $f.gz
|
2010-06-01 15:42:11 +02:00
|
|
|
run_install $T $INSTALLD $OWNERSHIP -m 0644 $f.gz ${DESTDIR}/usr/share/man/man8/$f.gz
|
|
|
|
echo "Man page $f.gz installed to ${DESTDIR}/usr/share/man/man8/$f.gz"
|
2010-05-24 01:26:14 +02:00
|
|
|
done
|
2006-11-19 05:13:06 +01:00
|
|
|
|
2010-05-24 01:26:14 +02:00
|
|
|
cd ..
|
2006-11-19 05:13:06 +01:00
|
|
|
|
2010-05-24 01:26:14 +02:00
|
|
|
echo "Man Pages Installed"
|
|
|
|
fi
|
2006-11-19 05:13:06 +01:00
|
|
|
|
2010-06-01 15:42:11 +02:00
|
|
|
if [ -d ${DESTDIR}/etc/logrotate.d ]; then
|
2012-01-04 16:17:58 +01:00
|
|
|
run_install $OWNERSHIP -m 0644 logrotate ${DESTDIR}/etc/logrotate.d/$PRODUCT
|
|
|
|
echo "Logrotate file installed as ${DESTDIR}/etc/logrotate.d/$PRODUCT"
|
2009-11-03 19:06:10 +01:00
|
|
|
fi
|
|
|
|
|
2006-06-03 17:16:21 +02:00
|
|
|
#
|
|
|
|
# Create the version file
|
|
|
|
#
|
2012-01-04 16:17:58 +01:00
|
|
|
echo "$VERSION" > ${DESTDIR}/usr/share/$PRODUCT/version
|
|
|
|
chmod 644 ${DESTDIR}/usr/share/$PRODUCT/version
|
2006-06-03 17:16:21 +02:00
|
|
|
#
|
|
|
|
# Remove and create the symbolic link to the init script
|
|
|
|
#
|
|
|
|
|
2010-06-01 15:42:11 +02:00
|
|
|
if [ -z "$DESTDIR" ]; then
|
2012-01-04 16:17:58 +01:00
|
|
|
rm -f /usr/share/$PRODUCT/init
|
|
|
|
ln -s ${DEST}/${INIT} /usr/share/$PRODUCT/init
|
2006-06-03 17:16:21 +02:00
|
|
|
fi
|
|
|
|
|
2012-01-04 16:17:58 +01:00
|
|
|
delete_file ${DESTDIR}/usr/share/$PRODUCT/lib.common
|
|
|
|
delete_file ${DESTDIR}/usr/share/$PRODUCT/lib.cli
|
|
|
|
delete_file ${DESTDIR}/usr/share/$PRODUCT/wait4ifup
|
2012-01-02 05:30:09 +01:00
|
|
|
|
2010-06-01 15:42:11 +02:00
|
|
|
if [ -z "$DESTDIR" ]; then
|
2012-01-04 16:17:58 +01:00
|
|
|
touch /var/log/$PRODUCT-init.log
|
2010-04-10 20:46:50 +02:00
|
|
|
|
|
|
|
if [ -n "$first_install" ]; then
|
|
|
|
if [ -n "$DEBIAN" ]; then
|
2012-01-04 16:17:58 +01:00
|
|
|
run_install $OWNERSHIP -m 0644 default.debian /etc/default/$PRODUCT
|
2010-06-25 20:14:55 +02:00
|
|
|
|
2012-01-04 16:17:58 +01:00
|
|
|
update-rc.d $PRODUCT defaults
|
2010-10-13 17:42:35 +02:00
|
|
|
|
2010-06-25 20:14:55 +02:00
|
|
|
if [ -x /sbin/insserv ]; then
|
2012-01-04 16:17:58 +01:00
|
|
|
insserv /etc/init.d/$PRODUCT
|
2010-06-25 20:14:55 +02:00
|
|
|
else
|
2012-01-04 16:17:58 +01:00
|
|
|
ln -s ../init.d/$PRODUCT /etc/rcS.d/S40$PRODUCT
|
2010-06-25 20:14:55 +02:00
|
|
|
fi
|
|
|
|
|
2012-01-04 16:17:58 +01:00
|
|
|
echo "$Product will start automatically at boot"
|
2010-04-10 20:46:50 +02:00
|
|
|
else
|
2011-08-23 23:07:44 +02:00
|
|
|
if [ -n "$SYSTEMD" ]; then
|
2012-01-04 16:17:58 +01:00
|
|
|
if systemctl enable $PRODUCT; then
|
|
|
|
echo "$Product will start automatically at boot"
|
2011-08-23 23:07:44 +02:00
|
|
|
fi
|
|
|
|
elif [ -x /sbin/insserv -o -x /usr/sbin/insserv ]; then
|
2012-01-04 16:17:58 +01:00
|
|
|
if insserv /etc/init.d/$PRODUCT ; then
|
|
|
|
echo "$Product will start automatically at boot"
|
2010-04-10 20:46:50 +02:00
|
|
|
else
|
|
|
|
cant_autostart
|
|
|
|
fi
|
|
|
|
elif [ -x /sbin/chkconfig -o -x /usr/sbin/chkconfig ]; then
|
2012-01-04 16:17:58 +01:00
|
|
|
if chkconfig --add $PRODUCT ; then
|
|
|
|
echo "$Product will start automatically in run levels as follows:"
|
|
|
|
chkconfig --list $PRODUCT
|
2010-04-10 20:46:50 +02:00
|
|
|
else
|
|
|
|
cant_autostart
|
|
|
|
fi
|
|
|
|
elif [ -x /sbin/rc-update ]; then
|
2012-01-04 16:17:58 +01:00
|
|
|
if rc-update add $PRODUCT default; then
|
|
|
|
echo "$Product will start automatically at boot"
|
2010-04-10 20:46:50 +02:00
|
|
|
else
|
|
|
|
cant_autostart
|
|
|
|
fi
|
|
|
|
elif [ "$INIT" != rc.firewall ]; then #Slackware starts this automatically
|
2006-06-03 17:16:21 +02:00
|
|
|
cant_autostart
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
#
|
|
|
|
# Report Success
|
|
|
|
#
|
2012-01-04 16:17:58 +01:00
|
|
|
echo "$Product Version $VERSION Installed"
|