Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

01-run.sh 1.1 KiB

12345678910111213141516171819202122232425262728293031323334353637
  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