From c947d5c43b68c7c1ba5e4bb0e0bd1769b1b98ba3 Mon Sep 17 00:00:00 2001 From: Simone Margaritelli Date: Sun, 20 Oct 2019 18:41:57 +0200 Subject: [PATCH] misc: small fix or general refactoring i did not bother commenting --- pwnagotchi/plugins/default/auto-update.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pwnagotchi/plugins/default/auto-update.py b/pwnagotchi/plugins/default/auto-update.py index 42effb80..57579252 100644 --- a/pwnagotchi/plugins/default/auto-update.py +++ b/pwnagotchi/plugins/default/auto-update.py @@ -71,7 +71,7 @@ def on_internet_available(agent): try: display.set('status', 'Checking for updates ...') - display.update() + display.update(force=True) to_install = [] to_check = [ @@ -87,8 +87,12 @@ def on_internet_available(agent): logging.warning("new update for %s is available: %s" % (repo, info['url'])) to_install.append(info) - if len(to_install) > 0 and OPTIONS['install']: - logging.info("[update] TODO: install %d updates" % len(to_install)) + num_updates = len(to_install) + if num_updates > 0: + if OPTIONS['install']: + logging.info("[update] TODO: install %d updates" % len(to_install)) + else: + prev_status = '%d new update%c available!' % (num_updates, 's' if num_updates > 1 else '') logging.info("[update] done") @@ -98,4 +102,4 @@ def on_internet_available(agent): logging.error("[update] %s" % e) display.set('status', prev_status if prev_status is not None else '') - display.update() + display.update(force=True)