#!/bin/sh

mount -w /proc /proc -t proc
mount -t devpts devpts /dev/pts
mount -t sysfs sys /sys
if [ ! -f /etc/rc.d/rc.rofilesys -o ! -x /etc/rc.d/rc.rofilesys ];then   
    mount -o remount -w %root% /
fi

# Run all rc.* files apart rc.local in /etc/rc.d
cd /etc/rc.d
for I in rc.rofilesys rc.modules rc.serial;do
  if [ -f ./$I ];then
    if [ -x ./$I ];then
      echo "*** Running $I"
      ./$I
    fi
  fi
done

#echo -n "Mounting local file-systems... "
#mount -a -t nonfs
#echo done

# Start all files in /etc/rc.d/init.d
cd /etc/rc.d/init.d
for I in *;do
  if [ -f ./$I ];then
    if [ -x ./$I ];then
      echo "*** Attempting to start $I"
      ./$I start
    fi
  fi
done

#echo -n "Mounting remote file-systems... "
#mount -a -t nfs
#echo done

# Finish by running rc.local
cd /etc/rc.d
if [ -f "./rc.local" ];then
  if [ -x "./rc.local" ];then
    echo "*** Running rc.local"
    ./rc.local
  fi
fi
