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

View File

@ -73,6 +73,8 @@ if [ -n "$INITSCRIPT" ]; then
insserv -r $INITSCRIPT insserv -r $INITSCRIPT
elif [ -x /sbin/chkconfig -o -x /usr/sbin/chkconfig ]; then elif [ -x /sbin/chkconfig -o -x /usr/sbin/chkconfig ]; then
chkconfig --del $(basename $INITSCRIPT) chkconfig --del $(basename $INITSCRIPT)
elif [ -x /sbin/systemctl ]; then
systemctl disable shorewall-init
else else
rm -f /etc/rc*.d/*$(basename $INITSCRIPT) rm -f /etc/rc*.d/*$(basename $INITSCRIPT)
fi 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-up.d/shorewall
remove_file /etc/sysconfig/network/if-down.d/shorewall remove_file /etc/sysconfig/network/if-down.d/shorewall
remove_file /lib/systemd/system/shorewall.service
if [ -d /etc/ppp ]; then if [ -d /etc/ppp ]; then
for directory in ip-up.d ip-down.d ipv6-up.d ipv6-down.d; do 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 ARCHLINUX=yes
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 # Change to the directory containing this script
# #
@ -251,6 +259,14 @@ if [ -n "$DESTDIR" ]; then
chmod 755 ${DESTDIR}/etc/logrotate.d chmod 755 ${DESTDIR}/etc/logrotate.d
fi 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 # Install the config file
# #
@ -391,7 +407,11 @@ if [ -z "$DESTDIR" ]; then
echo "Shorewall Lite will start automatically at boot" echo "Shorewall Lite will start automatically at boot"
else 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 if insserv /etc/init.d/shorewall-lite ; then
echo "Shorewall Lite will start automatically at boot" echo "Shorewall Lite will start automatically at boot"
else else

View File

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

View File

@ -248,7 +248,7 @@ else
echo "Installing Debian-specific configuration..." echo "Installing Debian-specific configuration..."
DEBIAN=yes DEBIAN=yes
SPARSE=yes SPARSE=yes
elif [ -f /etc/redhat-version ]; then elif [ -f /etc/redhat-release ]; then
echo "Installing Redhat/Fedora-specific configuration..." echo "Installing Redhat/Fedora-specific configuration..."
FEDORA=yes FEDORA=yes
elif [ -f /etc/slackware-version ] ; then elif [ -f /etc/slackware-version ] ; then
@ -265,6 +265,14 @@ else
fi fi
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 # Change to the directory containing this script
# #
@ -338,6 +346,14 @@ if [ -n "$DESTDIR" ]; then
chmod 755 ${DESTDIR}/etc/logrotate.d chmod 755 ${DESTDIR}/etc/logrotate.d
fi 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 if [ -n "$ANNOTATED" ]; then
suffix=.annotated suffix=.annotated
else else
@ -1002,7 +1018,11 @@ if [ -z "$DESTDIR" -a -n "$first_install" -a -z "${CYGWIN}${MAC}" ]; then
touch /var/log/shorewall-init.log 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 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 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 if insserv /etc/init.d/shorewall ; then
echo "shorewall will start automatically at boot" echo "shorewall will start automatically at boot"
echo "Set STARTUP_ENABLED=Yes in /etc/shorewall/shorewall.conf to enable" 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 updaterc.d shorewall remove
elif [ -x /sbin/insserv -o -x /usr/sbin/insserv ]; then elif [ -x /sbin/insserv -o -x /usr/sbin/insserv ]; then
insserv -r $FIREWALL insserv -r $FIREWALL
elif [ -x /sbin/systemctl ]; then
systemctl disable shorewall
elif [ -x /sbin/chkconfig -o -x /usr/sbin/chkconfig ]; then elif [ -x /sbin/chkconfig -o -x /usr/sbin/chkconfig ]; then
chkconfig --del $(basename $FIREWALL) chkconfig --del $(basename $FIREWALL)
else else
@ -116,6 +118,7 @@ rm -rf /usr/share/shorewall-*.bkout
rm -rf /usr/share/man/man5/shorewall* rm -rf /usr/share/man/man5/shorewall*
rm -rf /usr/share/man/man8/shorewall* rm -rf /usr/share/man/man8/shorewall*
rm -f /etc/logrotate.d/shorewall rm -f /etc/logrotate.d/shorewall
rm -f /lib/systemd/system/shorewall.service
echo "Shorewall Uninstalled" echo "Shorewall Uninstalled"

View File

@ -182,6 +182,14 @@ elif [ -f /etc/arch-release ] ; then
ARCHLINUX=yes ARCHLINUX=yes
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 # Change to the directory containing this script
# #
@ -251,6 +259,14 @@ if [ -n "$DESTDIR" ]; then
chmod 755 ${DESTDIR}/etc/logrotate.d chmod 755 ${DESTDIR}/etc/logrotate.d
fi 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 # Install the config file
# #
@ -384,7 +400,11 @@ if [ -z "$DESTDIR" ]; then
echo "Shorewall6 Lite will start automatically at boot" echo "Shorewall6 Lite will start automatically at boot"
else 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 if insserv /etc/init.d/shorewall6-lite ; then
echo "Shorewall6 Lite will start automatically at boot" echo "Shorewall6 Lite will start automatically at boot"
else else

View File

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

View File

@ -258,6 +258,14 @@ else
fi fi
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 # Change to the directory containing this script
# #
@ -327,6 +335,14 @@ if [ -n "$DESTDIR" ]; then
chmod 755 ${DESTDIR}/etc/logrotate.d chmod 755 ${DESTDIR}/etc/logrotate.d
fi 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/compiler
delete_file ${DESTDIR}/usr/share/shorewall6/lib.accounting delete_file ${DESTDIR}/usr/share/shorewall6/lib.accounting
delete_file ${DESTDIR}/usr/share/shorewall6/lib.actions 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 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 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 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 if insserv /etc/init.d/shorewall6 ; then
echo "shorewall6 will start automatically at boot" echo "shorewall6 will start automatically at boot"
echo "Set STARTUP_ENABLED=Yes in /etc/shorewall6/shorewall6.conf to enable" 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 insserv -r $FIREWALL
elif [ -x /sbin/chkconfig -o -x /usr/sbin/chkconfig ]; then elif [ -x /sbin/chkconfig -o -x /usr/sbin/chkconfig ]; then
chkconfig --del $(basename $FIREWALL) chkconfig --del $(basename $FIREWALL)
elif [ -x /sbin/systemctl ]; then
systemctl disable shorewall6
else else
rm -f /etc/rc*.d/*$(basename $FIREWALL) rm -f /etc/rc*.d/*$(basename $FIREWALL)
fi fi
@ -114,6 +116,7 @@ rm -rf /usr/share/shorewall6-*.bkout
rm -rf /usr/share/man/man5/shorewall6* rm -rf /usr/share/man/man5/shorewall6*
rm -rf /usr/share/man/man8/shorewall6* rm -rf /usr/share/man/man8/shorewall6*
rm -f /etc/logrotate.d/shorewall6 rm -f /etc/logrotate.d/shorewall6
rm -f /lib/systemd/system/shorewall6.service
echo "Shorewall6 Uninstalled" echo "Shorewall6 Uninstalled"