#!/bin/dash

##############################
## INITIALISATION STAGE 1.5 ##
##############################

## Callum Dickinson <gcfreak_ag20@hotmail.com>
## Sonic Team Junior <http://www.srb2.org>
## http://mb.srb2.org/showthread.php?t=31137
## svn://code.srb2.org/SRB2/branches/WII

## This program is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License
## as published by the Free Software Foundation; either version 2
## of the License, or (at your option) any later version.

## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.


## Any lines in this file preceeded by a hash ('#') indicates a comment, and is not read by the shell parser.

## Run ldconfig for first SRB2Wii run, then continue with init since otherwise the system will not boot.
die ()
{
	. /etc/profile
	[ -f /bin/dash ] && SHELL=/bin/dash || SHELL=/bin/sh
	/bin/echo "Initialisation stage 1.5 failed: $*"
	/bin/echo "Dropping to shell '$SHELL'..."
	exec $SHELL
	/sbin/reboot
}
LD_LIBRARY_PATH="/lib:/usr/lib"
FIRSTSTART="yes"
export LD_LIBRARY_PATH FIRSTSTART
/sbin/ldconfig -X -C /etc/ld.so.cache -f /etc/ld.so.conf || die "ldconfig failed for init 1.5"
/bin/mount -n -t proc proc /proc
/bin/mount -n -t sysfs sysfs /sys
/sbin/mdev -s
exec /sbin/init
