#/bin/sh -efu

# Bind network interface names of ethernet to MAC addresses
ip -br link show |grep '^en'| awk '{print $1}' | while read -r iface; do
	mac=$(ip -br link show "$iface" 2>/dev/null | awk '{print $3}')
	[ -n "$mac" ] || continue
        cat>/etc/systemd/network/$iface.link <<-EOF
	[Match]
	MACAddress=$mac
	
	[Link]
	Name=$iface
	EOF
done
