-
Notifications
You must be signed in to change notification settings - Fork 99
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
Install script: fix query latest release from GitHub on missing curl #839
Install script: fix query latest release from GitHub on missing curl #839
Conversation
The updated install.sh script queries the latest fpm release version from github directly, instead of having its version hardcoded
@fortran-lang/admins please assign any reviewers if you wish to close this PR, thanks. |
install.sh
Outdated
if command -v curl > /dev/null 2>&1; then | ||
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api | ||
grep '"tag_name":' | # Get tag line | ||
sed -E 's/.*"([^"]+)".*/\1/' | # Pluck JSON value | ||
sed -E 's/^v//' # Remove heading "v" if present | ||
elif command -v wget > /dev/null 2>&1; then | ||
wget -q -O- "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api | ||
grep '"tag_name":' | # Get tag line | ||
sed -E 's/.*"([^"]+)".*/\1/' | # Pluck JSON value | ||
sed -E 's/^v//' # Remove heading "v" if present | ||
else |
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.
You can reuse the logic later in the script where we define the FETCH
variable.
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.
Looks better now - made it a function
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.
Looks good to me now.
Improve the command to query the latest release version from Github by trying curl then wget; with fallback to the last known version release if none of the two commands is available