Try updating the system on boot when not paired
This sends a new system.update.check message when the device is booted and not paired
It is not sent every boot because the command could upgrade across major versions which the user could not want.
@@ -77,6 +77,19 @@ def _starting_up():
check_connection()
+def try_update_system(platform):
+ bus.emit(Message('system.update'))
+ msg = Message('system.update', {
+ 'paired': is_paired(),
+ 'platform': platform
+ })
+ resp = bus.wait_for_response(msg, 'system.update.processing')
+
+ if resp and (resp.data or {}).get('processing', True):
+ bus.wait_for_response(Message('system.update.waiting'),
+ 'system.update.complete', 1000)
+
+
def check_connection():
"""
Check for network connection. If not paired trigger pairing.
@@ -97,6 +110,9 @@ def check_connection():
bus.emit(Message("system.ntp.sync"))
time.sleep(15) # TODO: Generate/listen for a message response...
+ if not is_paired():
+ try_update_system(platform)
+
# Check if the time skewed significantly. If so, reboot
skew = abs((time.monotonic() - start_ticks) -
(time.time() - start_clock))
