#!/bin/sh
# Copyright 2011 Paul Parsons
# Distributed under the terms of the GNU General Public License v3 or later

depend="virtfs"
service --depend ${depend} || exit 1

case $1 in
"start")
	mount -n -o mode=0755 -t devtmpfs none /dev

	mkdir -p /dev/pts
	mount -n -o gid=tty,mode=0620 -t devpts none /dev/pts
	mkdir -p /dev/shm
	mount -n -t tmpfs none /dev/shm

	for i in 0 1 2 3
	do
		if [ -d /sys/devices/platform/gpio-keys/input/input${i} ]
		then
			ln -s event${i} /dev/input/gpio-keys
		elif [ -d /sys/devices/platform/pxa2xx-spi.2/spi_master/spi2/spi2.0/input/input${i} ]
		then
			ln -s event${i} /dev/input/pxa2xx-spi.2
		elif [ -d /sys/devices/platform/navpoint/input/input${i} ]
		then
			ln -s event${i} /dev/input/navpoint
		fi
	done

	if [ -d /dev/snd ]
	then
		cd /dev/snd
		chown root:audio *
		chmod 660 *
	fi
	;;
"stop")
	;;
esac

exit 0
