Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
itsthejoker committed Aug 8, 2022
1 parent 716752f commit 9e228c0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
10 changes: 5 additions & 5 deletions bubbles/commands/update_and_restart.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down Expand Up @@ -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)
Expand All @@ -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.")
Expand All @@ -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:
Expand All @@ -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(
Expand Down

0 comments on commit 9e228c0

Please sign in to comment.