piframe/docs/auto_wifi_setup.md

30 lines
999 B
Markdown

# Automatic WiFi Config
The below will setup automatic WiFi configuration via text file. The way this will work is you plug in a USB disk with a file named ```wifi.txt``` with the ```essid``` as the first line and ```password``` as the second line in the file. On boot a small script will run that reads the file and re-configures the PiFrame's WiFi to use the new values.
Can be used for setup and/or re-configuring WiFi if something changes.
``` sh
DL_URL=$(curl https://git.kemonine.info/api/v1/repos/PiFrame/piframe-go/releases | jq -r '.[0].assets[] | select(.name == "wifi") | .browser_download_url')
wget $DL_URL -O /usr/local/bin/pf-wifi
chmod a+x /usr/local/bin/pf-wifi
cat > /etc/systemd/system/wifi_setup.service <<EOF
[Unit]
Description=Automatic configuration of WiFi on boot
[Service]
User=root
PrivateTmp=true
ExecStart=/usr/local/bin/pf-wifi
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable --now wifi_setup
```