Skip to content

Instantly share code, notes, and snippets.

@cofob
Created July 11, 2024 13:01
Show Gist options
  • Save cofob/675a0b998743fe206ec00d92be593bf2 to your computer and use it in GitHub Desktop.
Save cofob/675a0b998743fe206ec00d92be593bf2 to your computer and use it in GitHub Desktop.
Easy install ffsend script
#!/usr/bin/env bash
# Version
VERSION="v0.2.76"
# URL to download
URL="https://github.com/timvisee/ffsend/releases/download/${VERSION}/ffsend-${VERSION}-linux-x64-static"
# Destination path
DEST="/usr/local/bin/ffsend"
# Check if the script is run as root
if [ "$(id -u)" -ne 0 ]; then
echo "This script must be run as root" >&2
exit 1
fi
# Check if ffsend is already installed
if command -v ffsend &> /dev/null; then
echo "ffsend is already installed" >&2
exit 1
fi
# Download the file to a temporary location
TMP_FILE=$(mktemp)
if command -v wget &> /dev/null; then
wget -O "$TMP_FILE" "$URL"
elif command -v curl &> /dev/null; then
curl -L -o "$TMP_FILE" "$URL"
else
echo "Neither wget nor curl is installed" >&2
exit 1
fi
# Move the file to the destination
mv "$TMP_FILE" "$DEST"
# Make the file executable
chmod +x "$DEST"
echo "ffsend installed successfully to $DEST"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment