modified: mycroft/client/enclosure/__init__.py
modified: mycroft/client/wifisetup/main.pypull/748/head
parent
579ddef45a
commit
b5ec28ed27
|
@ -131,8 +131,6 @@ class EnclosureReader(Thread):
|
|||
self.ws.emit(Message("mycroft.wifi.start"))
|
||||
|
||||
if "unit.factory-reset" in data:
|
||||
self.ws.emit(
|
||||
Message("enclosure.eyes.spin"))
|
||||
subprocess.call(
|
||||
'rm ~/.mycroft/identity/identity2.json',
|
||||
shell=True)
|
||||
|
@ -144,9 +142,12 @@ class EnclosureReader(Thread):
|
|||
subprocess.call('systemctl reboot -i', shell=True)
|
||||
|
||||
if "unit.enable-ssh" in data:
|
||||
subprocess.call('sudo touch /boot/ssh', shell=True)
|
||||
#this is handled by the wifi client
|
||||
self.ws.emit(Message("mycroft.enable.ssh"))
|
||||
self.ws.emit(Message("speak", {
|
||||
'utterance': "SSH will be enabled on next boot"}))
|
||||
time.sleep(4)
|
||||
subprocess.call('systemctl reboot -i', shell=True)
|
||||
|
||||
def stop(self):
|
||||
self.alive = False
|
||||
|
|
|
@ -268,6 +268,9 @@ class WiFi:
|
|||
# This event is similar to the above, but resets the wifi
|
||||
self.ws.on('mycroft.wifi.reset', self.reset)
|
||||
|
||||
# an event to enable SSH
|
||||
self.ws.on('enclosure.enable.ssh', self.ssh)
|
||||
|
||||
# These events are generated by Javascript in the captive
|
||||
# portal.
|
||||
self.ws.on('mycroft.wifi.stop', self.stop)
|
||||
|
@ -560,6 +563,13 @@ class WiFi:
|
|||
except Exception as e:
|
||||
LOG.error("Error: {0}".format(e))
|
||||
|
||||
def ssh(self, event=None):
|
||||
LOG.info("Enabling SSH")
|
||||
try:
|
||||
call('sudo touch /boot/ssh', shell=True)
|
||||
except Exception as e:
|
||||
LOG.error("Error: {0}".format(e))
|
||||
|
||||
|
||||
def main():
|
||||
wifi = WiFi()
|
||||
|
|
Loading…
Reference in New Issue