aboutsummaryrefslogtreecommitdiffstats
path: root/packages/initrdscripts/files/nfsboot.sh
blob: b536c4042bff0778d13d1ea569741ce504924635 (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
#!/bin/sh

echo "Starting initramfs boot..."
mkdir /proc
mount -t proc proc /proc

for arg in `cat /proc/cmdline`; do
    echo $arg
    optarg=`expr "x$arg" : 'x[^=]*=\(.*\)'`
    echo $optarg
    case $arg in
        root=*)
            root=$optarg ;;
        nfsroot=*)
            nfsroot=$optarg ;;
        ip=*)
            ip=$optarg ;;
    esac
done

echo $ip | (IFS=: read client_ip server_ip gw_ip netmask hostname device autoconf; \
echo client_ip=$client_ip;
echo server_ip=$server_ip;
echo gw_ip=$gw_ip;
echo netmask=$netmask;
echo hostname=$hostname;
echo device=$device;
echo autoconf=$autoconf;

case "x$device" in
    usb*)
	echo "USB"
	modprobe g_ether
	;;
esac

ifconfig $device $client_ip
)

mkdir /mnt
if [ "x$root" = "x/dev/nfs" ]; then
    echo "booting from NFS: $nfsroot"
    mount -t nfs $nfsroot /mnt
else
    echo "booting from: $root"
    mount $root /mnt
fi

cd /mnt
exec switch_root -c /dev/console /mnt /sbin/init