-
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.
## [1.0.10](v1.0.9...v1.0.10) (2021-10-26) ### Bug Fixes * Template-ify CLI_VERSION in Makefile ([9dd3521](9dd3521))
- Loading branch information
1 parent
9dd3521
commit 66e44a1
Showing
2 changed files
with
79 additions
and
0 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
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,72 @@ | ||
#!/bin/bash | ||
{ | ||
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 | ||
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 | ||
ARCH="\$(uname -m)" | ||
if [ "\$ARCH" == "x86_64" ]; then | ||
ARCH=amd64 | ||
elif [[ "\$ARCH" == aarch* ]]; then | ||
ARCH=arm | ||
else | ||
echoerr "unsupported arch: \$ARCH" | ||
exit 1 | ||
fi | ||
mkdir -p /usr/local/lib | ||
cd /usr/local/lib | ||
rm -rf cloudstate | ||
rm -rf ~/.local/share/cloudstate/client | ||
mkdir -p cloudstate/bin | ||
cd cloudstate/bin | ||
URL="https://github.com/usecloudstate/cli/releases/download/v1.0.10/cloudstate-cli-\$OS-\$ARCH" | ||
echo "Installing CLI from \$URL" | ||
if [ \$(command -v curl) ]; then | ||
curl -L "\$URL" --output cli | ||
else | ||
wget -O- "\$URL" > cli | ||
fi | ||
# delete old cloudstate bin if exists | ||
rm -f \$(command -v cloudstate) || true | ||
rm -f /usr/local/bin/cloudstate | ||
ln -s /usr/local/lib/cloudstate/bin/cli /usr/local/bin/cloudstate | ||
chmod +x /usr/local/lib/cloudstate/bin/cli | ||
SCRIPT | ||
# test the CLI | ||
LOCATION=$(command -v cloudstate) | ||
echo "cloudstate installed to $LOCATION" | ||
} |