From 74973624deed05d1cc8b297fb1d877cadad50969 Mon Sep 17 00:00:00 2001 From: Yves Fischer Date: Thu, 2 Aug 2018 17:21:14 +0200 Subject: new commit-history root - cleaned off passwords --- scripts/setup_wlan.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 scripts/setup_wlan.sh (limited to 'scripts/setup_wlan.sh') diff --git a/scripts/setup_wlan.sh b/scripts/setup_wlan.sh new file mode 100755 index 0000000..8621bf0 --- /dev/null +++ b/scripts/setup_wlan.sh @@ -0,0 +1,30 @@ +#!/bin/bash +set -x +PORT=$1 +CONFIGFILE=$2 + +HOST=$(python3 ../scripts/read_config.py CONFIG_DHCP_HOSTNAME) +SSID=$(python3 ../scripts/read_config.py CONFIG_WPA_SSID) +PASS=$(python3 ../scripts/read_config.py CONFIG_WPA_KEYPHRASE) + +cat $PORT & +PRINTER_PID=$! + +# interrupt +echo -e -n "\003" >$PORT + +# Enter RAW Repl +echo -e -n "\001" >$PORT + +echo -e -n "import network\004" >$PORT +echo -e -n "wlan = network.WLAN(network.STA_IF)\004" >$PORT +echo -e -n "wlan.active(True)\004" >$PORT +echo -e -n "wlan.config(dhcp_hostname='$HOST')\004" >$PORT +echo -e -n "wlan.connect('$SSID', '$PASS')\004" >$PORT +echo -e -n "ap = network.WLAN(network.AP_IF)\004" >$PORT +echo -e -n "ap.active(False)\004" >$PORT +echo -e -n "\002" >$PORT + +sleep 3 + +kill $PRINTER_PID -- cgit v1.2.1