#!/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 echoerr() { echo "$@" 1>&2; } case $(uname -s) in Linux|linux) os=linux ;; Darwin|darwin) os=darwin ;; *) os= ;; esac if [ -z "$os" ]; then echoerr "OS $(uname -s) not supported." exit 1 fi case $(uname -m) in amd64|x86_64) arch=amd64 ;; arm64|aarch64) arch=arm64 ;; *) arch= ;; esac if [ -z "$arch" ]; then echoerr "Architecture $(uname -m) not supported." exit 1 fi 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 URL=https://cli.sehlat.io/bin/$os/$arch/devcloud echo "Downloading CLI from $URL to a temporary file..." TMPFILE=$(mktemp) if [ $(command -v curl) ]; then curl -o "$TMPFILE" "$URL" else wget -O "$TMPFILE" "$URL" fi echo "Installing devcloud to /usr/local/bin..." $SUDO install -m 755 "$TMPFILE" /usr/local/bin/devcloud rm -f "$TMPFILE" LOCATION=$($SUDO command -v devcloud) echo "devcloud installed to $LOCATION" devcloud --version }