fix: fixed auto-update plugin to use pip3 based update process from pypi.org
This commit is contained in:
parent
d4d8c39205
commit
1ab1838313
@ -13,6 +13,7 @@ main:
|
|||||||
- YourHomeNetworkHere
|
- YourHomeNetworkHere
|
||||||
auto-update:
|
auto-update:
|
||||||
enabled: false
|
enabled: false
|
||||||
|
system: false # set to true to also enable system updates via apt
|
||||||
interval: 1 # every day
|
interval: 1 # every day
|
||||||
auto-backup:
|
auto-backup:
|
||||||
enabled: false
|
enabled: false
|
||||||
|
@ -17,12 +17,17 @@ def on_loaded():
|
|||||||
global READY
|
global READY
|
||||||
|
|
||||||
if 'interval' not in OPTIONS or ('interval' in OPTIONS and OPTIONS['interval'] is None):
|
if 'interval' not in OPTIONS or ('interval' in OPTIONS and OPTIONS['interval'] is None):
|
||||||
logging.error("AUTO-UPDATE: Interval is not set.")
|
logging.error("auto-update: Interval is not set.")
|
||||||
return
|
return
|
||||||
|
|
||||||
READY = True
|
READY = True
|
||||||
|
|
||||||
|
|
||||||
|
def run(cmd):
|
||||||
|
return subprocess.Popen(cmd, shell=True, stdin=None, stdout=open("/dev/null", "w"), stderr=None,
|
||||||
|
executable="/bin/bash")
|
||||||
|
|
||||||
|
|
||||||
def on_internet_available(agent):
|
def on_internet_available(agent):
|
||||||
global STATUS
|
global STATUS
|
||||||
|
|
||||||
@ -36,23 +41,20 @@ def on_internet_available(agent):
|
|||||||
display.set('status', 'Updating ...')
|
display.set('status', 'Updating ...')
|
||||||
display.update()
|
display.update()
|
||||||
|
|
||||||
logging.info("AUTO-UPDATE: updating packages index ...")
|
logging.info("auto-update: updating pwnagotchi ...")
|
||||||
|
run('pip3 install --upgrade --upgrade-strategy only-if-needed pwnagotchi').wait()
|
||||||
|
|
||||||
update = subprocess.Popen('apt update -y', shell=True, stdin=None,
|
if OPTIONS['system']:
|
||||||
stdout=open("/dev/null", "w"), stderr=None, executable="/bin/bash")
|
logging.info("auto-update: updating packages index ...")
|
||||||
update.wait()
|
run('apt update -y').wait()
|
||||||
|
|
||||||
logging.info("AUTO-UPDATE: updating packages ...")
|
logging.info("auto-update: updating packages ...")
|
||||||
|
run('apt upgrade -y').wait()
|
||||||
upgrade = subprocess.Popen('apt upgrade -y', shell=True, stdin=None,
|
|
||||||
stdout=open("/dev/null", "w"), stderr=None, executable="/bin/bash")
|
|
||||||
upgrade.wait()
|
|
||||||
|
|
||||||
logging.info("AUTO-UPDATE: complete.")
|
|
||||||
|
|
||||||
|
logging.info("auto-update: complete.")
|
||||||
STATUS.update()
|
STATUS.update()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.exception("AUTO-UPDATE ERROR")
|
logging.exception("auto-update ERROR")
|
||||||
|
|
||||||
display.set('status', 'Updated!')
|
display.set('status', 'Updated!')
|
||||||
display.update()
|
display.update()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user