-
Notifications
You must be signed in to change notification settings - Fork 527
Standalone update.sh #670
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
Merged
tsachiherman
merged 1 commit into
algorand:master
from
tsachiherman:tsachi/standaloneupdater
Feb 28, 2020
Merged
Standalone update.sh #670
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -138,8 +138,88 @@ function determine_current_version() { | |
| echo Current Version = ${CURRENTVER} | ||
| } | ||
|
|
||
| function get_updater_url() { | ||
| local UNAME | ||
| local OS | ||
| local ARCH | ||
| UNAME=$(uname) | ||
| if [[ "${UNAME}" = "Darwin" ]]; then | ||
| OS="darwin" | ||
| UNAME=$(uname -m) | ||
| if [[ "${UNAME}" = "x86_64" ]]; then | ||
| ARCH="amd64" | ||
| else | ||
| echo "This platform ${UNAME} is not supported by updater." | ||
| exit 1 | ||
| fi | ||
| elif [[ "${UNAME}" = "Linux" ]]; then | ||
| OS="linux" | ||
| UNAME=$(uname -m) | ||
| if [[ "${UNAME}" = "x86_64" ]]; then | ||
| ARCH="amd64" | ||
| elif [[ "${UNAME}" = "armv6l" ]]; then | ||
| ARCH="arm" | ||
| elif [[ "${UNAME}" = "armv7l" ]]; then | ||
| ARCH="arm" | ||
| elif [[ "${UNAME}" = "aarch64" ]]; then | ||
| ARCH="arm64" | ||
| else | ||
| echo "This platform ${UNAME} is not supported by updater." | ||
| exit 1 | ||
| fi | ||
| else | ||
| echo "This operation system ${UNAME} is not supported by updater." | ||
| exit 1 | ||
| fi | ||
| UPDATER_FILENAME="install_master_${OS}-${ARCH}.tar.gz" | ||
| UPDATER_URL="https://github.com/algorand/go-algorand-doc/raw/master/downloads/installers/${OS}_${ARCH}/${UPDATER_FILENAME}" | ||
| } | ||
|
|
||
| # check to see if the binary updater exists. if not, it will automatically the correct updater binary for the current platform | ||
| function check_for_updater() { | ||
| # check if the updater binary exist. | ||
| if [ -f "${SCRIPTPATH}/updater" ]; then | ||
| return 0 | ||
| fi | ||
| get_updater_url | ||
|
|
||
| # check the curl is available. | ||
| CURL_VER=$(curl -V 2>/dev/null || true) | ||
| if [ "${CURL_VER}" = "" ]; then | ||
| # no curl is installed. | ||
| echo "updater binary is missing and cannot be downloaded since curl is missing." | ||
| if [[ "$(uname)" = "Linux" ]]; then | ||
| echo "To install curl, run the following command:" | ||
| echo "apt-get update; apt-get install -y curl" | ||
| fi | ||
| exit 1 | ||
| fi | ||
|
|
||
| CURL_OUT=$(curl -LJO --silent ${UPDATER_URL}) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I confused.
|
||
| if [ "$?" != "0" ]; then | ||
| echo "failed to download updater binary from ${UPDATER_URL} using curl." | ||
| echo "${CURL_OUT}" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ ! -f "${SCRIPTPATH}/${UPDATER_FILENAME}" ]; then | ||
| echo "downloaded file ${SCRIPTPATH}/${UPDATER_FILENAME} is missing." | ||
| exit | ||
| fi | ||
|
|
||
| tar -zxvf "${SCRIPTPATH}/${UPDATER_FILENAME}" updater | ||
| if [ "$?" != "0" ]; then | ||
| echo "failed to extract updater binary from ${SCRIPTPATH}/${UPDATER_FILENAME}" | ||
| exit 1 | ||
| fi | ||
|
|
||
| rm -f "${SCRIPTPATH}/${UPDATER_FILENAME}" | ||
| echo "updater binary was downloaded" | ||
| } | ||
|
|
||
| function check_for_update() { | ||
| determine_current_version | ||
| check_for_updater | ||
| LATEST="$(${SCRIPTPATH}/updater ver check -c ${CHANNEL} ${BUCKET} | sed -n '2 p')" | ||
| if [ $? -ne 0 ]; then | ||
| echo "No remote updates found" | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Add a comment that the function sets UPDATER_FILENAME and UPDATER_URL