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)"
|
|
|
|
|
2012-02-23 19:07:02 +01:00
|
|
|
#
|
|
|
|
# Load packager's settings if any
|
|
|
|
#
|
|
|
|
[ -f ../shorewall-pkg.config ] && . ../shorewall-pkg.config
|
|
|
|
|
2012-01-04 16:17:58 +01:00
|
|
|
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
|
|
|
|
#
|
|
|
|
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
|
|
|
|
/*)
|
|
|
|
;;
|
|
|
|
*)
|
2012-02-20 21:04:00 +01:00
|
|
|
echo "The LIBEXEC setting must be an absolute path name" >&2
|
|
|
|
exit 1
|
2011-05-14 14:31:19 +02:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2006-06-03 17:16:21 +02:00
|
|
|
#
|
|
|
|
# Determine where to install the firewall script
|
|
|
|
#
|
2012-02-22 22:32:10 +01:00
|
|
|
cygwin=
|
2010-05-09 01:32:03 +02:00
|
|
|
INSTALLD='-D'
|
2012-02-21 21:34:41 +01:00
|
|
|
INITFILE=$PRODUCT
|
2010-05-29 19:50:39 +02:00
|
|
|
T='-T'
|
2009-07-25 16:44:53 +02: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
|
|
|
case $BUILD in
|
|
|
|
cygwin*)
|
2009-07-25 16:44:53 +02:00
|
|
|
OWNER=$(id -un)
|
|
|
|
GROUP=$(id -gn)
|
|
|
|
;;
|
2012-02-22 22:32:10 +01:00
|
|
|
apple)
|
2012-02-17 22:22:06 +01:00
|
|
|
[ -z "$OWNER" ] && OWNER=root
|
|
|
|
[ -z "$GROUP" ] && GROUP=wheel
|
2010-05-29 19:57:27 +02:00
|
|
|
INSTALLD=
|
2010-05-29 19:50:39 +02:00
|
|
|
T=
|
2012-02-17 22:22:06 +01: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"
|
|
|
|
|
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
|
|
|
|
cygwin)
|
2012-02-21 21:34:41 +01:00
|
|
|
echo "$PRODUCT is not supported on Cygwin" >&2
|
|
|
|
exit 1
|
2012-02-17 22:22:06 +01:00
|
|
|
;;
|
2012-02-22 22:32:10 +01:00
|
|
|
apple)
|
2012-02-21 21:34:41 +01:00
|
|
|
echo "$PRODUCT is not supported on OS X" >&2
|
|
|
|
exit 1
|
2012-02-17 22:22:06 +01:00
|
|
|
;;
|
2012-02-22 22:32:10 +01:00
|
|
|
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)
|
2012-02-17 22:22:06 +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 "Installing Slackware-specific configuration..."
|
2012-02-22 22:32:10 +01:00
|
|
|
[ -n "$INITDIR" ] || INITDIR="/etc/rc.d"
|
|
|
|
[ -n "$INITFILE" ] || INITFILE="rc.firewall"
|
|
|
|
[ -n "$MANDIR=" ] || MANDIR=/usr/man
|
2012-02-17 22:22:06 +01:00
|
|
|
;;
|
2012-02-22 22:32:10 +01:00
|
|
|
archlinux)
|
2012-02-17 22:22:06 +01:00
|
|
|
echo "Installing ArchLinux-specific configuration..."
|
2012-02-22 22:32:10 +01:00
|
|
|
[ -n "$INITDIR" ] || INITDIR="/etc/rc.d"
|
2012-02-17 22:22:06 +01:00
|
|
|
;;
|
2012-02-22 22:32:10 +01:00
|
|
|
linux|suse)
|
2012-02-17 22:22:06 +01:00
|
|
|
;;
|
|
|
|
*)
|
2012-02-22 22:32:10 +01:00
|
|
|
echo "ERROR: Unknown HOST \"$HOST\"" >&2
|
2012-02-17 22:22:06 +01:00
|
|
|
exit 1;
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2012-02-21 21:34:41 +01:00
|
|
|
[ -z "$INITDIR" ] && INITDIR="/etc/init.d"
|
2012-02-20 19:08:42 +01:00
|
|
|
|
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
|
2012-02-21 21:34:41 +01:00
|
|
|
install -d $OWNERSHIP -m 755 ${DESTDIR}${DESTFILE}
|
2006-11-12 17:00:38 +01:00
|
|
|
|
2012-02-17 22:22:06 +01:00
|
|
|
if [ -n "$SYSTEMD" ]; then
|
|
|
|
mkdir -p ${DESTDIR}/lib/systemd/system
|
2012-02-23 19:59:10 +01:00
|
|
|
INITFILE=
|
2012-02-17 22:22:06 +01:00
|
|
|
fi
|
|
|
|
else
|
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
|
2012-02-23 19:59:10 +01:00
|
|
|
INITFILE=
|
2011-08-23 23:07:44 +02:00
|
|
|
fi
|
|
|
|
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
|
2012-02-21 23:24:50 +01:00
|
|
|
[ "$LIBEXEC" = /usr/share ] || rm -rf ${DESTDIR}/usr/share/$PRODUCT/wait4ifup ${DESTDIR}/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
|
|
|
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
|
|
|
#
|
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
|
2012-02-21 23:24:50 +01:00
|
|
|
mkdir -p ${DESTDIR}${INITDIR}
|
|
|
|
chmod 755 ${DESTDIR}${INITDIR}
|
2009-11-03 19:06:10 +01:00
|
|
|
fi
|
|
|
|
|
2012-02-23 19:59:10 +01:00
|
|
|
if [ -n "$INITFILE" ]; then
|
|
|
|
case $TARGET in
|
|
|
|
debian)
|
|
|
|
install_file init.debian.sh ${DESTDIR}${INITDIR}/${INITFILE} 0544
|
|
|
|
;;
|
|
|
|
redhat)
|
|
|
|
install_file init.fedora.sh ${DESTDIR}${INITDIR}/${INITFILE} 0544
|
|
|
|
;;
|
|
|
|
archlinux)
|
|
|
|
install_file init.archlinux.sh ${DESTDIR}${INITDIR}/${INITFILE} 0544
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
install_file init.sh ${DESTDIR}${INITDIR}/${INITFILE} 0544
|
|
|
|
;;
|
|
|
|
esac
|
2012-02-21 23:24:50 +01:00
|
|
|
|
2012-02-23 19:59:10 +01:00
|
|
|
echo "$Product init script installed in ${DESTDIR}${INITDIR}/${INITFILE}"
|
|
|
|
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
|
|
|
|
|
2012-02-22 22:32:10 +01:00
|
|
|
if [ $HOST = 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
|
2012-02-21 21:34:41 +01:00
|
|
|
ln -s ${INITDIR}/${INITFILE} /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
|
2012-02-22 22:32:10 +01:00
|
|
|
if [ $HOST = 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
|
2012-02-21 21:34:41 +01:00
|
|
|
elif [ "$INITFILE" != 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"
|