Skip to content

Commit 10a90d3

Browse files
authored
Merge pull request #3768 from cmitu/wifi-bookworm
wifi: update search locations for 'wifikeyfile'
2 parents 8da9667 + 4d60904 commit 10a90d3

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

scriptmodules/supplementary/wifi.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,8 @@ function gui_wifi() {
276276
"1 Connect to your WiFi network"
277277
2 "Disconnect/Remove WiFi config"
278278
"2 Disconnect and remove any WiFi configuration"
279-
3 "Import WiFi credentials from /boot/wifikeyfile.txt"
280-
"3 Will import the SSID (network name) and PSK (password) from a file at /boot/wifikeyfile.txt
279+
3 "Import WiFi credentials from wifikeyfile.txt"
280+
"3 Will import the SSID (network name) and PSK (password) from the 'wifikeyfile.txt' file on the boot partition
281281
282282
The file should contain two lines as follows\n\nssid = \"YOUR WIFI SSID\"\npsk = \"YOUR PASSWORD\""
283283
)
@@ -303,16 +303,20 @@ The file should contain two lines as follows\n\nssid = \"YOUR WIFI SSID\"\npsk =
303303
remove_${mgmt_tool}_wifi $iface
304304
;;
305305
3)
306-
if [[ -f "/boot/wifikeyfile.txt" ]]; then
307-
iniConfig " = " "\"" "/boot/wifikeyfile.txt"
306+
# check in `/boot/` (pre-bookworm) and `/boot/firmware` (bookworm and later) for the file
307+
local file="/boot/wifikeyfile.txt"
308+
[[ ! -f "$file" ]] && file="/boot/firmware/wifikeyfile.txt"
309+
310+
if [[ -f "$file" ]]; then
311+
iniConfig " = " "\"" "$file"
308312
iniGet "ssid"
309313
local ssid="$ini_value"
310314
iniGet "psk"
311315
local psk="$ini_value"
312316
create_${mgmt_tool}_config_wifi "wpa" "$ssid" "$psk" "$iface"
313317
gui_connect_wifi "$iface"
314318
else
315-
printMsgs "dialog" "No /boot/wifikeyfile.txt found"
319+
printMsgs "dialog" "File 'wifikeyfile.txt' not found on the boot partition!"
316320
fi
317321
;;
318322
esac

0 commit comments

Comments
 (0)