-
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.
- Loading branch information
1 parent
e477b2f
commit 414f909
Showing
1 changed file
with
63 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,65 @@ | ||
#!/bin/sh | ||
|
||
echo 'hello world' | ||
# Prompt for sudo | ||
# Download the binary from github to /usr/local/bin | ||
|
||
{ | ||
set -e | ||
SUDO='' | ||
if [ "$(id -u)" != "0" ]; then | ||
SUDO='sudo' | ||
echo "This script requires superuser access." | ||
echo "You will be prompted for your password by sudo." | ||
# clear any previous sudo permission | ||
sudo -k | ||
fi | ||
|
||
# run inside sudo | ||
$SUDO bash <<SCRIPT | ||
set -e | ||
echoerr() { echo "\$@" 1>&2; } | ||
if [[ ! ":\$PATH:" == *":/usr/local/bin:"* ]]; then | ||
echoerr "Your path is missing /usr/local/bin, you need to add this to use this installer." | ||
exit 1 | ||
fi | ||
# Detect the OS | ||
if [ "\$(uname)" == "Darwin" ]; then | ||
OS=darwin | ||
elif [ "\$(expr substr \$(uname -s) 1 5)" == "Linux" ]; then | ||
OS=linux | ||
else | ||
echoerr "This installer is only supported on Linux and MacOS" | ||
exit 1 | ||
fi | ||
# Detect the architecture | ||
ARCH="\$(uname -m)" | ||
if [ "\$ARCH" == "x86_64" ]; then | ||
ARCH=amd64 | ||
elif [[ "\$ARCH" == arm* ]]; then | ||
ARCH=arm | ||
elif [[ "\$ARCH" == i386 ]]; then | ||
ARCH=386 | ||
elif [[ "\$ARCH" == amd64 ]]; then | ||
ARCH=amd64 | ||
else | ||
echoerr "Unsupported arch: \$ARCH" | ||
exit 1 | ||
fi | ||
VERSION=v0.0.1 | ||
URL=https://github.com/jayrbolton/kbase_sdk_cli/releases/download/\$VERSION/cli_\$OS_\$ARCH | ||
cd /usr/local/bin | ||
rm -rf kbase-sdk | ||
curl -L --output kbase-sdk "\$URL" | ||
chmod +x kbase-sdk | ||
SCRIPT | ||
|
||
# test the CLI | ||
LOCATION=$(command -v kbase-sdk) | ||
echo "KBase SDK CLI installed to $LOCATION" | ||
kbase-sdk version | ||
} |