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.
 
 
 
 
 

37 line
1.2 KiB

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