Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Idea: Use Raspberry Pi Imager to configure WLAN country, time zone & keyboard layout
#7
I verified the code in worker.php that extracts the country code from pi-imager generated wpa_supplicant.conf file and then updates cfg_network table works correctly.

What doesn't seem right is the wpa_supplicant.conf file generated by the Pi Imager. It has country = US even though /boot/firstrun.sh shows country = GB which I specified in the imager.

Here's my test

1. Prep image using Pi-Imager 1.8.4
2. Set WiFi country to something other than US
3. Write the image
4. Insert USB-uSD dongle into a moOde Pi

# Save firstrun.sh file and examine it, verify country code
5. sudo cp /media/boot/firstrun.sh ./

# Add debug line to worker.php
6. sudo nano /media/rootfs/var/www/daemon/worker.php and add the bolded line 

// Pi Imager: Import SSID/PSK/Country
if (file_exists('/etc/wpa_supplicant/wpa_supplicant.conf')) {
    $moodeHeader = sysCmd('cat /etc/wpa_supplicant/wpa_supplicant.conf 2>&1 | grep "This file is automatically generated"');
    sysCmd('cp /etc/wpa_supplicant/wpa_supplicant.conf /home/pi/');

7. Boot a Pi with the modified uSD card
8. SSH

# Examine country code
9. sudo cat ./wpa_supplicant.conf
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply


Messages In This Thread
RE: Use Raspberry Pi Imager to configure WLAN country, time zone & keyboard layout - by Tim Curtis - 01-03-2024, 04:03 PM

Forum Jump: