3 # Copyright Matthias Hentges (c) 2005
5 # License: GPL (see http://www.gnu.org/licenses/gpl.txt for a copy of the GPL)
7 # FIXME: Make this work
9 M_TITLE="Boot from NFS"
12 echo "ERROR: $1" >/dev/tty0
13 exec $SH_SHELL </dev/tty0 >/dev/tty0 2>&1
16 # This function is activated by init.altboot by calling this script with the "run" option
19 test -e /etc/altboot.func && . /etc/altboot.func || die "ERROR: /etc/altboot.func not found. Check your installation!"
21 echo -n "Mounting rootfs rw..." >/dev/tty0
22 mount -o remount,rw / >/dev/tty0 2>&1 && echo ok >/dev/tty0|| die "mount -o remount,rw / failed"
24 echo -n "Generating device files..." >/dev/tty0
25 /etc/init.d/devices start && echo ok >/dev/tty0|| die "FAILED"
27 echo -n "Mounting /proc..." >/dev/tty0
28 mount /proc >/dev/tty0 2>&1 && echo ok >/dev/tty0 || echo failed
31 /etc/init.d/portmap start >/dev/tty1 2>&1 || die "/etc/init.d/portmap start failed!"
33 # For some reason NFS mounts hang if /e/i/networking is not run.
34 # For the time beeing I'm to lazy to investigate ;)
35 /etc/init.d/networking start || die "/etc/init.d/networking start failed!"
39 # After the PCMCIA service is started, an inserted WLAN card should automatically
41 /etc/init.d/pcmcia start || die "/etc/init.d/pcmcia/start failed!"
43 # Give WLAN time to login into the network
44 echo "Waiting for WLAN..."
47 nfs_mounts="`cat /etc/fstab | grep -v ^# | grep nfs | awk '{print $1}'`"
48 nfs_mountpoints="`cat /etc/fstab | grep -v ^# | grep nfs | awk '{print $2}'`"
50 if test "` echo "$nfs_mountpoints" |wc -l | tr -d " "`" -gt 1
52 echo -e "Please select your NFS root:\n"
55 for nfs_mount in $nfs_mountpoints
57 echo -e "\t[$cnt] $nfs_mount"
63 while test -z "$selection"
65 echo -n "Boot NFS root: "
69 for nfs_mount in $nfs_mounts
71 if test "$junk" = "$cnt"
73 selection="$nfs_mount"
80 test -z "$nfs_mounts" && die "No NFS mounts configured in /etc/fstab!"
81 selection="$nfs_mounts"
84 mkdir -p /media/nfsroot || die "mkdir -p /media/nfsroot failed!"
86 echo -n "Mounting NFS root..."
87 mount -t nfs "$selection" /media/nfsroot && echo ok || die "mount -t nfs "$selection" /media/nfsroot failed!"
89 check_target "/media/nfsroot"
94 title) echo "$M_TITLE";;
95 run) run_module "$2";;