gvaldap/change-vmdebootstrap-default-dhcp.sh
Jan Dittberner a98f6e54e7 Make IP address assignment work with libvirt
The systemd-networkd script in vmdebootstrap that is used to build the
Debian libvirt vagrant boxes is a bit too eager assigning DHCP to
network interfaces. This patch changes the network script to only take
care of the primary network interface (first non loopback).
2020-03-04 00:07:58 +01:00

15 lines
439 B
Bash

#!/bin/sh
set -e
debootstrap_network=/etc/systemd/network/99-dhcp.network
if grep -q '^Name=\\*' "${debootstrap_network}"; then
primary_nic=$(ls -1 /sys/class/net | grep -v lo |sort | head -1)
sed -i "s/^Name=e\\*/Name=${primary_nic})/" \
"${debootstrap_network}"
systemctl restart systemd-networkd.service
echo "Changed systemd network configuration"
else
echo "Systemd network configuration has already been changed"
fi