-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #46. Add self-update button. #83
Conversation
Good to be tested again. Thanks for giving it a once over. I hope to test it soon. |
Pushed further changes on testing. The version selection is correct as we are pulling the tag_name from the GitHub releases page, therefore all we have to do is strip the |
When versions are equal this works, but I still need a good way to test this when the versions are not equal, as in, setting the version to something else without possibly wiping the source files. |
Okay. Installed PyInstaller in order to be able to create a binary. I got the following error.
So it correctly detected there was a need for an update:
But then it errored on comparing the size of the file. Looks like the issue is because the file being downloaded is being stored in a different location than the file being checked. Should be an easy fix. Looks like I'm on the right track. Just need to figure out this type error.
I really need to learn Path better. Mostly fixed. But something is still wrong. It still seems to be comparing the wrong file…
The issue is that we try to reuse an existing download, so in this case, since the LLI binary is storedin |
Pushed my changes to keep this up-to-date. I'm seeing this now, which is no good. Note the last line:
|
The most recent changes fix the updating process as well as fixing it for the GUI. I've also created a new function called |
The curses.wrapper functionality has now been implemented and fixes the TUI update routine. When this is merged, we can check off part of #42. Having tested this now to get it working as I have, I am going to flag it as ready for review. I will also squash my changes. |
I'm getting an error when the TUI restarts: [...]
2024-04-01 10:15:19 DEBUG: Successfully updated Logos Linux Installer.
2024-04-01 10:15:19 DEBUG: Restarting Logos Linux Installer.
(env) nate@nate-XPS:~/g/LogosLinuxInstaller$ The script is already running on PID 3372962. Should it be killed to allow this instance to run? [Y/n]: Traceback (most recent call last):
File "LogosLinuxInstaller.py", line 324, in <module>
msg.logos_error("That option is disabled.", "info")
^^^^^^
File "LogosLinuxInstaller.py", line 296, in main
config.GUI = True
^^^^^^^^^^^^^^^^^^
File "utils.py", line 177, in die_if_running
File "msg.py", line 117, in cli_continue_question
try:
^^
File "msg.py", line 104, in cli_question
cli_msg(message)
^^^^^^^^
EOFError
[3378349] Failed to execute script 'LogosLinuxInstaller' due to unhandled exception!
^C
(env) nate@nate-XPS:~/g/LogosLinuxInstaller$ It looks like it's due to the "already-running" check waiting on user input. Other times I was seeing the TUI restart, but it was locked up using max CPU as if stuck in some kind of loop. I'm going to try to sort out what exactly's going on. Maybe there's some kind of race condition between starting the replaced binary and exiting from the old one. |
Okay, after explicitly removing the pidfile in def restart_lli():
if config.DIALOG != 'tk':
logging.debug("Restarting Logos Linux Installer.")
pidfile = Path('/tmp/LogosLinuxInstaller.pid')
if pidfile.is_file():
pidfile.unlink()
# args = [sys.executable]
# subprocess.Popen(args)
os.execv(sys.executable, [sys.executable])
sys.exit() |
This now seems to work correctly in TUI and GUI, as long as I first build with |
fix typo in 'update_to_latest_lli_release' name use 'restart_lli' in GUI as well as TUI with 'os.execv' revert previous changes
Fixes #46. This adds a new self-update command/option/button.
It also adds
-a|--check-for-updates
to bypass the once every 12-hr limit forutils.check_for_updates()
. This makes it easier to test.It also begins some reconfiguring of the TUI app options to better reflect the thoughts we've put into the optargs and GUI.
At this point, I need to find a way to test this, since it requires a new version to appear. I have tried modifying
config.LLI_CURRENT_VERSION
but something isn't triggering properly to store the GitHub API request for the tag name in the config.