| 1 |
#!/bin/sh |
#!/bin/mksh |
| 2 |
export PATH=/bin:/sbin:/usr/bin:/usr/sbin |
export PATH=/bin:/sbin:/usr/bin:/usr/sbin |
| 3 |
|
|
| 4 |
failsafe() { |
mount -nt proc proc /proc |
| 5 |
|
if [[ ! -e /dev/null ]]; then |
| 6 |
|
# this is linux 2.6 only anyway, we have devfs in 2.4 |
| 7 |
|
mount -t tmpfs mdev /dev |
| 8 |
|
# values hard-coded for Linux |
| 9 |
|
mknod -m 0666 /dev/null c 1 3 |
| 10 |
|
mknod -m 0666 /dev/tty c 5 0 |
| 11 |
|
mknod -m 0622 /dev/console c 5 1 |
| 12 |
|
# switch to the real console (if possible) |
| 13 |
|
exec 0<>/dev/console >&0 2>&0 |
| 14 |
|
print Notice: opened initial console now. |
| 15 |
|
# do the deed |
| 16 |
|
[[ -e /dev/MAKEDEV ]] && mksh /dev/MAKEDEV all |
| 17 |
|
fi |
| 18 |
|
|
| 19 |
|
function failsafe { |
| 20 |
netmsg 192.168.1.255 "Entering Failsafe!" |
netmsg 192.168.1.255 "Entering Failsafe!" |
| 21 |
telnetd |
telnetd |
| 22 |
sh |
sh |
| 23 |
} |
} |
| 24 |
|
|
|
mount proc /proc -t proc |
|
| 25 |
[ -f /etc/preinit.arch ] && . /etc/preinit.arch |
[ -f /etc/preinit.arch ] && . /etc/preinit.arch |
| 26 |
[ -f /proc/diag/led/power ] && echo 1 > /proc/diag/led/power |
[ -f /proc/diag/led/power ] && echo f >/proc/diag/led/power |
| 27 |
|
|
| 28 |
# failsafe via hotplug |
# failsafe via hotplug |
| 29 |
trap 'FAILSAFE=true' USR1 |
trap 'FAILSAFE=true' USR1 |
| 46 |
done |
done |
| 47 |
ip addr delete 192.168.1.1/24 broadcast 192.168.1.255 dev eth0 |
ip addr delete 192.168.1.1/24 broadcast 192.168.1.255 dev eth0 |
| 48 |
reset_switch # shell function, defined in preinit.arch |
reset_switch # shell function, defined in preinit.arch |
| 49 |
|
|
| 50 |
|
# ensure busybox is suid root and resume booting |
| 51 |
|
if [[ -e /bin/busybox && ! -u /bin/busybox ]]; then |
| 52 |
|
chown 0:0 /bin/busybox |
| 53 |
|
chmod 4111 /bin/busybox |
| 54 |
|
fi |
| 55 |
exec /sbin/init |
exec /sbin/init |