#
# thomas@linuxmuster.net
# 20161021
# GPL v3
#
# stop all relevant services

echo "### 01_stop-services prepatch"

# remove acls on $SHAREHOME
if [ "$i" = "--first" ]; then
 setfacl -b "$SHAREHOME"
 rm -f "$ROOM_SHARE_ACLS"
fi

services="linuxmuster-base tftpd-hpa bittorrent rsync linbo-bittorrent \
          linbo-multicast nagios3 atd cron rembo quota apache2 cups \
          clamav-freshclam clamav-daemon cyrus-imapd postfix saslauthd amavis \
          mysql openntpd ssh samba slapd postgresql nscd portmap \
          openbsd-inetd bind9 isc-dhcp-server dbus"

# make sure they are enabled to be able to shut them down
[ -e /etc/default/rsync ] && sed -e 's/^RSYNC_ENABLE=.*/RSYNC_ENABLE=true/' -i /etc/default/rsync

for service in $services; do
 [ -e "/etc/init.d/$service" ] && /etc/init.d/$service stop
 [ -e "/etc/init/$service.conf" ] && stop $service
done
