#!/bin/ksh
#ifdef __USAGE
#%C [options]
#
#Options:
# -c cd  where cd is the mount point of the CDROM. (default /cd)
#endif
#

me=${0##*/}
print_usage ()
{
	echo "$me [options]"
	echo
	echo "Options:"
	echo " -c cd   use "cd" as moint point of CDROM."
	echo
	exit 0
}

SRCDIR="/`echo $0 | cut -f 4 -d '/'`"
if test ! -d "$SRCDIR/cdphoton"
then
	SRCDIR="/cd"	
fi

while getopts c: opt $*
do
	case $opt in
		 c) SRCDIR="$OPTARG" ;;
		\?) echo ; echo ; print_usage ;;
	esac
done


cd $SRCDIR/cdphoton

mkdir -p /etc/config/trap 
cp ./bin/safe /etc/config/trap/safe.$NODE

if test -r "/dev/photon"
then
	$SRCDIR/bin/pkginstall -F $SRCDIR/archives/qnx4.x86
else
	export PHOTON_PATH=$SRCDIR/cdphoton
	export PATH=$PHOTON_PATH/bin:$PATH
	export PHOTON=/dev/photon
	export INPUTOPTS=-b

	./bin/phlib_s11
	./bin/Aplib_s11
	./bin/Photon &
	./bin/phfontphf -c70k -M &
	./bin/vesabios.ms -i0x12 &
	./bin/Pg.vga4 -HNqnx/crt -g640x480x4 -A0xA0000,0x10000 -WB80 &
	./bin/Input kbd -R fd -d/dev/kbd &
	./bin/pwm &
	$SRCDIR/bin/pkginstall -F $SRCDIR/archives/qnx4.x86
	slay -shup Photon
	slay -f Input
	rm -f /dev/shmem/phlib_s11
	rm -f /dev/shmem/Aplib_s11
fi


