]> git.ipfire.org Git - thirdparty/dracut.git/blob - modules.d/40network/dhcp-root.sh
06c50998c48c7bfd7b5754451a8254f2c77edee3
[thirdparty/dracut.git] / modules.d / 40network / dhcp-root.sh
1 #!/bin/sh
2
3 # This script is sourced, so root should be set. But let's be paranoid
4 [ -z "$root" ] && root=$(getarg root=)
5
6 if [ -z "$netroot" ]; then
7 for netroot in $(getargs netroot=); do
8 [ "$netroot" = "dhcp" ] && break
9 [ "$netroot" = "dhcp6" ] && break
10 done
11 [ "$netroot" = "dhcp" ] || [ "$netroot" = "dhcp6" ] || unset netroot
12 fi
13
14 if [ "$root" = "dhcp" ] || [ "$root" = "dhcp6" ] || [ "$netroot" = "dhcp" ] || [ "$netroot" = "dhcp6" ]; then
15 # Tell ip= checker that we need dhcp
16 NEEDDHCP="1"
17
18 # Done, all good!
19 rootok=1
20 if [ "$netroot" != "dhcp" ] && [ "$netroot" != "dhcp6" ]; then
21 netroot=$root
22 fi
23
24 # Shut up init error check
25 [ -z "$root" ] && root="dhcp"
26 echo '[ -d $NEWROOT/proc -o -e /dev/root ]' > $hookdir/initqueue/finished/dhcp.sh
27 fi