Switch to usual for DIB way of NIC setup

Use "dhcp-all-interfaces" DIB element to configure NICs. And remove
custom scripts used before.

Change-Id: I7ed93b669b103106f65ad9112f9aada131881525
This commit is contained in:
Dmitry Bogun 2017-02-22 18:24:01 +02:00
parent ad4e29023d
commit f7d0ec036b
4 changed files with 18 additions and 27 deletions

View File

@ -1,2 +1,3 @@
package-installs
centos-minimal
dhcp-all-interfaces

View File

@ -0,0 +1,16 @@
#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
echo "Remove all prepared network device configuration(centos-minimall have"
echo "added couple of them). We can't predefine netowrk setup during image"
echo "build."
for iface in /etc/sysconfig/network-scripts/ifcfg-*; do
[ ! -e "$iface" ] && break
[ "$(basename "$iface")" = "ifcfg-lo" ] && continue
rm -v "$iface"
done

View File

@ -1,5 +1,4 @@
curl:
dhclient:
policycoreutils:
selinux-policy:
selinux-policy-targeted:
@ -19,4 +18,3 @@ btrfs-progs:
dosfstools:
rsync:
grub2:

View File

@ -1,24 +0,0 @@
#!/bin/bash
if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then
set -x
fi
set -e
# Disabling this rule prevents inconsistent iface renames done by udev. This
# were conflicting with prebuilt dhcp scripts (ifcfg-eth0, ifcfg-eth1) as well
# as with dhcp-all-interfaces which was not able to generate scripts according
# to new names (because it runs concurrently with renaming).
# Using old schema (ethN) + pre-built dhcp scripts allows to have stable DHCP
# even if eth interfaces are randomly swapped.
ln -s /dev/null /etc/udev/rules.d/80-net-name-slot.rules
# Configs for additional interfaces
SYSCONFIG_PATH=/etc/sysconfig/network-scripts
for IFACE_NUM in 1 2 3
do
cp $SYSCONFIG_PATH/ifcfg-eth0 $SYSCONFIG_PATH/ifcfg-eth$IFACE_NUM
sed -i "s/eth0/eth$IFACE_NUM/g" $SYSCONFIG_PATH/ifcfg-eth$IFACE_NUM
done