Skip to content

Commit

Permalink
Ensure pi-gens Wi-Fi variables are unset if not provided, it tries to…
Browse files Browse the repository at this point in the history
… use blank values too.
  • Loading branch information
aniongithub committed Apr 23, 2021
1 parent 6a23072 commit 1675917
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions config
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ export FIRST_USER_NAME=${FIRST_USER:=pi}
export FIRST_USER_PASS=${FIRST_USERPASS:=rasberry}
export ENABLE_SSH=${SSH_ENABLED:=1}

export WPA_ESSID=${WPA_SSID:=""}
export WPA_PASSWORD=${WPA_PASSPHRASE:=""}
export WPA_COUNTRY=${WPA_COUNTRY:=""}

export LOCALE_DEFAULT=${LOCALE:=$(localectl status | sed -n -e 's/^.*LANG=//p')}
export KEYBOARD_KEYMAP=${KEYMAP:=$(localectl status | sed -n -e 's/^.*X11 Layout: //p')}
export KEYBOARD_LAYOUT=${KEY_LAYOUT:=$(debconf-show keyboard-configuration | sed -n -e 's/^.*keyboard-configuration\/layout: //p')}
Expand All @@ -22,4 +18,18 @@ export DOCKER_ADDL_MOUNTS=(
"${CONFIG_DIR}/bootstrap-resources:/bootstrap-resources:ro")

# We only want to build a lite image
export STAGE_LIST="stage0 stage1 stage2"
export STAGE_LIST="stage0 stage1 stage2"

# Set up WiFi
if [[ -z $WPA_SSID || -z $WPA_PASSPHRASE || -z $WPA_COUNTRY ]]
then
echo "Skipping Wi-Fi setup, one or more required Wi-Fi fields were not provided"
unset WPA_ESSID
unset WPA_PASSWORD
unset WPA_COUNTRY
else
echo "Setting up Wi-Fi, step 1/2..."
export WPA_ESSID="${WPA_SSID}"
export WPA_PASSWORD="${WPA_PASSPHRASE}"
export WPA_COUNTRY="${WPA_COUNTRY}"
fi

0 comments on commit 1675917

Please sign in to comment.