#!/bin/sh # activate the loopback /sbin/ifconfig lo 127.0.0.1 # clear the mtab >/etc/mtab /bin/mount -t proc proc /proc /bin/mount -t sysfs sysfs /sys /bin/mount -t jffs2 /dev/mtdblock6 /persistent # checking to see if HOSTNAME exists. If not, recreate if [ ! -f persistent/etc/HOSTNAME ] ; then echo warp > persistent/etc/HOSTNAME fi # checking to see if hosts file exists. If not, recreate if [ ! -f /persistent/etc/hosts ]; then echo 127.0.0.1 localhost > /persistent/etc/hosts fi # link back the configuration files for f in `ls /persistent/etc/`; do ln -fs /persistent/etc/$f /etc done if [ -d /persistent/service ]; then for f in `ls /persistent/service/`; do ln -fs /persistent/service/$f /service done fi # Make sure this exists mkdir -p /service # set the hostname /bin/hostname `cat /etc/HOSTNAME` ln -sf /persistent/root / # mount all paritions except those marked noauto in /etc/fstab mount -a ln -fs /tmp /var mount_sd () { # Do we even have the driver installed? if [ ! -f /proc/driver/pikasd ] ; then echo "No pikasd driver" return 1 fi # Is there a card preset? CARD_PRESENT=`cat /proc/driver/pikasd` if [ "$CARD_PRESENT" = 0 ] ; then echo "No SD Card present" return 1 fi # Wait for the card to be initialized while ! ls /sys/bus/mmc/devices/mmc* >/dev/null 2>/dev/null ; do sleep 1 done # Mount the partitions for dev in `fgrep mmcblk0 /etc/fstab | cut -f1` ; do dir=`fgrep $dev /etc/fstab | awk '{ print $2; }'` type=`fgrep $dev /etc/fstab | awk '{ print $3; }'` mount -t $type $dev $dir done } # attempt to mount the SD card mount_sd # set the environment variables source /persistent/etc/localenv # scan autorun folder and execute all shell scripts in alphabetical order for filename in `ls /persistent/autorun/*`; do if [ -x "$filename" ]; then . $filename; fi done chmod 777 /mnt/sd chmod 777 /mnt/usb # start watchdog watchdog -t5 /dev/watchdog if [ -x /etc/rc.local ]; then . /etc/rc.local fi