#!/bin/sh

PREREQ=""
DESCRIPTION="Disabling unnecessary services..."

prereqs()
{
       echo "$PREREQ"
}

case $1 in
# get pre-requisites
prereqs)
       prereqs
       exit 0
       ;;
esac

. /scripts/casper-functions

log_begin_msg "$DESCRIPTION"

#Mythbuntu specific
if [ -d "/root/usr/share/mythbuntu" ]; then
    SERVICES="mythtv-backend mysql apache2 ntp samba ssh"
    for service in $SERVICES
    do
        if [ -f "/root/etc/init/$service.conf" ]; then
            mv /root/etc/init/$service.conf /root/etc/init/$service.conf.disabled
        if [ -f "/root/etc/systemd/system/multi-user.target.wants/$service.service" ]; then
            rm /root/etc/systemd/system/multi-user.target.wants/$service.service 
        elif [ -f "/root/etc/init.d/$service" ]; then
            chroot /root update-rc.d -f $service remove
        fi
    done
    #we don't want popups about updates or media found at all.
    rm -f /root/etc/xdg/autostart/update-notifier.desktop
fi

log_end_msg
