Download suitable runtime from GitHub automatically#22
Conversation
We no longer ship any runtimes with the AppImage, but just download the latest continuous release. TODO: download latest *released* runtime, and allow users to specify the release they want to download a runtime for. (We need to parse the GitHub API to find the latest release; the latter variant just skips that step and replaces one component in the URL.)
probonopd
left a comment
There was a problem hiding this comment.
Where does libcurl look for certificates? (This might be a showstopper, since every Linux distribution thinks it needs to invent new paths for them.)
src/appimagetool_fetch_runtime.c
Outdated
| curl_global_init(CURL_GLOBAL_ALL); | ||
|
|
||
| char* url = NULL; | ||
| int url_size = asprintf(&url, "https://github.com/AppImage/type2-runtime/releases/download/continuous/runtime-%s", arch); |
There was a problem hiding this comment.
Need to use free on the memory allocated by asprintf?
There was a problem hiding this comment.
True. I'll use a stack buffer. The URL is pretty short, after all.
| return false; | ||
| } | ||
|
|
||
| curl_easy_setopt(handle, CURLOPT_URL, url); |
There was a problem hiding this comment.
Shouldn't we check the return values of curl_easy_setopt calls?
There was a problem hiding this comment.
We could (and maybe should), but I don't expect any issues with this code. Even their docs suggest to use these options like this. We could improve on this later. Also, we have a perspective on replacing all of this with a more user friendly C++ interface to libcurl.
|
Before merging, let's at least try this on Debian, Alpine, openSUSE, Alma Linux to get an understanding on whether the certificates stuff works. |
|
It obviously works on Alpine, I already told you Ubuntu works (thus Debian will work, too). Please feel free to run the remaining tests while I fix the code. |
|
Also, as suggested on IRC, we can always optimize on this later on. We should open an issue for a custom certificate chain lookup if need be. We can get inspiration from some related issues. |
We no longer ship any runtimes with the AppImage, but just download the latest continuous release.
TODO: download latest released runtime, and allow users to specify the release they want to download a runtime for. (We need to parse the GitHub API to find the latest release; the latter variant just skips that step and replaces one component in the URL.)
Fixes #11.