summaryrefslogtreecommitdiffstats
path: root/modules.d/ib-conf/scripts/gen-ib-conf.sh
diff options
context:
space:
mode:
Diffstat (limited to 'modules.d/ib-conf/scripts/gen-ib-conf.sh')
-rwxr-xr-xmodules.d/ib-conf/scripts/gen-ib-conf.sh29
1 files changed, 29 insertions, 0 deletions
diff --git a/modules.d/ib-conf/scripts/gen-ib-conf.sh b/modules.d/ib-conf/scripts/gen-ib-conf.sh
new file mode 100755
index 00000000..430dc887
--- /dev/null
+++ b/modules.d/ib-conf/scripts/gen-ib-conf.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+type emergency_shell >/dev/null 2>&1 || source /lib/dracut-lib.sh
+
+. "/run/openslx/network.conf"
+
+# get the IP from the VLAN device if a VLAN is configured
+[ -n "${SLX_VLAN_ID}" ] && SLX_PXE_NETIF="${SLX_PXE_NETIF}.${SLX_VLAN_ID}"
+
+IPSUFFIX=$(
+ ip -4 -o addr show dev "${SLX_PXE_NETIF}" | \
+ awk '{split($4,a,"/");split(a[1],b,".");print b[3]"."b[4]}'
+)
+
+cat << EOF >> "${NEWROOT}/etc/sysconfig/network-scripts/ifcfg-ib0"
+DEVICE=ib0
+NAME=ib0
+TYPE=Infiniband
+BOOTPROTO=static
+IPADDR=10.12.${IPSUFFIX}
+BROADCAST=10.12.255.255
+NETWORK=10.12.0.0
+NETMASK=255.255.0.0
+ONBOOT=yes
+NM_CONTROLLED=yes
+CONNECTED_MODE=yes
+MTU=65520
+EOF
+