Add support for serviced in the installers

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2011-08-23 14:07:44 -07:00
parent 33afe26a19
commit 971adc3d5b
10 changed files with 121 additions and 6 deletions

View File

@ -183,6 +183,14 @@ else
exit 1
fi
if [ -z "$DESTDIR" ]; then
if [ -f /lib/systemd/system ]; then
SYSTEMD=Yes
fi
elif [ -n "$SYSTEMD" ]; then
mkdir -p ${DESTDIR}/lib/systemd/system
fi
#
# Change to the directory containing this script
#
@ -214,6 +222,14 @@ fi
echo "Shorewall Init script installed in ${DESTDIR}${DEST}/$INIT"
#
# 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"
fi
#
# Create /usr/share/shorewall-init if needed
#
@ -301,7 +317,11 @@ if [ -z "$DESTDIR" ]; then
echo "Shorewall Init will start automatically at boot"
else
if [ -x /sbin/insserv -o -x /usr/sbin/insserv ]; then
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
if insserv /etc/init.d/shorewall-init ; then
echo "Shorewall Init will start automatically at boot"
else

View File

@ -73,6 +73,8 @@ if [ -n "$INITSCRIPT" ]; then
insserv -r $INITSCRIPT
elif [ -x /sbin/chkconfig -o -x /usr/sbin/chkconfig ]; then
chkconfig --del $(basename $INITSCRIPT)
elif [ -x /sbin/systemctl ]; then
systemctl disable shorewall-init
else
rm -f /etc/rc*.d/*$(basename $INITSCRIPT)
fi
@ -93,6 +95,7 @@ remove_file /etc/network/if-down.d/shorewall
remove_file /etc/sysconfig/network/if-up.d/shorewall
remove_file /etc/sysconfig/network/if-down.d/shorewall
remove_file /lib/systemd/system/shorewall.service
if [ -d /etc/ppp ]; then
for directory in ip-up.d ip-down.d ipv6-up.d ipv6-down.d; do

View File

@ -183,6 +183,14 @@ elif [ -f /etc/arch-release ] ; then
ARCHLINUX=yes
fi
if [ -z "$DESTDIR" ]; then
if [ -f /lib/systemd/system ]; then
SYSTEMD=Yes
fi
elif [ -n "$SYSTEMD" ]; then
mkdir -p ${DESTDIR}/lib/systemd/system
fi
#
# Change to the directory containing this script
#
@ -251,6 +259,14 @@ if [ -n "$DESTDIR" ]; then
chmod 755 ${DESTDIR}/etc/logrotate.d
fi
#
# Install the .service file
#
if [ -n "$SYSTEMD" ]; then
run_install $OWNERSHIP -m 600 shorewall-lite.service ${DESTDIR}/lib/systemd/system/shorewall-lite.service
echo "Service file installed as ${DESTDIR}/lib/systemd/system/shorewall-lite.service"
fi
#
# Install the config file
#
@ -391,7 +407,11 @@ if [ -z "$DESTDIR" ]; then
echo "Shorewall Lite will start automatically at boot"
else
if [ -x /sbin/insserv -o -x /usr/sbin/insserv ]; then
if [ -n "$SYSTEMD" ]; then
if systemctl enable shorewall-lite; then
echo "Shorewall Lite will start automatically at boot"
fi
elif [ -x /sbin/insserv -o -x /usr/sbin/insserv ]; then
if insserv /etc/init.d/shorewall-lite ; then
echo "Shorewall Lite will start automatically at boot"
else

View File

@ -93,6 +93,8 @@ if [ -n "$FIREWALL" ]; then
insserv -r $FIREWALL
elif [ -x /sbin/chkconfig -o -x /usr/sbin/chkconfig ]; then
chkconfig --del $(basename $FIREWALL)
elif [ -x /sbin/systemctl ]; then
systemctl disable shorewall-lite
else
rm -f /etc/rc*.d/*$(basename $FIREWALL)
fi
@ -112,6 +114,7 @@ rm -rf /usr/share/shorewall-lite
rm -rf ${LIBEXEC}/shorewall-lite
rm -rf /usr/share/shorewall-lite-*.bkout
rm -f /etc/logrotate.d/shorewall-lite
rm -f /lib/systemd/system/shorewall-lite.service
echo "Shorewall Lite Uninstalled"

View File

@ -248,7 +248,7 @@ else
echo "Installing Debian-specific configuration..."
DEBIAN=yes
SPARSE=yes
elif [ -f /etc/redhat-version ]; then
elif [ -f /etc/redhat-release ]; then
echo "Installing Redhat/Fedora-specific configuration..."
FEDORA=yes
elif [ -f /etc/slackware-version ] ; then
@ -265,6 +265,14 @@ else
fi
fi
if [ -z "$DESTDIR" ]; then
if [ -f /lib/systemd/system ]; then
SYSTEMD=Yes
fi
elif [ -n "$SYSTEMD" ]; then
mkdir -p ${DESTDIR}/lib/systemd/system
fi
#
# Change to the directory containing this script
#
@ -338,6 +346,14 @@ if [ -n "$DESTDIR" ]; then
chmod 755 ${DESTDIR}/etc/logrotate.d
fi
#
# Install the .service file
#
if [ -n "$SYSTEMD" ]; then
run_install $OWNERSHIP -m 600 shorewall.service ${DESTDIR}/lib/systemd/system/shorewall.service
echo "Service file installed as ${DESTDIR}/lib/systemd/system/shorewall.service"
fi
if [ -n "$ANNOTATED" ]; then
suffix=.annotated
else
@ -1002,7 +1018,11 @@ if [ -z "$DESTDIR" -a -n "$first_install" -a -z "${CYGWIN}${MAC}" ]; then
touch /var/log/shorewall-init.log
perl -p -w -i -e 's/^STARTUP_ENABLED=No/STARTUP_ENABLED=Yes/;s/^IP_FORWARDING=On/IP_FORWARDING=Keep/;s/^SUBSYSLOCK=.*/SUBSYSLOCK=/;' /etc/shorewall/shorewall.conf
else
if [ -x /sbin/insserv -o -x /usr/sbin/insserv ]; then
if [ -n "$SYSTEMD" ]; then
if systemctl enable shorewall; then
echo "Shorewall will start automatically at boot"
fi
elif [ -x /sbin/insserv -o -x /usr/sbin/insserv ]; then
if insserv /etc/init.d/shorewall ; then
echo "shorewall will start automatically at boot"
echo "Set STARTUP_ENABLED=Yes in /etc/shorewall/shorewall.conf to enable"

View File

@ -92,6 +92,8 @@ if [ -n "$FIREWALL" ]; then
updaterc.d shorewall remove
elif [ -x /sbin/insserv -o -x /usr/sbin/insserv ]; then
insserv -r $FIREWALL
elif [ -x /sbin/systemctl ]; then
systemctl disable shorewall
elif [ -x /sbin/chkconfig -o -x /usr/sbin/chkconfig ]; then
chkconfig --del $(basename $FIREWALL)
else
@ -116,6 +118,7 @@ rm -rf /usr/share/shorewall-*.bkout
rm -rf /usr/share/man/man5/shorewall*
rm -rf /usr/share/man/man8/shorewall*
rm -f /etc/logrotate.d/shorewall
rm -f /lib/systemd/system/shorewall.service
echo "Shorewall Uninstalled"

View File

@ -182,6 +182,14 @@ elif [ -f /etc/arch-release ] ; then
ARCHLINUX=yes
fi
if [ -z "$DESTDIR" ]; then
if [ -f /lib/systemd/system ]; then
SYSTEMD=Yes
fi
elif [ -n "$SYSTEMD" ]; then
mkdir -p ${DESTDIR}/lib/systemd/system
fi
#
# Change to the directory containing this script
#
@ -251,6 +259,14 @@ if [ -n "$DESTDIR" ]; then
chmod 755 ${DESTDIR}/etc/logrotate.d
fi
#
# Install the .service file
#
if [ -n "$SYSTEMD" ]; then
run_install $OWNERSHIP -m 600 shorewall6-lite.service ${DESTDIR}/lib/systemd/system/shorewall6-lite.service
echo "Service file installed as ${DESTDIR}/lib/systemd/system/shorewall6-lite.service"
fi
#
# Install the config file
#
@ -384,7 +400,11 @@ if [ -z "$DESTDIR" ]; then
echo "Shorewall6 Lite will start automatically at boot"
else
if [ -x /sbin/insserv -o -x /usr/sbin/insserv ]; then
if [ -n "$SYSTEMD" ]; then
if systemctl enable shorewall6-lite; then
echo "Shorewall6 Lite will start automatically at boot"
fi
elif [ -x /sbin/insserv -o -x /usr/sbin/insserv ]; then
if insserv /etc/init.d/shorewall6-lite ; then
echo "Shorewall6 Lite will start automatically at boot"
else

View File

@ -81,6 +81,8 @@ if [ -n "$FIREWALL" ]; then
insserv -r $FIREWALL
elif [ -x /sbin/chkconfig -o -x /usr/sbin/chkconfig ]; then
chkconfig --del $(basename $FIREWALL)
elif [ -x /sbin/systemctl ]; then
systemctl disable shorewall6-lite
else
rm -f /etc/rc*.d/*$(basename $FIREWALL)
fi
@ -100,6 +102,7 @@ rm -rf /usr/share/shorewall6-lite
rm -rf ${LIBEXEC}/shorewall6-lite
rm -rf /usr/share/shorewall6-lite-*.bkout
rm -f /etc/logrotate.d/shorewall6-lite
rm -f /lib/systemd/system/shorewall6-lite.service
echo "Shorewall6 Lite Uninstalled"

View File

@ -258,6 +258,14 @@ else
fi
fi
if [ -z "$DESTDIR" ]; then
if [ -f /lib/systemd/system ]; then
SYSTEMD=Yes
fi
elif [ -n "$SYSTEMD" ]; then
mkdir -p ${DESTDIR}/lib/systemd/system
fi
#
# Change to the directory containing this script
#
@ -327,6 +335,14 @@ if [ -n "$DESTDIR" ]; then
chmod 755 ${DESTDIR}/etc/logrotate.d
fi
#
# Install the .service file
#
if [ -n "$SYSTEMD" ]; then
run_install $OWNERSHIP -m 600 shorewall6.service ${DESTDIR}/lib/systemd/system/shorewall6.service
echo "Service file installed as ${DESTDIR}/lib/systemd/system/shorewall6.service"
fi
delete_file ${DESTDIR}/usr/share/shorewall6/compiler
delete_file ${DESTDIR}/usr/share/shorewall6/lib.accounting
delete_file ${DESTDIR}/usr/share/shorewall6/lib.actions
@ -878,7 +894,11 @@ if [ -z "$DESTDIR" -a -n "$first_install" -a -z "${CYGWIN}${MAC}" ]; then
touch /var/log/shorewall6-init.log
perl -p -w -i -e 's/^STARTUP_ENABLED=No/STARTUP_ENABLED=Yes/;s/^IP_FORWARDING=On/IP_FORWARDING=Keep/;s/^SUBSYSLOCK=.*/SUBSYSLOCK=/;' /etc/shorewall6/shorewall6.conf
else
if [ -x /sbin/insserv -o -x /usr/sbin/insserv ]; then
if [ -n "$SYSTEMD" ]; then
if systemctl enable shorewall6; then
echo "Shorewall6 will start automatically at boot"
fi
elif [ -x /sbin/insserv -o -x /usr/sbin/insserv ]; then
if insserv /etc/init.d/shorewall6 ; then
echo "shorewall6 will start automatically at boot"
echo "Set STARTUP_ENABLED=Yes in /etc/shorewall6/shorewall6.conf to enable"

View File

@ -93,6 +93,8 @@ if [ -n "$FIREWALL" ]; then
insserv -r $FIREWALL
elif [ -x /sbin/chkconfig -o -x /usr/sbin/chkconfig ]; then
chkconfig --del $(basename $FIREWALL)
elif [ -x /sbin/systemctl ]; then
systemctl disable shorewall6
else
rm -f /etc/rc*.d/*$(basename $FIREWALL)
fi
@ -114,6 +116,7 @@ rm -rf /usr/share/shorewall6-*.bkout
rm -rf /usr/share/man/man5/shorewall6*
rm -rf /usr/share/man/man8/shorewall6*
rm -f /etc/logrotate.d/shorewall6
rm -f /lib/systemd/system/shorewall6.service
echo "Shorewall6 Uninstalled"