Skip to content

Commit

Permalink
fix: install script
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielMabbett authored Feb 5, 2024
1 parent 29b3757 commit 4717058
Showing 1 changed file with 28 additions and 4 deletions.
32 changes: 28 additions & 4 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,35 @@
#!/usr/bin/env bash

# Script to download terrabot for Linux

VERSION="v0.3.2"
FILE_NAME="terrabot-${VERSION}-linux-amd64"
DOWNLOAD_URL="https://github.com/DanielMabbett/terrabot/releases/download/${VERSION}/${FILE_NAME}"

# Function to download file using wget or curl
download_file() {
if command -v wget > /dev/null; then
wget "$1" -O "$2"
elif command -v curl > /dev/null; then
curl -L "$1" -o "$2"
else
echo "[Error] Neither wget nor curl is installed. Please install one and retry."
exit 1
fi
}

# Main installation process
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
wget "https://github.com/DanielMabbett/terrabot/releases/download/${VERSION}/terrabot-${VERSION}-linux-amd64.tar.gz"
tar -xzf terrabot-${VERSION}-linux-amd64.tar.gz
rm terrabot-${VERSION}-linux-amd64.tar.gz
echo "[Information] Starting download of terrabot ${VERSION} for Linux..."
download_file "${DOWNLOAD_URL}" "${FILE_NAME}"

if [ -f "${FILE_NAME}" ]; then
chmod +x "${FILE_NAME}"
echo "[Success] Downloaded and prepared ${FILE_NAME}."
echo "Run './${FILE_NAME}' to start using terrabot."
else
echo "[Error] Failed to download ${FILE_NAME}. Please check your internet connection and try again."
fi
else
echo "[Information] Operating System $OSTYPE not supported."
echo "[Error] Operating System $OSTYPE not supported. terrabot only supports Linux."
fi

0 comments on commit 4717058

Please sign in to comment.