#! /bin/sh

PREREQ=""
DESCRIPTION="Disabling sabayon, italc and nanny... Adding LTSP-Live launcher"

prereqs()
{
    echo "$PREREQ"
}

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

. /scripts/casper-functions
load_confmodule

log_begin_msg "$DESCRIPTION"

# Disable nanny
if [ -x /root/etc/init.d/nanny ]; then
    chroot /root update-rc.d -f nanny remove
    rm /root/etc/xdg/autostart/nanny-systray.desktop
fi

# Disable iTalc
if [ -f /root/etc/xdg/autostart/ica.desktop ]; then
    rm /root/etc/xdg/autostart/ica.desktop
fi

# Disable sabayon
if [ -f /root/etc/X11/Xsession.d/60sabayon_apply ]; then
    rm /root/etc/X11/Xsession.d/60sabayon_apply
fi

# Adding LTSP-Live launcher to unity
if [ -f /root/usr/share/glib-2.0/schemas/com.canonical.Unity.gschema.xml ]; then
    sed -i "s/'ubiquity-gtkui.desktop',/'ubiquity-gtkui.desktop', 'ltsp-live.desktop',/g" /root/usr/share/glib-2.0/schemas/com.canonical.Unity.gschema.xml
    chroot /root glib-compile-schemas /usr/share/glib-2.0/schemas/
fi

log_end_msg
