WLAN als NetworkManager-Profil anlegen statt nmcli connect
nmcli connect ist nicht persistent wenn NM noch nicht laeuft. Stattdessen .nmconnection-Datei direkt schreiben — ueberlebt Reboot und verbindet automatisch.
This commit is contained in:
parent
b4220333ed
commit
525bc15ed2
1 changed files with 25 additions and 3 deletions
|
|
@ -274,10 +274,32 @@ if [[ "$(stat -c %d:%i /)" == "$(stat -c %d:%i /proc/1/root/.)" ]] 2>/dev/null;
|
|||
sensors-detect --auto 2>/dev/null || true
|
||||
fi
|
||||
|
||||
# WLAN-Verbindung in NetworkManager einrichten (aus gesicherter netplan-Config)
|
||||
# WLAN-Verbindung als NetworkManager-Profil anlegen (überlebt Reboot)
|
||||
if [[ -n "$WLAN_SSID" && -n "$WLAN_PASS" ]]; then
|
||||
nmcli device wifi connect "$WLAN_SSID" password "$WLAN_PASS" 2>/dev/null || true
|
||||
ok "WLAN wiederhergestellt: $WLAN_SSID"
|
||||
NM_CONN_DIR="/etc/NetworkManager/system-connections"
|
||||
mkdir -p "$NM_CONN_DIR"
|
||||
cat > "$NM_CONN_DIR/$WLAN_SSID.nmconnection" <<WIFIEOF
|
||||
[connection]
|
||||
id=$WLAN_SSID
|
||||
type=wifi
|
||||
autoconnect=true
|
||||
|
||||
[wifi]
|
||||
ssid=$WLAN_SSID
|
||||
mode=infrastructure
|
||||
|
||||
[wifi-security]
|
||||
key-mgmt=wpa-psk
|
||||
psk=$WLAN_PASS
|
||||
|
||||
[ipv4]
|
||||
method=auto
|
||||
|
||||
[ipv6]
|
||||
method=auto
|
||||
WIFIEOF
|
||||
chmod 600 "$NM_CONN_DIR/$WLAN_SSID.nmconnection"
|
||||
ok "WLAN-Profil angelegt: $WLAN_SSID (autoconnect)"
|
||||
fi
|
||||
|
||||
# zsh als Standard-Shell
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue