Skip to content
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

Merged
merged 5 commits into from
Apr 1, 2024
Merged

Fix #46. Add self-update button. #83

merged 5 commits into from
Apr 1, 2024

Conversation

thw26
Copy link
Collaborator

@thw26 thw26 commented Mar 23, 2024

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 for utils.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.

  • Fix version before merge

@thw26 thw26 marked this pull request as draft March 23, 2024 07:34
tui_app.py Outdated Show resolved Hide resolved
utils.py Outdated Show resolved Hide resolved
utils.py Outdated Show resolved Hide resolved
utils.py Show resolved Hide resolved
LogosLinuxInstaller.py Outdated Show resolved Hide resolved
@thw26
Copy link
Collaborator Author

thw26 commented Mar 28, 2024

Good to be tested again. Thanks for giving it a once over.

I hope to test it soon.

@thw26
Copy link
Collaborator Author

thw26 commented Mar 29, 2024

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 v that I usually prepend in the release tag.

@thw26
Copy link
Collaborator Author

thw26 commented Mar 29, 2024

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.

@thw26
Copy link
Collaborator Author

thw26 commented Mar 29, 2024

Okay. Installed PyInstaller in order to be able to create a binary. I got the following error.

2024-03-28 20:33:08 INFO: Release URL: https://github.com/FaithLife-Community/LogosLinuxInstaller/releases/download/v4.0.0-alpha.3/LogosLinuxInstaller
2024-03-28 20:33:08 INFO: Release URL Tag Name: v4.0.0-alpha.3
2024-03-28 20:33:08 INFO: 4.0.0-alpha.3
2024-03-28 20:33:08 DEBUG: Download source: https://api.github.com/repos/FaithLife-Community/wine-appimages/releases
2024-03-28 20:33:08 DEBUG: Download destination: None
2024-03-28 20:33:08 DEBUG: Getting headers from https://api.github.com/repos/FaithLife-Community/wine-appimages/releases.
2024-03-28 20:33:08 DEBUG: Starting new HTTPS connection (1): api.github.com:443
2024-03-28 20:33:08 DEBUG: https://api.github.com:443 "HEAD /repos/FaithLife-Community/wine-appimages/releases HTTP/1.1" 200 0
2024-03-28 20:33:08 DEBUG: content_length = '3318'
2024-03-28 20:33:08 DEBUG: content_md5 = None
2024-03-28 20:33:08 DEBUG: File size on server: 3318
2024-03-28 20:33:08 DEBUG: chunk_size = 66; file_mode = 'wb'; headers = {'Accept-Encoding': 'identity'}
2024-03-28 20:33:08 INFO: Starting new download for https://api.github.com/repos/FaithLife-Community/wine-appimages/releases.
2024-03-28 20:33:08 DEBUG: Starting new HTTPS connection (1): api.github.com:443
2024-03-28 20:33:08 DEBUG: https://api.github.com:443 "GET /repos/FaithLife-Community/wine-appimages/releases HTTP/1.1" 200 3318
2024-03-28 20:33:08 DEBUG: json_data=[{'url': 'https://api.github.com/repos/FaithLife-Community/wine-appimages/releases/137482619', 'assets_url': 'https://api.github.com/repos/FaithLife-Community/wine-appimages/releases/137482619/assets', 'upload_url': 'https://uploads.github.com/repos/FaithLife-Community/wine-appimages/releases/137482619/assets{?name,label}', 'html_url': 'https://github.com/FaithLife-Community/wine-appimages/releases/tag/8.19-devel', 'id': 137482619, 'author': {'login': 'thw26', 'id': 16613290, 'node_id': 'MDQ6VXNlcjE2NjEzMjkw', 'avatar_url': 'https://avatars.githubusercontent.com/u/16613290?v=4', 'gravatar_id': '', 'url': 'https://api.github.com/users/thw26', 'html_url': 'https://github.com/thw26', 'followers_url': 'https://api.github.com/users/thw26/followers', 'following_url': 'https://api.github.com/users/thw26/following{/other_user}', 'gists_url': 'https://api.github.com/users/thw26/gists{/gist_id}', 'starred_url': 'https://api.github.com/users/thw26/starred{/owner}{/repo}', 'subscriptions_url': 'https://api.github.com/users/thw26/subscriptions', 'organizations_url': 'https://api.github.com/users/thw26/orgs', 'repos_url': 'https://api.github.com/users/thw26/repos', 'events_url': 'https://api.github.com/users/thw26/events{/privacy}', 'received_events_url': 'https://api.github.com/users/thw26/received_events', 'type': 'User', 'site_admin': False}, 'node_id': 'RE_kwDOLGSpLM4IMdF7', 'tag_name': '8.19-devel', 'target_commitish': 'main', 'name': 'Wine AppImage 8.19 Devel', 'draft': False, 'prerelease': False, 'created_at': '2024-01-18T02:35:06Z', 'published_at': '2024-01-18T02:39:49Z', 'assets': [{'url': 'https://api.github.com/repos/FaithLife-Community/wine-appimages/releases/assets/146224179', 'id': 146224179, 'node_id': 'RA_kwDOLGSpLM4ItzQz', 'name': 'wine-devel_8.19-x86_64.AppImage', 'label': None, 'uploader': {'login': 'thw26', 'id': 16613290, 'node_id': 'MDQ6VXNlcjE2NjEzMjkw', 'avatar_url': 'https://avatars.githubusercontent.com/u/16613290?v=4', 'gravatar_id': '', 'url': 'https://api.github.com/users/thw26', 'html_url': 'https://github.com/thw26', 'followers_url': 'https://api.github.com/users/thw26/followers', 'following_url': 'https://api.github.com/users/thw26/following{/other_user}', 'gists_url': 'https://api.github.com/users/thw26/gists{/gist_id}', 'starred_url': 'https://api.github.com/users/thw26/starred{/owner}{/repo}', 'subscriptions_url': 'https://api.github.com/users/thw26/subscriptions', 'organizations_url': 'https://api.github.com/users/thw26/orgs', 'repos_url': 'https://api.github.com/users/thw26/repos', 'events_url': 'https://api.github.com/users/thw26/events{/privacy}', 'received_events_url': 'https://api.github.com/users/thw26/received_events', 'type': 'User', 'site_admin': False}, 'content_type': 'application/octet-stream', 'state': 'uploaded', 'size': 929280344, 'download_count': 278, 'created_at': '2024-01-18T02:35:39Z', 'updated_at': '2024-01-18T02:38:27Z', 'browser_download_url': 'https://github.com/FaithLife-Community/wine-appimages/releases/download/8.19-devel/wine-devel_8.19-x86_64.AppImage'}], 'tarball_url': 'https://api.github.com/repos/FaithLife-Community/wine-appimages/tarball/8.19-devel', 'zipball_url': 'https://api.github.com/repos/FaithLife-Community/wine-appimages/zipball/8.19-devel', 'body': 'From https://github.com/mmtrt/WINE_AppImage/.\r\n\r\nBecause the above repo overwrites its AppImages with the latest Wine bi-weekly release, we have to store our own copies.'}]
2024-03-28 20:33:08 INFO: Release URL: https://github.com/FaithLife-Community/wine-appimages/releases/download/8.19-devel/wine-devel_8.19-x86_64.AppImage
2024-03-28 20:33:08 INFO: Writing config to /home/thwright/.config/Logos_on_Linux/Logos_on_Linux.json
2024-03-28 20:33:08 INFO: Running function: update_to_latest_lli_release
2024-03-28 20:33:08 DEBUG: status=0; message='yes'
2024-03-28 20:33:08 DEBUG: Converting LLI binary's path to expanded_path: ./dist/LogosLinuxInstaller/LogosLinuxInstaller
2024-03-28 20:33:08 INFO: Downloading 'https://github.com/FaithLife-Community/LogosLinuxInstaller/releases/download/v4.0.0-alpha.3/LogosLinuxInstaller' to '/home/thwright/Downloads'
Downloading 'https://github.com/FaithLife-Community/LogosLinuxInstaller/releases/download/v4.0.0-alpha.3/LogosLinuxInstaller' to '/home/thwright/Downloads'
2024-03-28 20:33:08 DEBUG: Download source: https://github.com/FaithLife-Community/LogosLinuxInstaller/releases/download/v4.0.0-alpha.3/LogosLinuxInstaller
2024-03-28 20:33:08 DEBUG: Download destination: /home/thwright/Downloads/LogosLinuxInstaller
2024-03-28 20:33:08 DEBUG: Getting headers from https://github.com/FaithLife-Community/LogosLinuxInstaller/releases/download/v4.0.0-alpha.3/LogosLinuxInstaller.
2024-03-28 20:33:08 DEBUG: Starting new HTTPS connection (1): github.com:443
2024-03-28 20:33:09 DEBUG: https://github.com:443 "HEAD /FaithLife-Community/LogosLinuxInstaller/releases/download/v4.0.0-alpha.3/LogosLinuxInstaller HTTP/1.1" 302 0
2024-03-28 20:33:09 DEBUG: Starting new HTTPS connection (1): objects.githubusercontent.com:443
2024-03-28 20:33:09 DEBUG: https://objects.githubusercontent.com:443 "HEAD /github-production-release-asset-2e65be/736682215/2d5d5d64-687f-49ee-bc00-b29b27b4e8e2?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAVCODYLSA53PQK4ZA%2F20240329%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240329T003309Z&X-Amz-Expires=300&X-Amz-Signature=af65aded8160332b8b190346d315c7386fdb4a3f3ca215863f3710725704e22f&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=736682215&response-content-disposition=attachment%3B%20filename%3DLogosLinuxInstaller&response-content-type=application%2Foctet-stream HTTP/1.1" 200 0
2024-03-28 20:33:09 DEBUG: content_length = '29470544'
2024-03-28 20:33:09 DEBUG: content_md5 = 'kvQB0K8NpQAdAT9UjcPldA=='
2024-03-28 20:33:09 DEBUG: File size on server: 29470544
2024-03-28 20:33:09 DEBUG: File exists: /home/thwright/Downloads/LogosLinuxInstaller
2024-03-28 20:33:09 INFO: Current downloaded size in bytes: 29429752
2024-03-28 20:33:09 DEBUG: Server accepts byte range; attempting to resume download.
2024-03-28 20:33:09 DEBUG: chunk_size = 589410; file_mode = 'ab'; headers = {'Accept-Encoding': 'identity', 'Range': 'bytes=29429752-29470544'}
2024-03-28 20:33:09 INFO: Continuing download for https://github.com/FaithLife-Community/LogosLinuxInstaller/releases/download/v4.0.0-alpha.3/LogosLinuxInstaller.
2024-03-28 20:33:09 DEBUG: Starting new HTTPS connection (1): github.com:443
2024-03-28 20:33:09 DEBUG: https://github.com:443 "GET /FaithLife-Community/LogosLinuxInstaller/releases/download/v4.0.0-alpha.3/LogosLinuxInstaller HTTP/1.1" 302 0
2024-03-28 20:33:09 DEBUG: Starting new HTTPS connection (1): objects.githubusercontent.com:443
2024-03-28 20:33:09 DEBUG: https://objects.githubusercontent.com:443 "GET /github-production-release-asset-2e65be/736682215/2d5d5d64-687f-49ee-bc00-b29b27b4e8e2?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAVCODYLSA53PQK4ZA%2F20240329%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240329T003309Z&X-Amz-Expires=300&X-Amz-Signature=af65aded8160332b8b190346d315c7386fdb4a3f3ca215863f3710725704e22f&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=736682215&response-content-disposition=attachment%3B%20filename%3DLogosLinuxInstaller&response-content-type=application%2Foctet-stream HTTP/1.1" 206 40792
2024-03-28 20:33:09 DEBUG: Appending data to file /home/thwright/Downloads/LogosLinuxInstaller.
 [............................................................] 100%
2024-03-28 20:33:10 DEBUG: Comparing size of https://github.com/FaithLife-Community/LogosLinuxInstaller/releases/download/v4.0.0-alpha.3/LogosLinuxInstaller and ./dist/LogosLinuxInstaller/LogosLinuxInstaller.
2024-03-28 20:33:10 DEBUG: Getting headers from https://github.com/FaithLife-Community/LogosLinuxInstaller/releases/download/v4.0.0-alpha.3/LogosLinuxInstaller.
2024-03-28 20:33:10 DEBUG: Starting new HTTPS connection (1): github.com:443
2024-03-28 20:33:10 DEBUG: https://github.com:443 "HEAD /FaithLife-Community/LogosLinuxInstaller/releases/download/v4.0.0-alpha.3/LogosLinuxInstaller HTTP/1.1" 302 0
2024-03-28 20:33:10 DEBUG: Starting new HTTPS connection (1): objects.githubusercontent.com:443
2024-03-28 20:33:10 DEBUG: https://objects.githubusercontent.com:443 "HEAD /github-production-release-asset-2e65be/736682215/2d5d5d64-687f-49ee-bc00-b29b27b4e8e2?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAVCODYLSA53PQK4ZA%2F20240329%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240329T003309Z&X-Amz-Expires=300&X-Amz-Signature=af65aded8160332b8b190346d315c7386fdb4a3f3ca215863f3710725704e22f&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=736682215&response-content-disposition=attachment%3B%20filename%3DLogosLinuxInstaller&response-content-type=application%2Foctet-stream HTTP/1.1" 200 0
2024-03-28 20:33:10 DEBUG: content_length = '29470544'
2024-03-28 20:33:10 DEBUG: content_md5 = 'kvQB0K8NpQAdAT9UjcPldA=='
2024-03-28 20:33:10 DEBUG: url_size = 29470544 B; file_size = 2927112 B
2024-03-28 20:33:10 INFO: ./dist/LogosLinuxInstaller/LogosLinuxInstaller is the wrong size.
Traceback (most recent call last):
  File "LogosLinuxInstaller.py", line 337, in <module>
    main()
  File "LogosLinuxInstaller.py", line 324, in main
    config.ACTION()
  File "utils.py", line 1401, in update_to_latest_lli_release
    update_lli_release()
  File "utils.py", line 1214, in update_lli_release
    msg.logos_error(f"Bad file size or checksum: {Path.joinpath(config.MYDOWNLOADS, 'LogosLinuxInstaller')}")
                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "pathlib.py", line 717, in joinpath
AttributeError: 'str' object has no attribute 'with_segments'
[96362] Failed to execute script 'LogosLinuxInstaller' due to unhandled exception!

So it correctly detected there was a need for an update:

2024-03-28 20:33:08 DEBUG: status=0; message='yes'

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.

2024-03-28 20:41:00 DEBUG: Starting new HTTPS connection (1): objects.githubusercontent.com:443
2024-03-28 20:41:00 DEBUG: https://objects.githubusercontent.com:443 "GET /github-production-release-asset-2e65be/736682215/2d5d5d64-687f-49ee-bc00-b29b27b4e8e2?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAVCODYLSA53PQK4ZA%2F20240329%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240329T003956Z&X-Amz-Expires=300&X-Amz-Signature=00bd9300fb8760e4a1f71e427054ca8c1f051c4dc2ce9fbf7d23191de4f01382&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=736682215&response-content-disposition=attachment%3B%20filename%3DLogosLinuxInstaller&response-content-type=application%2Foctet-stream HTTP/1.1" 416 0
2024-03-28 20:41:00 DEBUG: Appending data to file /home/thwright/Downloads/LogosLinuxInstaller.

Traceback (most recent call last):
  File "LogosLinuxInstaller.py", line 337, in <module>
    main()
  File "LogosLinuxInstaller.py", line 324, in main
    config.ACTION()
  File "utils.py", line 1401, in update_to_latest_lli_release
    update_lli_release()
  File "utils.py", line 1208, in update_lli_release
    if verify_downloaded_file(config.LOGOS_LATEST_VERSION_URL, Path.joinpath(config.MYDOWNLOADS, "LogosLinuxInstaller")):
                                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "pathlib.py", line 717, in joinpath
AttributeError: 'str' object has no attribute 'with_segments'
[97442] Failed to execute script 'LogosLinuxInstaller' due to unhandled exception!

I really need to learn Path better. Mostly fixed. But something is still wrong. It still seems to be comparing the wrong file…

2024-03-28 20:45:33 DEBUG: Starting new HTTPS connection (1): objects.githubusercontent.com:443
2024-03-28 20:45:34 DEBUG: https://objects.githubusercontent.com:443 "HEAD /github-production-release-asset-2e65be/736682215/2d5d5d64-687f-49ee-bc00-b29b27b4e8e2?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAVCODYLSA53PQK4ZA%2F20240329%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240329T004532Z&X-Amz-Expires=300&X-Amz-Signature=e2e08452d85d741d18c93c47ff993577b401300aff8c854915926fd8b04377a4&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=736682215&response-content-disposition=attachment%3B%20filename%3DLogosLinuxInstaller&response-content-type=application%2Foctet-stream HTTP/1.1" 200 0
2024-03-28 20:45:34 DEBUG: content_length = '29470544'
2024-03-28 20:45:34 DEBUG: content_md5 = 'kvQB0K8NpQAdAT9UjcPldA=='
2024-03-28 20:45:34 DEBUG: content_md5 = 'kvQB0K8NpQAdAT9UjcPldA=='
2024-03-28 20:45:34 DEBUG: url_md5 = 'kvQB0K8NpQAdAT9UjcPldA=='
2024-03-28 20:45:34 DEBUG: /home/thwright/Downloads/LogosLinuxInstaller MD5: NMENTzXORt3I08dnShONGQ==
2024-03-28 20:45:34 DEBUG: file_md5 = 'NMENTzXORt3I08dnShONGQ=='
2024-03-28 20:45:34 INFO: /home/thwright/Downloads/LogosLinuxInstaller has the wrong MD5 sum.
2024-03-28 20:45:34 CRITICAL: Bad file size or checksum: /home/thwright/Downloads/LogosLinuxInstaller
If you need help, please consult:
https://github.com/FaithLife-Community/LogosLinuxInstaller/wiki
https://t.me/linux_logos
https://matrix.to/#/#logosbible:matrix.org
Killed

The issue is that we try to reuse an existing download, so in this case, since the LLI binary is storedin ~/Downloads, if it is found, we reuse it rather than downloading it in order to save bandwidth, therefore on comparison the old file is being used. Deleting it allows to proceed, but this would be encountered on everyone's first attempted auto-update.

@thw26
Copy link
Collaborator Author

thw26 commented Mar 29, 2024

Pushed my changes to keep this up-to-date. I'm seeing this now, which is no good. Note the last line:

2024-03-28 21:42:35 DEBUG: content_length = '29470544'
2024-03-28 21:42:35 DEBUG: content_md5 = 'kvQB0K8NpQAdAT9UjcPldA=='
2024-03-28 21:42:35 DEBUG: content_md5 = 'kvQB0K8NpQAdAT9UjcPldA=='
2024-03-28 21:42:35 DEBUG: url_md5 = 'kvQB0K8NpQAdAT9UjcPldA=='
2024-03-28 21:42:35 DEBUG: /home/thwright/Downloads/LogosLinuxInstaller MD5: kvQB0K8NpQAdAT9UjcPldA==
2024-03-28 21:42:35 DEBUG: file_md5 = 'kvQB0K8NpQAdAT9UjcPldA=='
2024-03-28 21:42:35 INFO: /home/thwright/Downloads/LogosLinuxInstaller is verified.
2024-03-28 21:42:35 INFO: LogosLinuxInstaller properties match. Using it…
Copying LogosLinuxInstaller into /home/thwright/Dev/LogosLinuxInstaller/dist/LogosLinuxInstaller/_internal/utils.pyc

@thw26
Copy link
Collaborator Author

thw26 commented Mar 29, 2024

The most recent changes fix the updating process as well as fixing it for the GUI.

I've also created a new function called restart_lli(). The intent is to run the self-update then restart the program so the user has the latest changes. Currently when this happens on the CLI, the TUI is launched on successful update but it graphically flips out and is unusable. I'm guessing this relies on #42.

@thw26
Copy link
Collaborator Author

thw26 commented Mar 29, 2024

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.

@thw26 thw26 marked this pull request as ready for review March 29, 2024 05:12
@thw26 thw26 requested a review from n8marti March 29, 2024 05:12
LogosLinuxInstaller.py Outdated Show resolved Hide resolved
@n8marti
Copy link
Collaborator

n8marti commented Apr 1, 2024

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.

@n8marti
Copy link
Collaborator

n8marti commented Apr 1, 2024

Okay, after explicitly removing the pidfile in restart_lli and also using os.execv instead of subprocess.Popen, I get this to work as expected in TUI. I don't understand the difference between using os vs subprocess, but only the os version seems to work correctly for me. GUI test is still yet to be done. Here's what my testing code looks like for this function:

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()

@n8marti
Copy link
Collaborator

n8marti commented Apr 1, 2024

This now seems to work correctly in TUI and GUI, as long as I first build with ./scripts/build-binary.sh, then run it with ./dist/LogosLinuxInstaller -auD for TUI and DIALOG=tk ./dist/LogosLinuxInstaller -aD for GUI. It correctly finds the newer alpha.3 release, downloads it, replaces the running binary with the new one, and relaunches the binary.

fix typo in 'update_to_latest_lli_release' name

use 'restart_lli' in GUI as well as TUI with 'os.execv'

revert previous changes
@thw26 thw26 merged commit 24a4ff3 into main Apr 1, 2024
@n8marti n8marti deleted the 46-self-update branch April 1, 2024 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add A Self-Update Command
2 participants