From 9e228c054b026a547ecdb26925f479c9c846a901 Mon Sep 17 00:00:00 2001 From: Joe Kaufeld Date: Mon, 8 Aug 2022 19:44:07 -0400 Subject: [PATCH] bugfix --- Makefile | 2 +- bubbles/commands/update_and_restart.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index a83fd5b..d038859 100644 --- a/Makefile +++ b/Makefile @@ -8,4 +8,4 @@ clean: shiv: mkdir -p build - shiv -c bubbles -o build/bubbles.pyz . --compressed + shiv -c bubbles -o build/bubbles.pyz . --compressed -p "python3.10" diff --git a/bubbles/commands/update_and_restart.py b/bubbles/commands/update_and_restart.py index da4b1af..8383118 100644 --- a/bubbles/commands/update_and_restart.py +++ b/bubbles/commands/update_and_restart.py @@ -17,7 +17,7 @@ def update(payload) -> None: say = payload["extras"]["say"] say("Preparing update...") response = requests.get( - "https://api.github.com/repos/itsthejoker/utils/releases/latest" + "https://api.github.com/repos/grafeasgroup/bubbles-v2/releases/latest" ) if response.status_code != 200: print(f"GITHUB RESPONSE CONTENT: {response.content}") @@ -46,7 +46,7 @@ def update(payload) -> None: with open(backup_archive, "wb") as backup, open(archive_path, "rb") as original: backup.write(original.read()) - subprocess.check_output(shlex.split(f"chmod +x {backup}")) + subprocess.check_output(shlex.split(f"chmod +x {str(backup_archive)}")) # write the new archive to disk resp = requests.get(url, stream=True) @@ -55,7 +55,7 @@ def update(payload) -> None: # make sure the new archive passes the internal tests result = subprocess.run( - shlex.split(f"sh -c '{new_archive} selfcheck'"), stdout=subprocess.DEVNULL + shlex.split(f"sh -c '{str(new_archive)} selfcheck'"), stdout=subprocess.DEVNULL ) if result.returncode != 0: say(f"Selfcheck failed! Stopping update.") @@ -72,7 +72,7 @@ def update(payload) -> None: try: # if this command succeeds, the process dies here - subprocess.check_output(["sudo", "systemctl", "restart", USERNAME]) + subprocess.check_output(shlex.split(f"sudo systemctl restart {USERNAME}")) except subprocess.CalledProcessError: say(f"Update failed, could not restart: \n```\n{traceback.format_exc()}```") with current_zipfile() as archive: @@ -81,7 +81,7 @@ def update(payload) -> None: ) as backup: current.write(backup.read()) say(f"Rolled back to {__version__}. Trying restart again...") - subprocess.check_output(["sudo", "systemctl", "restart", USERNAME]) + subprocess.check_output(shlex.split(f"sudo systemctl restart {USERNAME}")) PLUGIN = Plugin(