4 # root=nfs[4]:[server:]path[:options]
6 # This syntax can come from DHCP root-path as well.
9 # root=/dev/nfs nfsroot=[server:]path[,options]
11 # In Legacy root=/dev/nfs mode, if the 'nfsroot' parameter is not given
12 # on the command line or is empty, the dhcp root-path is used as
13 # [server:]path[:options] or the default "/tftpboot/%s" will be used.
15 # If server is unspecified it will be pulled from one of the following
17 # static ip= option on kernel command line
18 # DHCP next-server option
19 # DHCP server-id option
20 # DHCP root-path option
22 # NFSv4 is only used if explicitly requested with nfs4: prefix, otherwise
26 type getarg
>/dev
/null
2>&1 || .
/lib
/dracut-lib.sh
28 # This script is sourced, so root should be set. But let's be paranoid
29 [ -z "$root" ] && root
=$
(getarg root
=)
30 [ -z "$nfsroot" ] && nfsroot
=$
(getarg nfsroot
=)
32 [ -n "$netroot" ] && oldnetroot
="$netroot"
34 # netroot= cmdline argument must be ignored, but must be used if
35 # we're inside netroot to parse dhcp root-path
36 if [ -n "$netroot" ] ; then
37 for n
in $
(getargs netroot
=); do
38 [ "$n" = "$netroot" ] && break
40 if [ "$n" = "$netroot" ]; then
41 warn
"Ignoring netroot argument for NFS"
48 # LEGACY: nfsroot= is valid only if root=/dev/nfs
49 if [ -n "$nfsroot" ] ; then
51 warn
"Argument nfsroot is deprecated and might be removed in a future release. See 'man dracut.kernel' for more information."
52 if [ "$(getarg root=)" != "/dev/nfs" ]; then
53 die
"Argument nfsroot only accepted for legacy root=/dev/nfs"
59 /dev
/nfs
) netroot
=nfs
;;
61 if [ -n "$oldnetroot" ]; then
68 # LEGACY: root=<server-ip>:/<path
69 [0-9]*:/*|
[0-9]*\.
[0-9]*\.
[0-9]*[!:]|
/*)
70 netroot
=nfs
:$netroot;;
74 case "${netroot%%:*}" in
77 if [ -n "$oldnetroot" ]; then
86 # Check required arguments
88 if nfsdomain
=$
(getarg rd.nfs.domain
-d rd_NFS_DOMAIN
); then
89 if [ -f /etc
/idmapd.conf
]; then
91 "s/^[[:space:]#]*Domain[[:space:]]*=.*/Domain = $nfsdomain/g" \
94 # and even again after the sed, in case it was not yet specified
95 echo "Domain = $nfsdomain" >> /etc
/idmapd.conf
98 nfsroot_to_var
$netroot
99 [ "$path" = "error" ] && die
"Argument nfsroot must contain a valid path!"
101 # Set fstype, might help somewhere
104 # Rewrite root so we don't have to parse this uglyness later on again
105 netroot
="$fstype:$server:$path:$options"
107 # If we don't have a server, we need dhcp
108 if [ -z "$server" ] ; then
115 # Shut up init error check or make sure that block parser wont get
116 # confused by having /dev/nfs[4]
119 echo '[ -e $NEWROOT/proc ]' > $hookdir/initqueue
/finished
/nfsroot.sh