From 9a58956bf3491dd492e1d7cdac4da21f847fb8e9 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Fri, 7 Apr 2023 21:29:53 +0100 Subject: rewrite update --- src/backend/update.py | 41 ++++++++++++++++------------------------- 1 file changed, 16 insertions(+), 25 deletions(-) (limited to 'src/backend/update.py') diff --git a/src/backend/update.py b/src/backend/update.py index dc16d4c..54e07e3 100644 --- a/src/backend/update.py +++ b/src/backend/update.py @@ -19,7 +19,7 @@ def sync_evrth(): @animation.wait('fetching updates') -def start(): +def start(gfx_ui=False): actv_brch = sisyphus.getenv.sys_brch() bhst_addr = sisyphus.getenv.bhst_addr() is_sane = sisyphus.checkenv.sanity() @@ -33,31 +33,22 @@ def start(): else: print(sisyphus.getcolor.green + "\n\nActive branch:" + " " + sisyphus.getcolor.reset + "'" + actv_brch + "'" + " " + "(testing)" + " " + sisyphus.getcolor.green + "\nActive binhost:" + " " + sisyphus.getcolor.reset + "'" + bhst_addr + "'" + " " + "(stable)") - sys.exit(sisyphus.getcolor.bright_red + "\n\nInvalid configuration!" + sisyphus.getcolor.reset + sisyphus.getcolor.bright_yellow + "\nUse" + - sisyphus.getcolor.reset + " " + "'" + "sisyphus branch --help" + "'" + " " + sisyphus.getcolor.bright_yellow + "for help" + sisyphus.getcolor.reset) + if gfx_ui: + print("\n\nInvalid configuration!") + print("Use 'sisyphus branch --help' for help\n") + t = 10 + while t > 0: + mins, secs = divmod(t, 60) + timer = '{:02d}:{:02d}'.format(mins, secs) + print(timer, end='\r') + time.sleep(1) + t -= 1 -def xstart(): - actv_brch = sisyphus.getenv.sys_brch() - bhst_addr = sisyphus.getenv.bhst_addr() - is_sane = sisyphus.checkenv.sanity() + print('Time is up!') + sys.exit() - if is_sane == 1: - sync_evrth() - else: - if "packages-next" in bhst_addr: - print("\n\nActive branch:" + " " + "'" + actv_brch + "'" + " " + "(stable)" + - "\nActive binhost:" + " " + "'" + bhst_addr + "'" + " " + "(testing)") else: - print("\n\nActive branch:" + " " + "'" + actv_brch + "'" + " " + "(testing)" + - "\nActive binhost:" + " " + "'" + bhst_addr + "'" + " " + "(stable)") - print("\n\nInvalid configuration!" + - "\nUse 'sisyphus branch --help' for help\n") - t = int(10) - while t: - mins, secs = divmod(t, 60) - timer = '{:02d}:{:02d}'.format(mins, secs) - print(timer, end="\r") - time.sleep(1) - t -= 1 - sys.exit() + print(sisyphus.getcolor.bright_red + "\n\nInvalid configuration!" + sisyphus.getcolor.reset + sisyphus.getcolor.bright_yellow + "\nUse" + + sisyphus.getcolor.reset + " " + "'" + "sisyphus branch --help" + "'" + " " + sisyphus.getcolor.bright_yellow + "for help" + sisyphus.getcolor.reset) + sys.exit() -- cgit v1.2.3