36 lines
1.0 KiB
Bash
36 lines
1.0 KiB
Bash
|
#!/bin/bash
|
||
|
|
||
|
defaultDEVICE_ID=fad7795eff2d760d27b7bc59
|
||
|
defaultTOKEN=90a408ad822cce2e194a7cdc
|
||
|
defaultWIFI_SSID=Pinguin
|
||
|
defaultWIFI_PWD=PaulchenAufmKlo34
|
||
|
|
||
|
read -p 'Device ID [default=$defaultDEVICE_ID]: ' DEVICE_ID
|
||
|
: ${DEVICE_ID:=$defaultDEVICE_ID}
|
||
|
echo $DEVICE_ID
|
||
|
read -p 'Mongoose Dash Token: [default=$defaultTOKEN]' TOKEN
|
||
|
: ${TOKEN:=$defaultTOKEN}
|
||
|
echo $TOKEN
|
||
|
read -p 'Wifi SSID [default=$defaultSSID]: ' WIFI_SSID
|
||
|
: ${WIFI_SSID:=$defaultWIFI_SSID}
|
||
|
echo $WIFI_SSID
|
||
|
read -sp 'Wifi Password: ' WIFI_PWD
|
||
|
: ${WIFI_PWD:=$defaultWIFI_PWD}
|
||
|
echo "*****"
|
||
|
echo ""
|
||
|
echo "Setting device id to $DEVICE_ID"
|
||
|
mos config-set --no-reboot device.id="$DEVICE_ID"
|
||
|
echo "Setting token to $TOKEN"
|
||
|
mos config-set --no-reboot dash.token="$TOKEN"
|
||
|
echo "Enabling DASH"
|
||
|
mos config-set --no-reboot dash.enable=true
|
||
|
echo "Setting ACLs"
|
||
|
mos config-set --no-reboot conf_acl=wifi.*,device.*,dash.enable
|
||
|
echo "Setting WIFI"
|
||
|
mos wifi "$WIFI_SSID" "$WIFI_PWD"
|
||
|
echo "Making changes permanent"
|
||
|
mos call FS.Rename '{"src": "conf9.json", "dst": "conf5.json"}'
|
||
|
echo "Rebooting device"
|
||
|
mos call Sys.Reboot
|
||
|
|