-
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
29b3757
commit 4717058
Showing
1 changed file
with
28 additions
and
4 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
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 |