From 916be1f63ef2200edd561d4a89e5e61ce60c240c Mon Sep 17 00:00:00 2001
From: Simone Margaritelli <evilsocket@gmail.com>
Date: Sun, 20 Oct 2019 18:36:06 +0200
Subject: [PATCH] misc: small fix or general refactoring i did not bother
 commenting

---
 pwnagotchi/plugins/default/auto-update.py | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/pwnagotchi/plugins/default/auto-update.py b/pwnagotchi/plugins/default/auto-update.py
index 1d7223e..74e71dc 100644
--- a/pwnagotchi/plugins/default/auto-update.py
+++ b/pwnagotchi/plugins/default/auto-update.py
@@ -41,13 +41,15 @@ def check(version, repo, native=True):
     is_arm = arch.startswith('arm')
 
     if latest_ver != info['current']:
-        # check if this release is compatible with arm6
-        for asset in latest['assets']:
-            download_url = asset['browser_download_url']
-            if download_url.endswith('.zip') and (
-                    native is False or arch in download_url or is_arm and 'armhf' in download_url):
-                logging.info("found new update: %s" % download_url)
-                info['url'] = download_url
+        if not native:
+            info['url'] = latest['zipball_url']
+        else:
+            # check if this release is compatible with arm6
+            for asset in latest['assets']:
+                download_url = asset['browser_download_url']
+                if download_url.endswith('.zip') and (arch in download_url or is_arm and 'armhf' in download_url):
+                    logging.info("found new update: %s" % download_url)
+                    info['url'] = download_url
 
     return info
 
@@ -73,7 +75,8 @@ def on_internet_available(agent):
 
             to_install = []
             to_check = [
-                ('bettercap/bettercap', subprocess.getoutput('bettercap -version').split(' ')[1].replace('v', ''), True),
+                (
+                'bettercap/bettercap', subprocess.getoutput('bettercap -version').split(' ')[1].replace('v', ''), True),
                 ('evilsocket/pwngrid', subprocess.getoutput('pwngrid -version').replace('v', ''), True),
                 ('evilsocket/pwnagotchi', pwnagotchi.version, False)
             ]