From 325ef18ae68d0acf0a8bb2bbcc415674ea4032ba Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Thu, 6 Feb 2025 23:00:26 -0500 Subject: [PATCH] fix: remove an SSID if the password is changed before adding the new credentials Closes #18 --- launch.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/launch.sh b/launch.sh index 426ff8b..d1726ef 100755 --- a/launch.sh +++ b/launch.sh @@ -95,6 +95,11 @@ password_screen() { fi touch "$SDCARD_PATH/wifi.txt" + + if grep -q "^$SSID:" "$SDCARD_PATH/wifi.txt" 2>/dev/null; then + sed -i "/^$SSID:/d" "$SDCARD_PATH/wifi.txt" + fi + echo "$SSID:$password" >>"$SDCARD_PATH/wifi.txt" }