Adding debian version 3.70~pre8+dfsg-1.
[syslinux-debian/hramrach.git] / gpxe / contrib / initrd / linuxrc
blob24bdb0df849260d03e2392f80f4127318549f646
1 #!/bin/sh
2 # $Id$
4 PATH=/sbin:/bin
6 echo Busybox /linuxrc starting
8 echo Mounting /proc filesystem
9 mount -t proc none /proc
11 echo=echo
12 if grep '\bquiet\b' /proc/cmdline > /dev/null; then
13 echo=true
14 quiet=1
17 $echo Creating root device
18 mknod /dev/root b 1 0 2>/dev/null
19 chmod 700 /dev/root
20 echo 0x100 > /proc/sys/kernel/real-root-dev
22 $echo Inserting modules
23 if [ -z "$quiet" ]; then
24 /bin/insert-modules
25 else
26 /bin/insert-modules >/dev/null
29 $echo Bringing up loopback interface
30 ifconfig lo 127.0.0.1 up
31 route add -net 127.0.0.0 netmask 255.0.0.0 lo
33 # Hack required for prism2 cards
34 # It is not yet possible to use iwconfig to configure these cards,
35 # so we need wlanctl.
36 if ifconfig wlan0 down 2> /dev/null; then
37 $echo Setting up wireless link
38 wlanctl wlan0 lnxreq_ifstate ifstate=enable
39 wlanctl wlan0 lnxreq_autojoin ssid= authtype=opensystem
42 $echo Obtaining IP address via DHCP
43 $echo Trying to obtain IP address via wired link [eth0]
44 if udhcpc -i eth0 -f -n -q -s /bin/udhcpc-post; then
45 $echo Successfully obtained IP address via wired link [eth0]
46 else
47 $echo Failed to obtain IP address via wired link [eth0]
48 $echo Trying to obtain IP address via wireless link [wlan0]
49 udhcpc -i wlan0 -f -n -q -s /bin/udhcpc-post
52 if [ -d /sysroot/initrd ]; then
53 $echo Unmounting /proc prior to pivot_root
54 umount /proc
56 $echo Pivoting root to /sysroot
57 pivot_root /sysroot /sysroot/initrd
58 cd /
60 $echo Remounting devfs at correct place
61 mount -t devfs none /dev
63 $echo Releasing locks on old devfs
64 exec 0</dev/null
65 exec 1>/dev/console
66 exec 2>/dev/console
68 $echo Unmounting old devfs
69 umount /initrd/dev
70 else
71 # Failed to mount root: report error and hang
72 echo FATAL ERROR: Failed to mount root filesystem
73 echo Press Alt-SysRq-B or hit the reset switch to reboot
74 while : ; do sleep 6000 ; done