summaryrefslogtreecommitdiffstats
path: root/builder/modules.d/bootnet-conf/scripts/gen-bootnet-conf.sh
blob: ec82f143e3ddbee6621e110e52970f4dfaae0772 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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