-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
scripts: added a script to download the latest release
This script downloads the latest release from a remote Github repository into the current directory. Invoke './scripts/get_latest_release.sh' to get the latest release in the local repository directory.
- Loading branch information
1 parent
553c27b
commit 3eca8f7
Showing
2 changed files
with
50 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/bin/bash | ||
|
||
# Download the latest WRS release (tarball) from the Github repo | ||
|
||
# URLs | ||
url_repo_api="https://api.github.com/repos/GSI-CS-CO/wrs-gsi-releases" | ||
url_latest_api="$url_repo_api/releases/latest" | ||
|
||
# Get the information about the latest release | ||
|
||
latest_release_api=$(curl -s $url_latest_api) | ||
#echo $latest_release_api | ||
|
||
# Extract a download URL from the release information | ||
|
||
url_download=$(echo $latest_release_api | sed -e 's/.*"browser_download_url": "\([^"]*\)".*/\1/') | ||
#url_download=$(echo $latest_release_api | sed -E 's/.*"browser_download_url": "?([^,"]*)"?.*/\1/') # works too | ||
#echo $url_download | ||
|
||
# Download a target tarball | ||
|
||
wget -nc $url_download | ||
|
||
# Command options | ||
|
||
# curl options: | ||
# -L: redirect to moved location | ||
# -s: silent | ||
|
||
# sed options: | ||
# -e: basic expression | ||
# s/regexp/replacement/[flags]: attempt to match the pattern space against 'regexp' | ||
# if the match found, then that portion is replaced with 'replacement' | ||
# \1: in 'replacement' it refers to a portion of the match which is contained | ||
# between the 'n'th and '\)' and its matching '\)' | ||
# [^"]: bracket subexpression that excludes '"' from list | ||
# \(regexp\): groups 'regexp' as a whole | ||
# \([^"]*\): all characters until first '"' | ||
|
||
# -E: extended regular expression | ||
|
||
# wget options: | ||
# -nc: prevent download an existing target file |