From f24b30fcbfa91e50c054f55f09a7b2562990aeea Mon Sep 17 00:00:00 2001 From: Jan Date: Wed, 15 Jul 2026 08:15:10 +0000 Subject: [PATCH] Dateien nach "/" hochladen --- paw-network-restore.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/paw-network-restore.sh b/paw-network-restore.sh index cf73495..8d315dc 100644 --- a/paw-network-restore.sh +++ b/paw-network-restore.sh @@ -19,8 +19,12 @@ for sysdev in /sys/class/net/*; do iface="${sysdev##*/}" [[ "$iface" == "lo" ]] && continue pmac="$(ethtool -P "$iface" 2>/dev/null | awk '{print tolower($3)}' || true)" - [[ "$pmac" =~ ^([0-9a-f]{2}:){5}[0-9a-f]{2}$ ]] || pmac="$(tr '[:upper:]' '[:lower:]' < "$sysdev/address")" - MAC_TO_IF["$pmac"]="$iface" + [[ "$pmac" =~ ^([0-9a-f]{2}:){5}[0-9a-f]{2}$ ]] || pmac="$(tr '[:upper:]' '[:lower:]' < "$sysdev/address" 2>/dev/null || true)" + if [[ "$pmac" =~ ^([0-9a-f]{2}:){5}[0-9a-f]{2}$ ]]; then + MAC_TO_IF["$pmac"]="$iface" + else + warn "Keine gültige MAC für Interface $iface ermittelbar; übersprungen." + fi done log "Kopiere gesicherte PAW-Konfiguration" @@ -47,8 +51,11 @@ if [[ -f "$SRC/metadata/paw-ports.tsv" ]]; then [[ -n "$profile" ]] || continue target="/etc/NetworkManager/system-connections/$profile" [[ -f "$target" ]] || { warn "Profil fehlt nach Restore: $target"; continue; } - pmac="$(tr '[:upper:]' '[:lower:]' <<<"$pmac")" - new_if="${MAC_TO_IF[$pmac]:-}" + pmac="$(tr '[:upper:]' '[:lower:]' <<<"${pmac:-}")" + new_if="" + if [[ "$pmac" =~ ^([0-9a-f]{2}:){5}[0-9a-f]{2}$ ]]; then + new_if="${MAC_TO_IF["$pmac"]:-}" + fi if [[ -z "$pmac" || -z "$new_if" ]]; then warn "Keine aktuelle Schnittstelle für $con_id (alte Schnittstelle $old_if, MAC ${pmac:-unbekannt}) gefunden." continue