/proc needs to be mounted before preinit.arch for failsafe
[openwrt/staging/chunkeey.git] / package / base-files / files / etc / preinit
index c60a0f850f6e7f8e57b0dad94fc95732f1d6bbc0..d1a6ffd549d3572d14d6abb648e21d2357cc31af 100755 (executable)
@@ -1,6 +1,23 @@
 #!/bin/sh
 # Copyright (C) 2006 OpenWrt.org
 export PATH=/bin:/sbin:/usr/bin:/usr/sbin
+. /etc/diag.sh
+
+failsafe() {
+       lock /tmp/.failsafe
+       ash --login
+}
+
+mount none /proc -t proc
+mount none /sys  -t sysfs
+
 [ -e /etc/preinit.arch ] && . /etc/preinit.arch
+
+set_state preinit
+
 mount_root ${FAILSAFE:+failsafe}
+
+eval ${FAILSAFE:+failsafe}
+lock -w /tmp/.failsafe
+
 exec /sbin/init