#!/bin/sh

## live-config(7) - System Configuration Scripts
## Copyright (C) 2006-2012 Daniel Baumann <daniel@debian.org>
##
## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
## This is free software, and you are welcome to redistribute it
## under certain conditions; see COPYING for details.

## 0155-xinit-disable
## temporary fix to stop xinit running
## David Hare Dec 2011

Xinit_disable ()
{

# for some reason 0150-xinit does not recognise "${_X11}" ...
# _X11="true" should have been exported if a dm was found
# then xinit gets configured when it should not be
# run this after 0150-xinit to disable xinit

if [ -e /var/lib/live/config/tdm-trinity ] || [ -e /var/lib/live/config/kdm ] || \
	[ -e /var/lib/live/config/gdm ] || [ -e /var/lib/live/config/gdm3 ] || [ -e /var/lib/live/config/lightdm ] || \
	[ -e /var/lib/live/config/lxdm ] || [ -e /var/lib/live/config/nodm ] || [ -e /var/lib/live/config/slim ]
then

    if [ -e /var/lib/live/config/xinit ] && [ -e /etc/profile.d/zz-live.sh ]; then

	# Disable xinit, reverse what 0150-xinit did
	rm -f /etc/profile.d/zz-live.sh

	# Make state file
	touch /var/lib/live/config/xinit-disable

	return

    fi
fi

}

Xinit_disable
