From 525bf5b46d57e364ffe55851fcbe538624df1b71 Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Mon, 13 Mar 2023 03:08:47 +0100 Subject: [PATCH] Update cloud-init network config --- archx.sh | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/archx.sh b/archx.sh index 8c6c99f..16b813b 100644 --- a/archx.sh +++ b/archx.sh @@ -35,8 +35,8 @@ main() { swapsize="$6" fi export swapsize - if [[ -e /etc/netplan/50-cloud-init.yaml ]]; then - export cinetwork="/etc/netplan/50-cloud-init.yaml" + if test -n "$(find /etc/systemd/network -name '??-cloud-init*.network' -print -quit)"; then + export cinetwork="/etc/systemd/network" fi if grep -q "console=ttyS0" /proc/cmdline; then export consoleboot="console=ttyS0" @@ -118,8 +118,8 @@ main() { export password # VM specific stuff - if [[ -e /etc/netplan/50-cloud-init.yaml ]]; then - export cinetwork="/etc/netplan/50-cloud-init.yaml" + if test -n "$(find /etc/systemd/network -name '??-cloud-init*.network' -print -quit)"; then + export cinetwork="/etc/systemd/network" fi if grep -q "console=ttyS0" /proc/cmdline; then @@ -312,9 +312,8 @@ basic_postinstall(){ fi if [[ -n $cinetwork ]]; then - cp /run/systemd/network/*.link /mnt/etc/systemd/network/10-cloud-init.link || : # ignore failures because file doesn't exist - cp /run/systemd/network/*.network /mnt/etc/systemd/network/50-cloud-init.network || : # ignore failures because file doesn't exist - cat /mnt/etc/systemd/network/50-cloud-init.network | grep -E 'DNS|Domains' | sed 's/DNS=/nameserver /g' | sed 's/Domains=/search /g' >> /mnt/etc/resolv.conf + cp /run/systemd/network/??-cloud-init-*.link /run/systemd/network/??-cloud-init-*.network /mnt/etc/systemd/network || : # ignore failures because file doesn't exist + cat /mnt/etc/systemd/network/??-cloud-init-*.network | grep -E 'DNS|Domains' | sed 's/DNS=/nameserver /g' | sed 's/Domains=/search /g' >> /mnt/etc/resolv.conf archchroot "systemctl enable systemd-networkd" fi }