dracut-systemd/dracut-initqueue: only start service if really needed
[dracut.git] / modules.d / 95nfs / nfsroot.sh
blob93a6b1a13b2b7821ce1ad51d4863387247dbc444
1 #!/bin/sh
3 type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
4 . /lib/nfs-lib.sh
6 [ "$#" = 3 ] || exit 1
8 # root is in the form root=nfs[4]:[server:]path[:options], either from
9 # cmdline or dhcp root-path
10 netif="$1"
11 root="$2"
12 NEWROOT="$3"
14 nfs_to_var $root $netif
15 [ -z "$server" ] && die "Required parameter 'server' is missing"
17 mount_nfs $root $NEWROOT $netif && { [ -e /dev/root ] || ln -s null /dev/root ; [ -e /dev/nfs ] || ln -s null /dev/nfs; }
19 [ -f $NEWROOT/etc/fstab ] && cat $NEWROOT/etc/fstab > /dev/null
21 # inject new exit_if_exists
22 echo 'settle_exit_if_exists="--exit-if-exists=/dev/root"; rm -- "$job"' > $hookdir/initqueue/nfs.sh
23 # force udevsettle to break
24 > $hookdir/initqueue/work
26 need_shutdown