2012-01-02 05:30:09 +01:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Script to install Shoreline Firewall Core Modules
|
|
|
|
#
|
2018-01-07 23:24:01 +01:00
|
|
|
# (c) 2000-2018 - Tom Eastep (teastep@shorewall.net)
|
2012-01-02 05:30:09 +01:00
|
|
|
#
|
|
|
|
# Shorewall documentation is available at http://shorewall.net
|
|
|
|
#
|
2014-01-04 18:48:27 +01:00
|
|
|
# This program is part of Shorewall.
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by the
|
|
|
|
# Free Software Foundation, either version 2 of the license or, at your
|
|
|
|
# option, any later version.
|
2012-01-02 05:30:09 +01:00
|
|
|
#
|
2014-01-04 18:48:27 +01:00
|
|
|
# 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.
|
2012-01-02 05:30:09 +01:00
|
|
|
#
|
2014-01-04 18:48:27 +01:00
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, see <http://www.gnu.org/licenses/>.
|
2012-01-02 05:30:09 +01:00
|
|
|
#
|
|
|
|
|
2017-02-20 18:51:59 +01:00
|
|
|
VERSION=xxx # The Build script inserts the actual version
|
2016-01-05 00:45:21 +01:00
|
|
|
PRODUCT=shorewall-core
|
|
|
|
Product="Shorewall Core"
|
2017-02-20 18:51:59 +01:00
|
|
|
|
2012-01-02 05:30:09 +01:00
|
|
|
usage() # $1 = exit status
|
|
|
|
{
|
|
|
|
ME=$(basename $0)
|
2017-02-20 18:51:59 +01:00
|
|
|
echo "usage: $ME [ <option> ] [ <shorewallrc file> ]"
|
|
|
|
echo "where <option> is one of"
|
|
|
|
echo " -h"
|
|
|
|
echo " -v"
|
2012-01-02 05:30:09 +01:00
|
|
|
exit $1
|
|
|
|
}
|
|
|
|
|
|
|
|
install_file() # $1 = source $2 = target $3 = mode
|
|
|
|
{
|
2015-11-04 22:29:59 +01:00
|
|
|
if cp -f $1 $2; then
|
|
|
|
if chmod $3 $2; then
|
|
|
|
if [ -n "$OWNER" ]; then
|
|
|
|
if chown $OWNER:$GROUP $2; then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "ERROR: Failed to install $2" >&2
|
|
|
|
exit 1
|
2012-01-02 05:30:09 +01:00
|
|
|
}
|
|
|
|
|
2016-01-05 00:45:21 +01:00
|
|
|
#
|
|
|
|
# Change to the directory containing this script
|
|
|
|
#
|
2012-03-24 21:05:39 +01:00
|
|
|
cd "$(dirname $0)"
|
2012-02-23 19:07:02 +01:00
|
|
|
|
2017-02-20 18:51:49 +01:00
|
|
|
#
|
|
|
|
# Source common functions
|
|
|
|
#
|
|
|
|
. ./lib.installer || { echo "ERROR: Can not load common functions." >&2; exit 1; }
|
|
|
|
|
2012-01-02 05:30:09 +01:00
|
|
|
#
|
|
|
|
# Parse the run line
|
|
|
|
#
|
2012-03-24 21:05:39 +01:00
|
|
|
finished=0
|
|
|
|
|
|
|
|
while [ $finished -eq 0 ]; do
|
|
|
|
option=$1
|
|
|
|
|
|
|
|
case "$option" in
|
|
|
|
-*)
|
|
|
|
option=${option#-}
|
|
|
|
|
|
|
|
while [ -n "$option" ]; do
|
|
|
|
case $option in
|
|
|
|
h)
|
|
|
|
usage 0
|
|
|
|
;;
|
|
|
|
v)
|
2017-02-20 18:51:46 +01:00
|
|
|
echo "$Product Firewall Installer Version $VERSION"
|
2012-03-24 21:05:39 +01:00
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
usage 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
finished=1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2012-01-02 05:30:09 +01:00
|
|
|
#
|
2012-03-24 21:05:39 +01:00
|
|
|
# Read the RC file
|
|
|
|
#
|
|
|
|
if [ $# -eq 0 ]; then
|
2012-04-01 02:40:18 +02:00
|
|
|
if [ -f ./shorewallrc ]; then
|
2016-12-19 19:26:33 +01:00
|
|
|
file=./shorewallrc
|
2017-02-20 18:51:58 +01:00
|
|
|
. $file || fatal_error "Can not load the RC file: $file"
|
2012-04-01 19:47:24 +02:00
|
|
|
elif [ -f ~/.shorewallrc ]; then
|
2016-12-19 19:26:33 +01:00
|
|
|
file=~/.shorewallrc
|
2017-02-20 18:51:58 +01:00
|
|
|
. $file || fatal_error "Can not load the RC file: $file"
|
2012-03-30 21:02:25 +02:00
|
|
|
elif [ -f /usr/share/shorewall/shorewallrc ]; then
|
2016-12-19 19:26:33 +01:00
|
|
|
file=/usr/share/shorewall/shorewallrc
|
2017-02-20 18:51:58 +01:00
|
|
|
. $file || fatal_error "Can not load the RC file: $file"
|
2012-03-30 21:02:25 +02:00
|
|
|
else
|
|
|
|
fatal_error "No configuration file specified and /usr/share/shorewall/shorewallrc not found"
|
2012-03-24 21:05:39 +01:00
|
|
|
fi
|
|
|
|
elif [ $# -eq 1 ]; then
|
|
|
|
file=$1
|
|
|
|
case $file in
|
|
|
|
/*|.*)
|
|
|
|
;;
|
|
|
|
*)
|
2012-03-27 23:33:49 +02:00
|
|
|
file=./$file || exit 1
|
2012-03-24 21:05:39 +01:00
|
|
|
;;
|
|
|
|
esac
|
2012-01-02 05:30:09 +01:00
|
|
|
|
2017-02-20 18:51:58 +01:00
|
|
|
. $file || fatal_error "Can not load the RC file: $file"
|
2012-03-24 21:05:39 +01:00
|
|
|
else
|
|
|
|
usage 1
|
|
|
|
fi
|
2012-01-02 05:30:09 +01:00
|
|
|
|
2012-09-15 17:09:37 +02:00
|
|
|
update=0
|
|
|
|
|
2012-09-02 23:36:11 +02:00
|
|
|
if [ -z "${VARLIB}" ]; then
|
|
|
|
VARLIB=${VARDIR}
|
2012-09-14 17:20:54 +02:00
|
|
|
VARDIR="${VARLIB}/${PRODUCT}"
|
2012-09-15 17:09:37 +02:00
|
|
|
update=1
|
2012-09-03 00:51:35 +02:00
|
|
|
elif [ -z "${VARDIR}" ]; then
|
2012-09-14 17:20:54 +02:00
|
|
|
VARDIR="${VARLIB}/${PRODUCT}"
|
2012-09-15 17:09:37 +02:00
|
|
|
update=2
|
2012-09-02 23:36:11 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
for var in SHAREDIR LIBEXECDIR PERLLIBDIR CONFDIR SBINDIR VARLIB VARDIR; do
|
2012-03-24 21:05:39 +01:00
|
|
|
require $var
|
|
|
|
done
|
2012-01-02 05:30:09 +01:00
|
|
|
|
2012-03-24 21:05:39 +01:00
|
|
|
[ "${INITFILE}" != 'none/' ] && require INITSOURCE && require INITDIR
|
|
|
|
|
2012-02-22 22:32:10 +01:00
|
|
|
if [ -z "$BUILD" ]; then
|
2012-02-18 17:19:39 +01:00
|
|
|
case $(uname) in
|
2014-07-09 19:48:03 +02:00
|
|
|
cygwin*|CYGWIN*)
|
2012-02-22 22:32:10 +01:00
|
|
|
BUILD=cygwin
|
2012-02-18 17:19:39 +01:00
|
|
|
;;
|
|
|
|
Darwin)
|
2012-02-22 22:32:10 +01:00
|
|
|
BUILD=apple
|
2012-02-18 17:19:39 +01:00
|
|
|
;;
|
|
|
|
*)
|
2013-08-09 02:44:40 +02:00
|
|
|
if [ -f /etc/os-release ]; then
|
|
|
|
eval $(cat /etc/os-release | grep ^ID)
|
|
|
|
|
|
|
|
case $ID in
|
2014-09-23 12:18:58 +02:00
|
|
|
fedora|rhel|centos|foobar)
|
2013-08-09 02:44:40 +02:00
|
|
|
BUILD=redhat
|
|
|
|
;;
|
|
|
|
debian)
|
|
|
|
BUILD=debian
|
|
|
|
;;
|
2013-09-17 17:22:52 +02:00
|
|
|
gentoo)
|
|
|
|
BUILD=gentoo
|
|
|
|
;;
|
2013-08-09 02:44:40 +02:00
|
|
|
opensuse)
|
|
|
|
BUILD=suse
|
|
|
|
;;
|
2018-05-29 17:13:26 +02:00
|
|
|
alt|basealt|altlinux)
|
|
|
|
BUILD=alt
|
|
|
|
;;
|
2013-08-09 02:44:40 +02:00
|
|
|
*)
|
|
|
|
BUILD="$ID"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
elif [ -f /etc/debian_version ]; then
|
2012-02-22 22:32:10 +01:00
|
|
|
BUILD=debian
|
2013-09-17 17:22:52 +02:00
|
|
|
elif [ -f /etc/gentoo-release ]; then
|
|
|
|
BUILD=gentoo
|
2018-05-29 17:13:26 +02:00
|
|
|
elif [ -f /etc/altlinux-release ]; then
|
|
|
|
BUILD=alt
|
2012-02-18 17:19:39 +01:00
|
|
|
elif [ -f /etc/redhat-release ]; then
|
2012-02-22 22:32:10 +01:00
|
|
|
BUILD=redhat
|
2012-02-18 17:19:39 +01:00
|
|
|
elif [ -f /etc/slackware-version ] ; then
|
2012-02-22 22:32:10 +01:00
|
|
|
BUILD=slackware
|
2012-02-18 17:19:39 +01:00
|
|
|
elif [ -f /etc/SuSE-release ]; then
|
2012-02-22 22:32:10 +01:00
|
|
|
BUILD=suse
|
2012-02-18 17:19:39 +01:00
|
|
|
elif [ -f /etc/arch-release ] ; then
|
2012-02-22 22:32:10 +01:00
|
|
|
BUILD=archlinux
|
2015-11-06 23:01:02 +01:00
|
|
|
elif [ -f ${CONFDIR}/openwrt_release ] ; then
|
2015-11-04 22:29:59 +01:00
|
|
|
BUILD=openwrt
|
2012-02-18 17:19:39 +01:00
|
|
|
else
|
2012-02-22 22:32:10 +01:00
|
|
|
BUILD=linux
|
2012-02-18 17:19:39 +01:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
2012-02-22 22:32:10 +01:00
|
|
|
case $BUILD in
|
|
|
|
cygwin*)
|
2012-01-02 05:30:09 +01:00
|
|
|
if [ -z "$DESTDIR" ]; then
|
|
|
|
DEST=
|
|
|
|
INIT=
|
|
|
|
fi
|
|
|
|
|
|
|
|
OWNER=$(id -un)
|
|
|
|
GROUP=$(id -gn)
|
|
|
|
;;
|
2012-02-22 22:32:10 +01:00
|
|
|
apple)
|
2012-01-02 05:30:09 +01:00
|
|
|
if [ -z "$DESTDIR" ]; then
|
|
|
|
DEST=
|
|
|
|
INIT=
|
2012-02-18 17:19:39 +01:00
|
|
|
SPARSE=Yes
|
2012-01-02 05:30:09 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
[ -z "$OWNER" ] && OWNER=root
|
|
|
|
[ -z "$GROUP" ] && GROUP=wheel
|
|
|
|
;;
|
|
|
|
*)
|
2015-11-06 23:01:02 +01:00
|
|
|
if [ $(id -u) -eq 0 ]; then
|
2015-11-04 22:29:59 +01:00
|
|
|
[ -z "$OWNER" ] && OWNER=root
|
|
|
|
[ -z "$GROUP" ] && GROUP=root
|
|
|
|
fi
|
2012-01-02 05:30:09 +01:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
#
|
|
|
|
# Determine where to install the firewall script
|
|
|
|
#
|
|
|
|
|
2012-02-22 22:32:10 +01:00
|
|
|
[ -n "$HOST" ] || HOST=$BUILD
|
2012-02-18 17:19:39 +01:00
|
|
|
|
2012-02-22 22:32:10 +01:00
|
|
|
case "$HOST" in
|
|
|
|
cygwin)
|
2012-02-18 17:19:39 +01:00
|
|
|
echo "Installing Cygwin-specific configuration..."
|
|
|
|
;;
|
2012-02-22 22:32:10 +01:00
|
|
|
apple)
|
2012-02-18 17:19:39 +01:00
|
|
|
echo "Installing Mac-specific configuration...";
|
|
|
|
;;
|
2018-05-29 17:13:26 +02:00
|
|
|
debian|gentoo|redhat|slackware|archlinux|linux|suse|openwrt|alt)
|
2012-02-18 17:19:39 +01:00
|
|
|
;;
|
|
|
|
*)
|
2017-02-20 18:52:03 +01:00
|
|
|
fatal_error "Unknown HOST \"$HOST\""
|
2012-02-18 17:19:39 +01:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2012-03-25 16:49:52 +02:00
|
|
|
if [ -z "$file" ]; then
|
2017-02-20 18:52:02 +01:00
|
|
|
if [ $HOST = linux ]; then
|
2012-03-25 16:49:52 +02:00
|
|
|
file=shorewallrc.default
|
|
|
|
else
|
2012-03-31 00:22:06 +02:00
|
|
|
file=shorewallrc.${HOST}
|
2012-03-25 16:49:52 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo "You have not specified a configuration file and ~/.shorewallrc does not exist" >&2
|
|
|
|
echo "Shorewall-core $VERSION has determined that the $file configuration is appropriate for your system" >&2
|
|
|
|
echo "Please review the settings in that file. If you wish to change them, make a copy and modify the copy" >&2
|
|
|
|
echo "Then re-run install.sh passing either $file or the name of your modified copy" >&2
|
|
|
|
echo "" >&2
|
|
|
|
echo "Example:" >&2
|
|
|
|
echo "" >&2
|
2017-02-20 18:52:02 +01:00
|
|
|
echo " ./install.sh $file" >&2
|
|
|
|
exit 1
|
2012-03-25 16:49:52 +02:00
|
|
|
fi
|
|
|
|
|
2012-01-02 05:30:09 +01:00
|
|
|
if [ -n "$DESTDIR" ]; then
|
2012-02-22 22:32:10 +01:00
|
|
|
if [ $BUILD != cygwin ]; then
|
2012-01-02 05:30:09 +01:00
|
|
|
if [ `id -u` != 0 ] ; then
|
|
|
|
echo "Not setting file owner/group permissions, not running as root."
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2017-02-20 18:51:46 +01:00
|
|
|
echo "Installing $Product Version $VERSION"
|
2012-01-02 05:30:09 +01:00
|
|
|
|
|
|
|
#
|
2012-04-01 17:16:07 +02:00
|
|
|
# Create directories
|
2012-01-02 05:30:09 +01:00
|
|
|
#
|
2017-02-20 18:51:54 +01:00
|
|
|
make_parent_directory ${DESTDIR}${LIBEXECDIR}/shorewall 0755
|
2012-02-21 01:11:28 +01:00
|
|
|
|
2017-02-20 18:51:54 +01:00
|
|
|
make_parent_directory ${DESTDIR}${SHAREDIR}/shorewall 0755
|
2012-04-01 17:16:07 +02:00
|
|
|
|
2017-02-20 18:51:54 +01:00
|
|
|
make_parent_directory ${DESTDIR}${CONFDIR} 0755
|
2012-04-01 17:16:07 +02:00
|
|
|
|
2017-02-20 18:51:54 +01:00
|
|
|
[ -n "${SYSCONFDIR}" ] && make_parent_directory ${DESTDIR}${SYSCONFDIR} 0755
|
2012-04-01 17:16:07 +02:00
|
|
|
|
2014-10-13 20:56:26 +02:00
|
|
|
if [ -z "${SERVICEDIR}" ]; then
|
|
|
|
SERVICEDIR="$SYSTEMD"
|
2014-10-08 01:46:16 +02:00
|
|
|
fi
|
|
|
|
|
2017-02-20 18:51:54 +01:00
|
|
|
[ -n "${SERVICEDIR}" ] && make_parent_directory ${DESTDIR}${SERVICEDIR} 0755
|
2012-04-01 17:16:07 +02:00
|
|
|
|
2017-02-20 18:51:54 +01:00
|
|
|
make_parent_directory ${DESTDIR}${SBINDIR} 0755
|
2012-04-01 17:16:07 +02:00
|
|
|
|
2017-02-20 18:51:54 +01:00
|
|
|
[ -n "${MANDIR}" ] && make_parent_directory ${DESTDIR}${MANDIR} 0755
|
2012-04-01 17:16:07 +02:00
|
|
|
|
2012-04-28 01:15:04 +02:00
|
|
|
if [ -n "${INITFILE}" ]; then
|
2017-02-20 18:51:54 +01:00
|
|
|
make_parent_directory ${DESTDIR}${INITDIR} 0755
|
2012-04-28 01:15:04 +02:00
|
|
|
|
|
|
|
if [ -n "$AUXINITSOURCE" -a -f "$AUXINITSOURCE" ]; then
|
|
|
|
install_file $AUXINITSOURCE ${DESTDIR}${INITDIR}/$AUXINITFILE 0544
|
|
|
|
[ "${SHAREDIR}" = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${INITDIR}/$AUXINITFILE
|
2013-09-09 17:11:45 +02:00
|
|
|
echo "SysV init script $AUXINITSOURCE installed in ${DESTDIR}${INITDIR}/$AUXINITFILE"
|
2012-04-28 01:15:04 +02:00
|
|
|
fi
|
|
|
|
fi
|
2012-04-01 17:16:07 +02:00
|
|
|
#
|
|
|
|
# Note: ${VARDIR} is created at run-time since it has always been
|
|
|
|
# a relocatable directory on a per-product basis
|
2012-01-02 05:30:09 +01:00
|
|
|
#
|
2016-11-21 19:00:55 +01:00
|
|
|
# Install the CLI
|
|
|
|
#
|
|
|
|
install_file shorewall ${DESTDIR}${SBINDIR}/shorewall 0755
|
|
|
|
[ $SHAREDIR = /usr/share ] || eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${SBINDIR}/shorewall
|
2017-01-24 16:14:48 +01:00
|
|
|
echo "Shorewall CLI program installed in ${DESTDIR}${SBINDIR}/shorewall"
|
2016-11-21 19:00:55 +01:00
|
|
|
#
|
2012-01-02 05:30:09 +01:00
|
|
|
# Install wait4ifup
|
|
|
|
#
|
2012-03-24 21:05:39 +01:00
|
|
|
install_file wait4ifup ${DESTDIR}${LIBEXECDIR}/shorewall/wait4ifup 0755
|
2012-01-02 05:30:09 +01:00
|
|
|
|
|
|
|
echo
|
2012-03-24 21:05:39 +01:00
|
|
|
echo "wait4ifup installed in ${DESTDIR}${LIBEXECDIR}/shorewall/wait4ifup"
|
2012-01-02 05:30:09 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
# Install the libraries
|
|
|
|
#
|
|
|
|
for f in lib.* ; do
|
2017-02-20 18:51:52 +01:00
|
|
|
case $f in
|
|
|
|
*installer)
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
install_file $f ${DESTDIR}${SHAREDIR}/shorewall/$f 0644
|
|
|
|
echo "Library ${f#*.} file installed as ${DESTDIR}${SHAREDIR}/shorewall/$f"
|
|
|
|
;;
|
|
|
|
esac
|
2012-01-02 05:30:09 +01:00
|
|
|
done
|
2012-02-13 21:57:07 +01:00
|
|
|
|
2016-11-21 22:25:57 +01:00
|
|
|
if [ $SHAREDIR != /usr/share ]; then
|
2017-12-27 00:00:15 +01:00
|
|
|
eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${SHAREDIR}/shorewall/lib.base
|
|
|
|
eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${SHAREDIR}/shorewall/lib.cli
|
2016-11-21 22:25:57 +01:00
|
|
|
fi
|
|
|
|
|
2016-12-05 19:10:27 +01:00
|
|
|
#
|
|
|
|
# Install the Man Pages
|
|
|
|
#
|
|
|
|
if [ -n "$MANDIR" ]; then
|
|
|
|
cd manpages
|
|
|
|
|
2017-02-20 18:51:54 +01:00
|
|
|
[ -n "$INSTALLD" ] || make_parent_directory ${DESTDIR}${MANDIR}/man8 0755
|
2016-12-05 19:10:27 +01:00
|
|
|
|
|
|
|
for f in *.8; do
|
|
|
|
gzip -9c $f > $f.gz
|
2017-02-20 18:51:55 +01:00
|
|
|
install_file $f.gz ${DESTDIR}${MANDIR}/man8/$f.gz 0644
|
2016-12-05 19:10:27 +01:00
|
|
|
echo "Man page $f.gz installed to ${DESTDIR}${MANDIR}/man8/$f.gz"
|
|
|
|
done
|
|
|
|
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
echo "Man Pages Installed"
|
|
|
|
fi
|
|
|
|
|
2012-01-02 05:30:09 +01:00
|
|
|
#
|
|
|
|
# Symbolically link 'functions' to lib.base
|
|
|
|
#
|
2012-03-24 21:05:39 +01:00
|
|
|
ln -sf lib.base ${DESTDIR}${SHAREDIR}/shorewall/functions
|
2012-01-02 05:30:09 +01:00
|
|
|
#
|
|
|
|
# Create the version file
|
|
|
|
#
|
2012-03-24 21:05:39 +01:00
|
|
|
echo "$VERSION" > ${DESTDIR}${SHAREDIR}/shorewall/coreversion
|
2017-02-20 18:51:55 +01:00
|
|
|
chmod 0644 ${DESTDIR}${SHAREDIR}/shorewall/coreversion
|
2012-03-24 21:05:39 +01:00
|
|
|
|
2012-09-15 17:09:37 +02:00
|
|
|
if [ -z "${DESTDIR}" ]; then
|
|
|
|
if [ $update -ne 0 ]; then
|
|
|
|
echo "Updating $file - original saved in $file.bak"
|
|
|
|
|
|
|
|
cp $file $file.bak
|
|
|
|
|
|
|
|
echo '#' >> $file
|
|
|
|
echo "# Updated by Shorewall-core $VERSION -" `date` >> $file
|
|
|
|
echo '#' >> $file
|
|
|
|
|
|
|
|
[ $update -eq 1 ] && sed -i 's/VARDIR/VARLIB/' $file
|
|
|
|
|
|
|
|
echo 'VARDIR=${VARLIB}/${PRODUCT}' >> $file
|
|
|
|
fi
|
|
|
|
fi
|
2012-03-24 21:05:39 +01:00
|
|
|
|
2012-09-15 17:09:37 +02:00
|
|
|
[ $file != "${DESTDIR}${SHAREDIR}/shorewall/shorewallrc" ] && cp $file ${DESTDIR}${SHAREDIR}/shorewall/shorewallrc
|
2012-03-30 21:02:25 +02:00
|
|
|
|
2013-10-09 23:06:41 +02:00
|
|
|
|
|
|
|
[ -z "${DESTDIR}" ] && [ ! -f ~/.shorewallrc ] && cp ${SHAREDIR}/shorewall/shorewallrc ~/.shorewallrc
|
|
|
|
|
2012-03-30 21:02:25 +02:00
|
|
|
if [ ${SHAREDIR} != /usr/share ]; then
|
|
|
|
for f in lib.*; do
|
2017-02-20 18:51:52 +01:00
|
|
|
case $f in
|
|
|
|
*installer)
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
if [ $BUILD != apple ]; then
|
|
|
|
eval sed -i \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${SHAREDIR}/shorewall/$f
|
|
|
|
else
|
|
|
|
eval sed -i \'\' -e \'s\|/usr/share/\|${SHAREDIR}/\|\' ${DESTDIR}${SHAREDIR}/shorewall/$f
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
2012-03-30 21:02:25 +02:00
|
|
|
done
|
2012-03-24 21:05:39 +01:00
|
|
|
fi
|
2012-01-02 05:30:09 +01:00
|
|
|
#
|
2017-02-20 18:51:59 +01:00
|
|
|
# Report Success
|
2012-01-02 05:30:09 +01:00
|
|
|
#
|
2017-02-20 18:51:46 +01:00
|
|
|
echo "$Product Version $VERSION Installed"
|