diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-03 14:01:35 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-03 14:01:35 +0000 |
commit | e6f2eaf47a177a8eca054d1d70a1b6287e8c3521 (patch) | |
tree | c5719e819a9e37df4b54affd61438f382ec38a8f /modules.d/45net-lib/dhcp-root.sh | |
parent | Adding upstream version 060+5. (diff) | |
download | dracut-e6f2eaf47a177a8eca054d1d70a1b6287e8c3521.tar.xz dracut-e6f2eaf47a177a8eca054d1d70a1b6287e8c3521.zip |
Adding upstream version 102.upstream/102
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'modules.d/45net-lib/dhcp-root.sh')
-rwxr-xr-x | modules.d/45net-lib/dhcp-root.sh | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/modules.d/45net-lib/dhcp-root.sh b/modules.d/45net-lib/dhcp-root.sh new file mode 100755 index 0000000..3f11221 --- /dev/null +++ b/modules.d/45net-lib/dhcp-root.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +# This script is sourced, so root should be set. But let's be paranoid +[ -z "$root" ] && root=$(getarg root=) + +if [ -z "$netroot" ]; then + for netroot in $(getargs netroot=); do + [ "$netroot" = "dhcp" ] && break + [ "$netroot" = "dhcp6" ] && break + done + [ "$netroot" = "dhcp" ] || [ "$netroot" = "dhcp6" ] || unset netroot +fi + +if [ "$root" = "dhcp" ] || [ "$root" = "dhcp6" ] || [ "$netroot" = "dhcp" ] || [ "$netroot" = "dhcp6" ]; then + # Tell ip= checker that we need dhcp + # shellcheck disable=SC2034 + NEEDDHCP="1" + + # Done, all good! + # shellcheck disable=SC2034 + rootok=1 + if [ "$netroot" != "dhcp" ] && [ "$netroot" != "dhcp6" ]; then + netroot=$root + fi + + # Shut up init error check + [ -z "$root" ] && root="dhcp" + # shellcheck disable=SC2016 + echo '[ -d $NEWROOT/proc -o -e /dev/root ]' > "$hookdir"/initqueue/finished/dhcp.sh +fi |