forked from zotan/os-bootstrap-core
Fix up multiple match clauses generated by borked cloud-init
This commit is contained in:
parent
e51c9bc31e
commit
649e54c9a0
11
archx.sh
11
archx.sh
|
@ -314,6 +314,17 @@ basic_postinstall(){
|
|||
if [[ -n $cinetwork ]]; then
|
||||
cp /etc/systemd/network/??-cloud-init-*.link /etc/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
|
||||
|
||||
# Fix up multiple match clauses generated by borked cloud-init
|
||||
for f in /mnt/etc/systemd/network/??-cloud-init-*.network; do
|
||||
# Check if [Match] section contains MACAddress
|
||||
cat "$f" | grep "\[Match\]" --after-context 999 | sed -z 's/\n\n/.*/\n/g' | grep -q "MACAddress="
|
||||
if [[ $? -eq 0 ]]; then
|
||||
# Remove Name= match clause
|
||||
sed -z -i 's/Name=.*\n//g' "$f"
|
||||
fi
|
||||
done
|
||||
|
||||
archchroot "systemctl enable systemd-networkd"
|
||||
fi
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue