Default openNAS Startup

 

::sysinit:/bin/mount -n -t proc proc /proc
::sysinit:/etc/load_config.sh

::sysinit:/bin/hostname -F /etc/hostname
::sysinit:/etc/create_files.sh

::sysinit:/etc/init.d/rcS

::askfirst:-/bin/sh

::restart:/sbin/init

::ctrlaltdel:/etc/init.d/rcK
::ctrlaltdel:/etc/save_config.sh
::ctrlaltdel:/sbin/reboot

::shutdown:/etc/init.d/rcK
::shutdown:/etc/save_config.sh

1. mount proc

2. load_config.sh

echo " *** Load Config ***>> "

/sbin/expand /ramfs.img /dev/ram1
/sbin/expand /ramfs.img /dev/ram0

/bin/mount -n -t ext2 /dev/ram0 /var
/bin/rm -r /var/lost+found

/bin/mount -n -t ext2 /dev/ram1 /flash
/bin/rm -r /flash/lost+found

/bin/cp -a /etc/* /flash > /dev/null 2>&1
/bin/umount /flash

/bin/mount -n -t ext2 /dev/ram1 /etc

/bin/dd if=/dev/mtd3 of=/var/etc.tgz >/dev/null 2>&1
cd /var;/bin/gunzip etc.tgz;tar -xf etc.tar -C / > /dev/null 2>&1 || echo "   *** Restore Config failed ***>>"
rm /var/etc.tar

3. set hostname from /etc/hostname

4. create_files.sh

#!/bin/sh

/bin/mkdir /var/log
/bin/mkdir /var/lock
/bin/mkdir /var/run
/bin/mkdir /var/tmp
/bin/mkdir /var/sm
/bin/mkdir /var/state
/bin/touch /var/sm/sm.bak
/bin/touch /var/run/xtab
/bin/touch /var/run/etab
/bin/touch /var/run/rmtab

5. /etc/init.d/rcS – start scripts in init.d by default:

#!/bin/sh
# Start all init scripts in /etc/init.d
# executing them in numerical order.
#
for i in /etc/init.d/S??* ;do

	 # Ignore dangling symlinks (if any).
	 [ ! -f "$i" ] && continue

	 case "$i" in
	*.sh)
	    # Source shell script for speed.
	    (
		trap - INT QUIT TSTP
		set start
		. $i
	    )
	    ;;
	*)
	    # No sh extension, so fork subprocess.
	    $i start
	    ;;
	esac
done

echo " *** Start User Init ***>>"
/mnt/user/user_init.sh || echo "   *** Can't start user_init.sh! ***>>"