[Zrouter-src] ZRouter.org: push to ZRouter profiles/SMALL_/files/etc/rc.d/FILE...
zrouter-src at zrouter.org
zrouter-src at zrouter.org
Sun Feb 5 00:31:45 UTC 2012
details: http://zrouter.org/hg/zrouter//rev/d91a937bfaa6
changeset: 338:d91a937bfaa6
user: ray at terran.dlink.ua
date: Sun Feb 05 02:31:44 2012 +0200
description:
Enable dual run of rc.d scripts:
first run for geting filesystems (ramfs /etc in ZRouter.org case)
second run for other scripts + loaded to /etc unionfs.
Fix correct order of FS/ifconfig/syslogd run.
Enable break by serial Break sequence.
diffstat:
profiles/SMALL_/files/etc/rc.d/FILESYSTEMS | 12 ++++
profiles/SMALL_/files/etc/rc.d/MAIN | 80 +++++++-------------------
profiles/SMALL_/files/etc/rc.d/mountcritlocal | 42 ++++++++++++++
3 files changed, 77 insertions(+), 57 deletions(-)
diffs (164 lines):
diff -r ed2ce8f40167 -r d91a937bfaa6 profiles/SMALL_/files/etc/rc.d/FILESYSTEMS
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/profiles/SMALL_/files/etc/rc.d/FILESYSTEMS Sun Feb 05 02:31:44 2012 +0200
@@ -0,0 +1,12 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: FILESYSTEMS
+# REQUIRE: root mountcritlocal zfs
+
+# This is a dummy dependency, for services which require file systems
+# to be mounted before starting. It also serves as the default early /
+# late divider; after this point, rc.d directories are rescanned to
+# catch scripts from other file systems than /.
diff -r ed2ce8f40167 -r d91a937bfaa6 profiles/SMALL_/files/etc/rc.d/MAIN
--- a/profiles/SMALL_/files/etc/rc.d/MAIN Sun Feb 05 01:32:48 2012 +0200
+++ b/profiles/SMALL_/files/etc/rc.d/MAIN Sun Feb 05 02:31:44 2012 +0200
@@ -1,74 +1,40 @@
#!/bin/sh
# PROVIDE: MAIN
-# REQUIRE: ADAPTATION
+# REQUIRE: ADAPTATION FILESYSTEMS
. /etc/rc.subr
. /etc/network.subr
name="MAIN"
start_cmd="main_start"
-start_precmd="main_prestart"
-start_postcmd="main_poststart"
-stop_cmd="main_stop"
-
-main_prestart()
-{
- stty status '^T'
- sysctl kern.coredump=0
- sysctl net.inet.ip.forwarding=1
-
- md=`/sbin/mdconfig -a -t malloc -s 10m`
- newfs -b 4096 -f 512 -n -o space /dev/${md} > /dev/null
- mount /dev/${md} /tmp
-
- mkdir -p /tmp/etc
- mkdir -p /tmp/var/empty
- mkdir -p /tmp/var/log
- mkdir -p /tmp/var/run
- mkdir -p /tmp/var/spool/lock
- touch /tmp/var/log/all.log
-
- syslogd -s
-
- mount_unionfs /tmp/etc /etc
-
- if [ -c /dev/map/config ]; then
- dd if=/dev/map/config of=/tmp/etc.tar.gz;
- cd /tmp/ && tar xvzf /tmp/etc.tar.gz
- else
- if [ -c /dev/redboot/config ]; then
- dd if=/dev/redboot/config of=/tmp/etc.tar.gz;
- cd /tmp/ && tar xvzf /tmp/etc.tar.gz
- fi
- fi
-
- kldload ipfw
- ipfw add 65000 allow all from any to any
- ifconfig lo0 127.0.0.1/8
- #ifconfig rt0 192.168.0.28/24
- mpd --background
-
- inetd -wW
-
-}
main_start()
{
-}
+ # Disable saving core files
+ sysctl kern.coredump=0
+ # Allow routing/forwarding
+ sysctl net.inet.ip.forwarding=1
+ # XXX: for debug, breakpoint on Break sequence
+ sysctl debug.kdb.break_to_debugger=1
-main_poststart()
-{
-}
+ # Load ipfw
+ # XXX: Should be separate script
+ kldload ipfw
+ # XXX: for debug only
+ ipfw add 65000 allow all from any to any
-main_stop()
-{
- if [ -c /dev/map/config ]; then
- cd /tmp/ && tar cvzf /tmp/etc.tar.gz etc/* ;
- sysctl hw.cfi.rdonly=0
- dd if=/tmp/etc.tar.gz of=/dev/map/config bs=64k conv=sync ;
- sysctl hw.cfi.rdonly=1
- fi
+ # Configure local interface
+ ifconfig lo0 127.0.0.1/8
+
+ # Run syslogd
+ syslogd -s
+
+ # Run empty MPD
+ mpd --background
+
+ # Run inetd
+ inetd -wW
}
load_rc_config $name
diff -r ed2ce8f40167 -r d91a937bfaa6 profiles/SMALL_/files/etc/rc.d/mountcritlocal
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/profiles/SMALL_/files/etc/rc.d/mountcritlocal Sun Feb 05 02:31:44 2012 +0200
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+# PROVIDE: mountcritlocal
+
+. /etc/rc.subr
+. /etc/network.subr
+
+name="MAIN"
+start_cmd="mountcritlocal_start"
+
+mountcritlocal_start()
+{
+ # XXX: check TMPFS again
+ # XXX: get useful size: small for /etc or big for upgrade
+ md=`/sbin/mdconfig -a -t malloc -s 10m`
+ newfs -b 4096 -f 512 -n -o space /dev/${md} > /dev/null
+ mount /dev/${md} /tmp
+
+ mkdir -p /tmp/etc
+ mkdir -p /tmp/var/empty
+ mkdir -p /tmp/var/log
+ mkdir -p /tmp/var/run
+ mkdir -p /tmp/var/spool/lock
+ touch /tmp/var/log/all.log
+
+ mount_unionfs /tmp/etc /etc
+
+ if [ -c /dev/map/config ]; then
+ dd if=/dev/map/config of=/tmp/etc.tar.gz;
+ cd /tmp/ && tar xvzf /tmp/etc.tar.gz
+ else
+ if [ -c /dev/redboot/config ]; then
+ dd if=/dev/redboot/config of=/tmp/etc.tar.gz;
+ cd /tmp/ && tar xvzf /tmp/etc.tar.gz
+ fi
+ fi
+
+}
+
+load_rc_config $name
+
+run_rc_command $*
\ No newline at end of file
More information about the Zrouter-src
mailing list