This repository has been archived by the owner on Jun 22, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #243 from ContainerSolutions/refactoring/installer…
…-enhancements Refactoring: installer enhancements
- Loading branch information
Showing
2 changed files
with
30 additions
and
28 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,42 @@ | ||
#!/bin/bash | ||
#!/bin/sh | ||
|
||
# This script is meant for quick & easy install via: | ||
# `sudo curl -sSL https://raw.githubusercontent.com/ContainerSolutions/minimesos/master/bin/install | bash` | ||
# | ||
# Uses the latest release, unless a version identifier is specified as a parameter of this script. | ||
|
||
command_exists() { | ||
command -v "$@" > /dev/null 2>&1 | ||
command -v "$@" > /dev/null 2>&1 | ||
} | ||
|
||
install_version() { | ||
echo "Using $1 to install minimesos $2" | ||
curl -sSL $1 | bash -s $2 | ||
curl -sSL $1 | sh -s $2 | ||
} | ||
|
||
if ! command_exists curl; then | ||
echo "Please install curl to fetch the minimesos files" | ||
exit 1 | ||
echo "Please install curl to fetch the minimesos files" | ||
exit 1 | ||
fi | ||
|
||
VERSION=$(echo $@ | xargs) | ||
|
||
if [ -z "$VERSION" ]; then | ||
MAVEN_METADATA=$(curl -s https://jitpack.io/com/github/ContainerSolutions/minimesos/maven-metadata.xml) | ||
VERSION=$(echo "$MAVEN_METADATA" | awk -F '[<>]' '/release/{print $3}') | ||
if [ ! "$VERSION" ]; then | ||
echo "Cannot determine latest release of minimesos" | ||
exit 1 | ||
fi | ||
MAVEN_METADATA=$(curl -s https://jitpack.io/com/github/ContainerSolutions/minimesos/maven-metadata.xml) | ||
VERSION=$(echo "$MAVEN_METADATA" | awk -F '[<>]' '/release/{print $3}') | ||
if [ ! "$VERSION" ]; then | ||
echo "Cannot determine latest release of minimesos" | ||
exit 1 | ||
fi | ||
fi | ||
|
||
curl -sSL -X HEAD https://jitpack.io/com/github/ContainerSolutions/minimesos/$VERSION/pom | ||
|
||
# invoking versioned installation script | ||
echo "Installing minimesos $VERSION" | ||
SCRIPT_PATH=https://raw.githubusercontent.com/ContainerSolutions/minimesos/$VERSION | ||
httpcode=$(curl -s -o /dev/null -I -w '%{http_code}' --max-time 1 $SCRIPT_PATH/bin/install-version || echo "404" ) | ||
if [ $httpcode -eq 200 ]; then | ||
install_version $SCRIPT_PATH/bin/install-version $VERSION | ||
install_version $SCRIPT_PATH/bin/install-version $VERSION | ||
else | ||
# initial version of minimesos used single install script | ||
install_version $SCRIPT_PATH/bin/install $VERSION | ||
echo "Failed to pull installer off github.com (http err: ${httpcode}), please try again." | ||
exit 1 | ||
fi | ||
|
||
echo "Done" | ||
|
||
exit 0 | ||
exit 0 |
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