39 lines
1.1 KiB
Bash
Executable file
39 lines
1.1 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
###############################################################################
|
|
#
|
|
# Installation script
|
|
#
|
|
# This pulls the latest version (or the tag specified by $SPUD_VERSION) from
|
|
# the source repository, unpacks it and installs it at $SPUD_ROOT (defaults to
|
|
# ~/.local/bin).
|
|
#
|
|
##############################################################################W
|
|
|
|
TMP_ROOT=$(mktemp -d)
|
|
DST_ROOT="${SPUD_ROOT:-$HOME/.local/bin}"
|
|
|
|
BIN_ARCH="x64"
|
|
BIN_VERSION="${SPUD_VERSION:-latest}"
|
|
|
|
ARCHIVE_NAME="$BIN_ARCH-build.zip"
|
|
|
|
echo "Downloading spud ($BIN_VERSION) and extracting to $DST_ROOT"
|
|
|
|
curl \
|
|
--output "$TMP_ROOT/$ARCHIVE_NAME" \
|
|
--fail \
|
|
"https://forge.karnov.club/spadinastan/spud/releases/download/$BIN_VERSION/$ARCHIVE_NAME"
|
|
|
|
if [[ ! -f "$TMP_ROOT/$ARCHIVE_NAME" ]]; then
|
|
echo "❌ Failed to download spud@$BIN_VERSION from repository."
|
|
exit 1;
|
|
|
|
fi
|
|
|
|
unzip "$TMP_ROOT/$ARCHIVE_NAME" -d "$TMP_ROOT"
|
|
|
|
cp "$TMP_ROOT/spud" "$DST_ROOT"
|
|
chmod +x "$DST_ROOT/spud"
|
|
|
|
echo "📦 Installed to $DST_ROOT, make sure that it is in your PATH."
|