You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

38 rivejä
1.1 KiB

  1. #!/bin/bash -e
  2. install -v -d "${ROOTFS_DIR}/etc/wpa_supplicant"
  3. install -v -m 600 files/wpa_supplicant.conf "${ROOTFS_DIR}/etc/wpa_supplicant/"
  4. on_chroot << EOF
  5. SUDO_USER="${FIRST_USER_NAME}" raspi-config nonint do_boot_wait 0
  6. EOF
  7. if [ -v WPA_COUNTRY ]; then
  8. echo "country=${WPA_COUNTRY}" >> "${ROOTFS_DIR}/etc/wpa_supplicant/wpa_supplicant.conf"
  9. fi
  10. if [ -v WPA_ESSID ] && [ -v WPA_PASSWORD ]; then
  11. on_chroot <<EOF
  12. set -o pipefail
  13. wpa_passphrase "${WPA_ESSID}" "${WPA_PASSWORD}" | tee -a "/etc/wpa_supplicant/wpa_supplicant.conf"
  14. EOF
  15. elif [ -v WPA_ESSID ]; then
  16. cat >> "${ROOTFS_DIR}/etc/wpa_supplicant/wpa_supplicant.conf" << EOL
  17. network={
  18. ssid="${WPA_ESSID}"
  19. key_mgmt=NONE
  20. }
  21. EOL
  22. fi
  23. # Disable wifi on 5GHz models if WPA_COUNTRY is not set
  24. mkdir -p "${ROOTFS_DIR}/var/lib/systemd/rfkill/"
  25. if [ -n "$WPA_COUNTRY" ]; then
  26. echo 0 > "${ROOTFS_DIR}/var/lib/systemd/rfkill/platform-3f300000.mmcnr:wlan"
  27. echo 0 > "${ROOTFS_DIR}/var/lib/systemd/rfkill/platform-fe300000.mmcnr:wlan"
  28. else
  29. echo 1 > "${ROOTFS_DIR}/var/lib/systemd/rfkill/platform-3f300000.mmcnr:wlan"
  30. echo 1 > "${ROOTFS_DIR}/var/lib/systemd/rfkill/platform-fe300000.mmcnr:wlan"
  31. fi