File: 010_initrd_improved_nfsroot.diff

package info (click to toggle)
lessdisks 0.5.3cvs.20040906-16
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,480 kB
  • ctags: 271
  • sloc: sh: 3,058; makefile: 92
file content (88 lines) | stat: -rw-r--r-- 4,378 bytes parent folder | download
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
diff -ur lessdisks-0.5.3cvs.20040906/mkinitrd/conf/install_scripts/06_cmdline patched-lessdisks-0.5.3cvs.20040906/mkinitrd/conf/install_scripts/06_cmdline
--- lessdisks-0.5.3cvs.20040906/mkinitrd/conf/install_scripts/06_cmdline	2004-08-21 01:45:07.000000000 -0700
+++ patched-lessdisks-0.5.3cvs.20040906/mkinitrd/conf/install_scripts/06_cmdline	2004-11-09 16:25:51.000000000 -0800
@@ -35,8 +35,8 @@
   # ip=x.x.x.x or ip=x.x.x.x:x.x.x.x:x.x.x.x:... are valid formats
   # the first doesn't use a colon, other options require the colon
   ip=$(get_field $stuff 1 "-d :")
-  if [ -z "$siaddr" ]; then
-    siaddr=$(get_field $stuff 2)
+  if [ -z "$nfsserver" ]; then
+    nfsserver=$(get_field $stuff 2)
   fi
   gw_ip=$(get_field $stuff 3)
   subnet=$(get_field $stuff 4)
@@ -55,9 +55,9 @@
     nfsroot=*) opt="${opt##nfsroot=}" 
       nfspath="$(echo $opt | cut -d : -f 2 | cut -d , -f 1)" 
       t="$(echo $opt | cut -s -d : -f 1)"
-      if [ -z "$siaddr" ] && [ -n "$t" ]; then
-        siaddr="$t"
-        echo "setting siaddr $siaddr"
+      if [ -z "$nfsserver" ] && [ -n "$t" ]; then
+        nfsserver="$t"
+        echo "setting nfsserver $nfsserver"
       fi
       t="$(echo $opt | cut -s -d , -f 2,3,4,5,6,7,8,9,10,11,12,13,14)"
       test -n $t && nfs_opts="$t"
@@ -69,7 +69,7 @@
 test -w /tmp/ || mount -nt tmpfs tmpfs /tmp
 
 test -n "$nfspath" && echo nfspath=$nfspath > $tempfile
-test -n "$siaddr" && echo siaddr=$siaddr >> $tempfile
+test -n "$nfsserver" && echo nfsserver=$nfsserver >> $tempfile
 test -n "$nfs_opts" && echo nfs_opts=\"$nfs_opts\" >> $tempfile
 test -n "$rootdev" && echo rootdev=$rootdev >> $tempfile
 # FIXME: init scripts appear to export kernel commandline values derived from
diff -ur lessdisks-0.5.3cvs.20040906/mkinitrd/conf/install_scripts/90_mount_nfs_root patched-lessdisks-0.5.3cvs.20040906/mkinitrd/conf/install_scripts/90_mount_nfs_root
--- lessdisks-0.5.3cvs.20040906/mkinitrd/conf/install_scripts/90_mount_nfs_root	2004-08-21 01:45:07.000000000 -0700
+++ patched-lessdisks-0.5.3cvs.20040906/mkinitrd/conf/install_scripts/90_mount_nfs_root	2004-11-09 16:25:52.000000000 -0800
@@ -18,8 +18,11 @@
 fi
 
 # TODO support udhcpc style versions of tftp-server-name
-server="$siaddr"
-if [ -z "$server" ] && [ -n "$tftp" ]; then
+server="$nfsserver"
+if [ -z "$server" ] && [ -n "$siaddr" ]; then
+  echo "NOTE: assuming siaddr $siaddr is also NFS server..."
+  server="$siaddr"
+elif [ -z "$server" ] && [ -n "$tftp" ]; then
   echo "WARNING: assuming TFTP server $tftp is also NFS server..."
   server="$tftp"
 elif [ -z "$server" ] && [ -n "$serverid" ]; then
diff -ur lessdisks-0.5.3cvs.20040906/mkinitrd/conf/network_script patched-lessdisks-0.5.3cvs.20040906/mkinitrd/conf/network_script
--- lessdisks-0.5.3cvs.20040906/mkinitrd/conf/network_script	2004-06-17 11:30:02.000000000 -0700
+++ patched-lessdisks-0.5.3cvs.20040906/mkinitrd/conf/network_script	2004-11-09 16:26:53.000000000 -0800
@@ -56,6 +56,21 @@
                 # client's dhclient script (so as to get added to lease file)
                 [ "$hostname" ] && hostname "$hostname"
 
+                if [ -n "$rootpath" ]; then
+                  if [ -z "$nfspath" ]; then
+                    nfspath="$(echo $rootpath | cut -d : -f2)"
+                    echo "using nfs dir from rootpath: $nfspath"
+                  fi
+                  if [ -z "$nfsserver" ] && [ -n "$(echo $rootpath | grep :)" ]; then
+                    x="$(echo $rootpath | cut -d : -f1)"
+                    if [ "$x" != "$nfspath" ]; then
+                      # FIXME test if $x is a valid ip address
+                      nfsserver="$x"
+                      echo "using nfs server from rootpath: $nfsserver"
+                    fi
+                  fi
+                fi
+
                 # udhcp 0.9.6 bug: siaddr incorrectly == ip
                 if [ "$siaddr" = "$ip" ]; then
                   # assume that the dhcp server is same as next-server
@@ -75,6 +90,9 @@
                 if [ -n "$interface" ]; then
                   echo "interface=\"$interface\"" >> $cmdline_opts
                 fi
+                if [ -n "$nfsserver" ]; then
+                  echo "nfsserver=\"$nfsserver\"" >> $cmdline_opts
+                fi
                 if [ -n "$siaddr" ]; then
                   echo "siaddr=\"$siaddr\"" >> $cmdline_opts
                 fi