Merge branch 'master' of github.com:madeden/pi-gen

This commit is contained in:
Samuel Cozannet 2020-01-10 16:15:59 +01:00
commit c53c02f8c9
No known key found for this signature in database
GPG Key ID: 10D4F75B05EF4B5B
3 changed files with 9 additions and 3 deletions

View File

@ -119,7 +119,7 @@ The following environment variables are supported:
* `WPA_ESSID`, `WPA_PASSWORD` and `WPA_COUNTRY` (Default: unset) * `WPA_ESSID`, `WPA_PASSWORD` and `WPA_COUNTRY` (Default: unset)
If these are set, they are use to configure `wpa_supplicant.conf`, so that the raspberry pi can automatically connect to a wifi network on first boot. If `WPA_ESSID` is set and `WPA_PASSWORD` is unset an unprotected wifi network will be configured. If these are set, they are use to configure `wpa_supplicant.conf`, so that the Raspberry Pi can automatically connect to a wifi network on first boot. If `WPA_ESSID` is set and `WPA_PASSWORD` is unset an unprotected wifi network will be configured. If set, `WPA_PASSWORD` must be between 8 and 63 characters.
* `ENABLE_SSH` (Default: `0`) * `ENABLE_SSH` (Default: `0`)

View File

@ -220,6 +220,11 @@ if [[ -n "${APT_PROXY}" ]] && ! curl --silent "${APT_PROXY}" >/dev/null ; then
exit 1 exit 1
fi fi
if [[ -n "${WPA_PASSWORD}" && ${#WPA_PASSWORD} -lt 8 || ${#WPA_PASSWORD} -gt 63 ]] ; then
echo "WPA_PASSWORD" must be between 8 and 63 characters
exit 1
fi
mkdir -p "${WORK_DIR}" mkdir -p "${WORK_DIR}"
log "Begin ${BASE_DIR}" log "Begin ${BASE_DIR}"

View File

@ -12,7 +12,8 @@ fi
if [ -v WPA_ESSID ] && [ -v WPA_PASSWORD ]; then if [ -v WPA_ESSID ] && [ -v WPA_PASSWORD ]; then
on_chroot <<EOF on_chroot <<EOF
wpa_passphrase "${WPA_ESSID}" "${WPA_PASSWORD}" >> "/etc/wpa_supplicant/wpa_supplicant.conf" set -o pipefail
wpa_passphrase "${WPA_ESSID}" "${WPA_PASSWORD}" | tee -a "/etc/wpa_supplicant/wpa_supplicant.conf"
EOF EOF
elif [ -v WPA_ESSID ]; then elif [ -v WPA_ESSID ]; then
cat >> "${ROOTFS_DIR}/etc/wpa_supplicant/wpa_supplicant.conf" << EOL cat >> "${ROOTFS_DIR}/etc/wpa_supplicant/wpa_supplicant.conf" << EOL