#!/bin/sh

# Read system-wide bash profile from /etc
. /etc/profile

export HOME=/root
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin:/usr/local/sbin:/usr/local/bin

# Display a pretty background image
xloadimage -onroot /etc/X11/xinit/ads_background.gif 2>&1 >/dev/null

# De-activate screen blanking so that the backlight (and power LED)
# stays on; turn off "screensaver"
xset s off
xset s noblank

# Calibrate the touchscreen
if [ -z "$TSLIB_ENABLE" ]; then
	/etc/X11/xcalibrate/xcalibrate.sh
else
	# TSLIB_TSDEVICE needs to be set before X server is started
	if [ ! -f /etc/pointercal ]; then
		ts_calibrate
	fi
fi

# Load resources for lwm
xrdb -nocpp -load /root/.Xdefaults

# Watch for webcam
/etc/X11/adslauncher/cam_watch.sh&

# Start windowmanager and a terminal
/etc/X11/adslauncher/adsmenu.py &
lwm >/dev/null 2>&1
