#!/bin/sh
# 
if [ ! -x /usr/X11R6/bin/Xfbdev ] ; then exit 0 ; fi

. /etc/profile

killproc() {            # kill the named process(es)
        pid=`/bin/ps -e |
             /bin/grep $1 |
             /bin/sed -e 's/^  *//' -e 's/ .*//'`
        [ "$pid" != "" ] && kill $pid
}
export USER=root
export HOME=/root
export XAPPLRESDIR=/usr/X11R6/lib/app-defaults
export XFILESEARCHPATH=./%N%S%C.ad:/usr/X11R6/lib/X11/%L/%T/%N%S%C:/usr/X11R6/lib/X11/%l/%T/%N%S%C:/usr/X11R6/lib/X11/%T/%N%S%C:./%N%S.ad:/usr/X11R6/lib/X11/%L/%T/%N%S:/usr/X11R6/lib/X11/%l/%T/%N%S:/usr/X11R6/lib/X11/%T/%N%S:/usr/local/lib/X11/app-defaults/%N%S%C.ad

case $1 in
'start')
	echo "Starting X..."
	echo "Starting X..." > /dev/vc/0

	cd $HOME

	Xfbdev -screen 320x240 -dpi 100 > /dev/null 2> /dev/null&
	bl 1 1 32

	(cd familiar ; ./splash )

	blackbox > /dev/null 2> /dev/null &

	xset s 30 180

	# -nocpp since there is no C pre-processor.
	xrdb -load -nocpp < /etc/X11/Xdefaults
	xmodmap /usr/X11R6/include/keymap

	fstroke > /dev/null 2> /dev/null &
	bbrun &
	;;
'stop')
        echo "Killing X..."
        killproc Xfbdev
        ;;
*)
        echo "usage: $0 { start | stop }"
        ;;
esac

