Inspiration from http://www.raspberryconnect.com/network/item/330-raspberry-pi-auto-wifi-hotspot-switch-internet
- A working Wifi (configured in /etc/wpa_supplicant/wpa_supplicant.conf)
- A working hotspot setup (configured in /etc/hostapd/hostapd.conf)
- The /etc/dhcpcd.conf file has following contents:
interface wlan0
nohook wpa_supplicant
-
Copy the file autohotspot to /usr/bin/autohotspot and chmod a+x
-
Copy the file autohotspot.service to /etc/systemd/system/
-
systemctl enable autohotspot
-
Create a file /boot/wificfg.txt with a single line. The contents supported are:
- hotspot
- Automatically start Raspberry PI in hotspot mode
- wifi
- Automatically start Raspberry PI in wifi mode
- wifiOrhotspot
- While booting, Try Wifi client for 10s, if not connected, Start hotspot mode
- hotspot
-
If the file /boot/wificfg.txt is not present, then start in hotspot mode