hypriot / device-init

Initialize a device on boot with user defined configuration
MIT License
70 stars 17 forks source link

Support multiple wifi alternatives #31

Open vielmetti opened 8 years ago

vielmetti commented 8 years ago

I don't know how this would be done, but here's the situation:

I have a device that I'm moving from place to place and I'd like the wifi setup to be as easy as possible.

Is it possible to support more than one wifi SSID and password in the device-init system? The examples provided only show a single setup.

marcbachmann commented 7 years ago

I tried to set up using something like the following config but the wlan0 file always gets overwritten on restart.

# /etc/wpa_supplicant/wpa_supplicant.conf
network={
  ssid="first-wifi"
  psk=0d66948cb7ee535e15ab68616fb176eb065abec7a0c0e462a17f223ff2704f95
}

network={
  ssid="second-wifi"
  psk=0d66948cb7ee535e15ab68616fb176eb065abec7a0c0e462a17f223ff2704f95
}

and

# /etc/network/interfaces.d/wlan0
allow-hotplug wlan0

auto wlan0
iface wlan0 inet dhcp
  wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf