summaryrefslogtreecommitdiff
path: root/busybox/switchbox-1.00/linuxrc
blob: 1368b418a7b19097e9ea133bc8cc4d59be198515 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/sh

mounted=

/bin/mount -t proc proc /proc
/bin/echo "0x0100" > /proc/sys/kernel/real-root-dev

/bin/sleep 10

if [ -z "$mounted" ] && /bin/mount -rt ext3 /dev/sda2 /mnt/tmpmnt ; then

    if  [ -x /mnt/tmpmnt/bin/init ] &&
	[ -d /mnt/tmpmnt/unslung ] && [ -r /mnt/tmpmnt/.unslung ] ; then
	/bin/echo "Root filesystem will be mounted from /dev/sda2 ..."
	/bin/echo "Firmware Version: `/bin/cat /mnt/tmpmnt/.unslung`"
	mounted=/mnt/tmpmnt
	/bin/echo "0x0802" > /proc/sys/kernel/real-root-dev
	[ -r $mounted/unslung/rc.linuxrc ] && . $mounted/unslung/rc.linuxrc
    fi

    /bin/umount /mnt/tmpmnt
fi

if [ -z "$mounted" ] && /bin/mount -rt ext3 /dev/sdb2 /mnt/tmpmnt ; then

    if  [ -x /mnt/tmpmnt/bin/init ] &&
	[ -d /mnt/tmpmnt/unslung ] && [ -r /mnt/tmpmnt/.unslung ] ; then
	/bin/echo "Root filesystem will be mounted from /dev/sdb2 ..."
	/bin/echo "Firmware Version: `/bin/cat /mnt/tmpmnt/.unslung`"
	mounted=/mnt/tmpmnt
	/bin/echo "0x0812" > /proc/sys/kernel/real-root-dev
	[ -r $mounted/unslung/rc.linuxrc ] && . $mounted/unslung/rc.linuxrc
    fi

    /bin/umount /mnt/tmpmnt
fi

if [ -z "$mounted" ] && /bin/mount -rt jffs2 /dev/mtdblock4 /mnt/tmpmnt ; then

    if  [ -x /mnt/tmpmnt/bin/init ] ; then
	/bin/echo "Root filesystem will be mounted from /dev/mtdblock4 ..."
	mounted=/mnt/tmpmnt
	/bin/echo "0x1f04" > /proc/sys/kernel/real-root-dev
    fi

    /bin/umount /mnt/tmpmnt
fi

if [ -z "$mounted" ] ; then
    if  [ -x /mnt/tmpmnt/bin/init ] &&
	[ -d /mnt/tmpmnt/unslung ] && [ -r /mnt/tmpmnt/.unslung ] ; then
	/bin/echo "Root filesystem will be mounted from /dev/ram0 ..."
	/bin/echo "Firmware Version: `/bin/cat /.unslung`"
	mounted=/mnt/tmpmnt
	/bin/echo "0x0100" > /proc/sys/kernel/real-root-dev
	[ -r $mounted/unslung/rc.linuxrc ] && . $mounted/unslung/rc.linuxrc
    fi
fi

if [ -z "$mounted" ] ; then
    /bin/echo "Root filesystem cannot be found - dropping into shell ..."
    echo "5" > /proc/sys/kernel/panic
    exec /bin/sh
fi

/bin/umount /proc

exit 0