#!/bin/sh

PREREQ=""
prereqs()
{
	echo "$PREREQ"
}
case $1 in
# get pre-requisites
prereqs)
	prereqs
	exit 0
	;;
esac

silent()
{
	if test -c /dev/null; then
		"$@" >/dev/null 2>&1
	else
		"$@" 2>&1 | read dummyvar
	fi
}

test -x /sbin/splashy || exit
SPLASH=false
SINGLE=false
for x in $(cat /proc/cmdline); do
    case $x in
        splash*)
            SPLASH=true
        ;;
        single=*)
            SINGLE=true
        ;;
    esac
done
test $SINGLE = "false" || exit
test $SPLASH = "true" || exit

depmod -a
silent modprobe fbcon
silent modprobe vesafb

if [ -e /proc/fb ]; then
        while read fbno desc; do
                mknod /dev/fb${fbno} c 29 ${fbno}
        done < /proc/fb
else
        mknod /dev/fb0 c 29 0
fi

for i in 0 1 2 3 4 5 6 7 8; do
	test -c /dev/tty${i} || \
            mknod /dev/tty${i} c 4 ${i}
done

# [ tdykstra ]
# This is supposed to replace the test for vga=
# on the command line. Didn't test it much...
grep -q '\(VESA\|VGA\)' /proc/fb || exit

/sbin/splashy boot

