diff --git a/install.sh b/install.sh old mode 100644 new mode 100755 index a44d876..9f93c73 --- a/install.sh +++ b/install.sh @@ -33,7 +33,7 @@ ARCH="\$(uname -m)" if [ "\$ARCH" == "x86_64" ]; then - ARCH=x64 + ARCH=amd64 elif [[ "\$ARCH" == aarch* ]]; then ARCH=arm else @@ -45,27 +45,25 @@ cd /usr/local/lib rm -rf cloudstate rm -rf ~/.local/share/cloudstate/client - if [ \$(command -v xz) ]; then - URL=https://cli-assets.cloudstate.com/cloudstate-\$OS-\$ARCH.tar.xz - TAR_ARGS="xJ" - else - URL=https://cli-assets.cloudstate.com/cloudstate-\$OS-\$ARCH.tar.gz - TAR_ARGS="xz" - fi + + mkdir -p cloudstate/bin + cd cloudstate/bin + + URL="https://github.com/usecloudstate/cli/releases/download/v1.0.1/cloudstate-cli-\$OS-\$ARCH" + echo "Installing CLI from \$URL" - if [ \$(command -v curl) ]; then - curl "\$URL" | tar "\$TAR_ARGS" + if [ \$(command -v curlf) ]; then + curl -L "\$URL" --output cli else - wget -O- "\$URL" | tar "\$TAR_ARGS" + 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/cloudstate /usr/local/bin/cloudstate + ln -s /usr/local/lib/cloudstate/bin/cli /usr/local/bin/cloudstate - # on alpine (and maybe others) the basic node binary does not work - # remove our node binary and fall back to whatever node is on the PATH - /usr/local/lib/cloudstate/bin/node -v || rm /usr/local/lib/cloudstate/bin/node + chmod +x /usr/local/lib/cloudstate/bin/cli SCRIPT # test the CLI diff --git a/main.go b/main.go index 49a8503..2787eec 100644 --- a/main.go +++ b/main.go @@ -3,8 +3,6 @@ package main import ( "log" "os" - "os/signal" - "syscall" "github.com/usecloudstate/cli/pkg/apps" "github.com/usecloudstate/cli/pkg/client" @@ -80,18 +78,10 @@ func next(s State, ctx StateMachineCtx) { } func main() { - signalChannel := make(chan os.Signal, 2) - signal.Notify(signalChannel, os.Interrupt, syscall.SIGTERM) - - go func() { - sig := <-signalChannel - switch sig { - case os.Interrupt: - case syscall.SIGTERM: - log.Println("Exiting...") - os.Exit(1) - } - }() + log.Println("=================================================================") + log.Println("🚀 Starting Cloudstate CLI") + log.Println("Please report any issues at: https://github.com/usecloudstate/cli") + log.Println("=================================================================") ctx := StateMachineCtx{} next(SInit, ctx)