-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
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.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to use free
on the memory allocated by asprintf
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we check the return values of curl_easy_setopt
calls?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.