diff --git a/bin/configure_gateway b/bin/configure_gateway index ef74a41a0242ba083cb7068ce273ad04d8bb1e89..b6851a8d728e82dcd55aa57b15c28f94f7654d46 100755 --- a/bin/configure_gateway +++ b/bin/configure_gateway @@ -470,8 +470,7 @@ def configureNetworkAP(changewifi): print noooo("the last line of configureNetworkAP") def setNetwork(network_conf, ssid): - if not os.path.isfile('/etc/wpa_supplicant.conf.original'): - subprocess.call("cp /etc/wpa_supplicant.conf /etc/wpa_supplicant.conf.original", shell=True) + subprocess.call("cp /usr/lib/node_modules/iot-gateway-setup/wpa_supplicant.tpl /etc/wpa_supplicant.conf", shell=True) wpa_supplicant = open('/etc/wpa_supplicant.conf','a') #Will not take care of duplicates at the moment. wpa_supplicant.write(network_conf) @@ -685,6 +684,9 @@ def disableOneTimeSetup(persist): subprocess.call("/usr/rigado/scripts/led_control.sh green solid", shell=True) subprocess.call("/etc/init.d/iot-gateway-setup-server stop", shell=True) + if not 'auto wlan0' in open('/etc/network/interfaces').read(): + subprocess.call("sed -i '/iface wlan/i auto wlan0' /etc/network/interfaces", shell=True) + def toggleOneTimeSetup(persist): if showWiFiMode() == "Master": disableOneTimeSetup(persist) diff --git a/wpa_supplicant.tpl b/wpa_supplicant.tpl new file mode 100644 index 0000000000000000000000000000000000000000..5704446eecf9ef7eb9d1e8205bb79c5012fd740f --- /dev/null +++ b/wpa_supplicant.tpl @@ -0,0 +1,7 @@ +ctrl_interface=/var/run/wpa_supplicant +ctrl_interface_group=0 +update_config=1 + +network={ + key_mgmt=NONE +}