From 6e0824e35782efc9d69bdd572f7bdc403e56f9a8 Mon Sep 17 00:00:00 2001 From: MacRimi <123239993+MacRimi@users.noreply.github.com> Date: Sun, 20 Jul 2025 11:27:08 +0200 Subject: [PATCH] Update customizable_post_install.sh --- .../post_install/customizable_post_install.sh | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/scripts/post_install/customizable_post_install.sh b/scripts/post_install/customizable_post_install.sh index f65141b..dc364ac 100644 --- a/scripts/post_install/customizable_post_install.sh +++ b/scripts/post_install/customizable_post_install.sh @@ -3145,6 +3145,64 @@ EOF +setup_persistent_network() { + local LINK_DIR="/etc/systemd/network" + local BACKUP_DIR="/etc/systemd/network/backup-$(date +%Y%m%d-%H%M%S)" + + msg_info "$(translate "Setting up persistent network interfaces")" + sleep 2 + + mkdir -p "$LINK_DIR" + + + if ls "$LINK_DIR"/*.link >/dev/null 2>&1; then + mkdir -p "$BACKUP_DIR" + cp "$LINK_DIR"/*.link "$BACKUP_DIR"/ 2>/dev/null || true + fi + + # Process physical interfaces + local count=0 + for iface in $(ls /sys/class/net/ | grep -vE "lo|docker|veth|br-|vmbr|tap|fwpr|fwln|virbr|bond|cilium|zt|wg"); do + if [[ -e "/sys/class/net/$iface/device" ]] || [[ -e "/sys/class/net/$iface/phy80211" ]]; then + local MAC=$(cat /sys/class/net/$iface/address 2>/dev/null) + + if [[ "$MAC" =~ ^([a-fA-F0-9]{2}:){5}[a-fA-F0-9]{2}$ ]]; then + local LINK_FILE="$LINK_DIR/10-$iface.link" + + cat > "$LINK_FILE" <