Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
vesta
iot-gateway-setup
Commits
b70a69c3
Commit
b70a69c3
authored
Nov 01, 2017
by
David Mondou
Browse files
ES-324 Create custom ssid for Wireless Access Point
parent
bfc729e1
Changes
1
Show whitespace changes
Inline
Side-by-side
bin/configure_gateway
View file @
b70a69c3
...
...
@@ -177,7 +177,7 @@ def changeName(newName):
if
WSREGEX
.
search
(
newName
):
print
"New name contains whitespaces. Ignoring"
return
_changeHostName
(
newName
)
#
_changeHostName(newName)
#_changeP2PSSID(newName)
_changeAPSSID
(
newName
)
...
...
@@ -188,9 +188,10 @@ def _changeHostName(newName):
subprocess
.
call
(
"hostname -F /etc/hostname"
,
shell
=
True
)
def
_changeAPSSID
(
newName
):
saveDefaultSSID
()
#saveDefaultSSID()
subprocess
.
call
([
"sed"
,
"-i"
,
"s/^ssid=.*/ssid="
+
re
.
escape
(
newName
)
+
"/"
,
"/etc/hostapd.conf"
])
subprocess
.
call
(
"/etc/init.d/avahi-daemon restart && sleep 2"
,
shell
=
True
)
#
subprocess.call("/etc/init.d/avahi-daemon restart && sleep 2", shell=True)
def
_changeP2PSSID
(
newName
):
subprocess
.
call
([
"sed"
,
"-i"
,
"s/^p2p_ssid_postfix=.*/p2p_ssid_postfix="
+
re
.
escape
(
newName
)
+
"/"
,
"/etc/wpa_supplicant/p2p_supplicant.conf"
])
...
...
@@ -647,6 +648,11 @@ def getDefaultSSID():
def
enableOneTimeSetup
(
persist
):
subprocess
.
call
(
"/usr/rigado/scripts/led_control.sh green flash"
,
shell
=
True
)
#create unique ssid for Wireless Access Point
unit_number
=
subprocess
.
check_output
([
"unit_serial_number"
]).
rstrip
()
ssid_AP
=
"IoT-Gateway-Setup"
+
unit_number
[
-
6
:]
_changeAPSSID
(
ssid_AP
)
hostname
=
subprocess
.
check_output
(
'hostname'
).
strip
()
print
"Scanning and saving WiFi networks..."
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment