#!/bin/sh
mount -t proc none /proc
mount -t sysfs none /sys
export PATH=/usr/bin:/usr/sbin:/bin:/sbin:/usr/local/bin

# Bootup message

dd if=/etc/fbbootimage of=/dev/fb0 

# X server and clients setup

export TSLIB_TSDEVICE=/dev/input/event0
export TSLIB_CONFFILE=/usr/share/tslib/ts.conf-h3600
export DISPLAY=:0

# Mount the USB key - hope it is ready yet
# To be safe, wait for 5 seconds first
# Better: mount it with udev!

sleep 20
mount -o rw /dev/sda1 /media/usbdisk
mount -o loop,ro /media/usbdisk/admin/usr.img /usr

# DISABLED BECAUSE TOO SLOW: 4 MINUTES WITH 2.6.15!!!
# Load the USB gadget mass storage module
# Doesn't work if built in the kernel
# Perhaps because / is not mounted yet

# insmod /root/g_file_storage.ko file=/dev/sda1 removable=y luns=1

# Display that the graphics are being started

dd if=/etc/fbstartximage of=/dev/fb0 

# Start the graphics

/etc/X11/Xserver &
/usr/bin/gpe-confd &

# Calibrate the touchscreen if not done yet

if [ ! -e /media/usbdisk/admin/pointercal ]; then
  echo "First time: calibrate the touchscreen"
  /usr/bin/xtscal -rotate 90
  cp /etc/pointercal /media/usbdisk/admin/pointercal
else
  cp /media/usbdisk/admin/pointercal /etc/pointercal
  sync
fi

# Start the window manager
 
/usr/bin/x-window-manager &

# Start the image viewer and slideshow

/usr/bin/gpe-gallery /media/usbdisk/photos &

# Start a new shell in the console

/bin/sh
