summaryrefslogtreecommitdiffstats
path: root/modules.d/bootnet-conf
diff options
context:
space:
mode:
Diffstat (limited to 'modules.d/bootnet-conf')
-rwxr-xr-xmodules.d/bootnet-conf/module-setup.sh13
-rwxr-xr-xmodules.d/bootnet-conf/scripts/gen-bootnet-conf.sh18
2 files changed, 31 insertions, 0 deletions
diff --git a/modules.d/bootnet-conf/module-setup.sh b/modules.d/bootnet-conf/module-setup.sh
new file mode 100755
index 00000000..f1d6697f
--- /dev/null
+++ b/modules.d/bootnet-conf/module-setup.sh
@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+
+check() {
+ # Tell dracut that this module should only be included if it is required
+ # explicitly.
+ return 255
+}
+depends() {
+ echo dnbd3-rootfs
+}
+install() {
+ inst_hook pre-pivot 50 "$moddir/scripts/gen-bootnet-conf.sh"
+}
diff --git a/modules.d/bootnet-conf/scripts/gen-bootnet-conf.sh b/modules.d/bootnet-conf/scripts/gen-bootnet-conf.sh
new file mode 100755
index 00000000..ec82f143
--- /dev/null
+++ b/modules.d/bootnet-conf/scripts/gen-bootnet-conf.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+type emergency_shell >/dev/null 2>&1 || source /lib/dracut-lib.sh
+
+mac="$(getargs BOOTIF=)"
+mac="$(echo $mac | cut -c 4- | tr '-' ':')"
+if [ -n "${mac}" ]; then
+ cat << EOF >> "${NEWROOT}/etc/sysconfig/network-scripts/ifcfg-bootnet"
+DEVICE=bootnet
+NAME=bootnet
+HWADDR=${mac}
+BOOTPROTO=dhcp
+ONBOOT=yes
+NM_CONTROLLED=yes
+EOF
+else
+ echo "Could not parse MAC"
+fi