#!/bin/sh
. /boot.conf
test "$LOG_START" && echo "<*> Executing '$0 $*'"

cd /etc/rc.d

ctrlaltdel soft

./mount_virt
./cfg_hostname	# need this early to get per-hostname conf
./check_fs
./mount_local
./load_modules_local

test "$1" = "0" && exit 0

./cfg_ip	 # NB: don't spawn daemons, even dhcp client

test "$1" = "1" && exit 0

#NB: needed for NFS mounts (unless you use -o nolock)
./daemon_portmap
./mount_remote
./mount_bind  # may bind /.local to per ws storage
./mount_volatile # /.volatile
# now: fs structure is fully mounted, /etc, /var, /tmp are writable
./cfg_clock  # not later: we'll have screwed up syslog times
./cfg_swap
./clean_fs_remote  # we can clean our private files on server now
./refresh_etc
./load_modules_remote  # if your modules are on server

test "$1" = "2" && exit 0

./daemon_inetd
./daemon_service
