build: add install script and instructions
This commit is contained in:
parent
6c18ac9e2f
commit
9c86fb64ee
2 changed files with 48 additions and 0 deletions
|
@ -13,3 +13,12 @@ Regardless of how you obtain your binary of choice, include it in your `$PATH` a
|
|||
### Pre-built binaries
|
||||
|
||||
The [releases](https://forge.karnov.club/spadinastan/spud/releases) page contains pre-built binaries that can be downloaded. These are built on tag-push.
|
||||
|
||||
The latest version can be installed via:
|
||||
|
||||
```
|
||||
curl https://forge.karnov.club/spadinastan/spud/raw/branch/main/install.sh | bash
|
||||
```
|
||||
|
||||
To pull a specific version, supply a `$SPUD_VERSION` that corresponds to an existing release tag, and to control where
|
||||
the binary is unpacked and installed, supply `$SPUD_ROOT`.
|
||||
|
|
39
install.sh
Executable file
39
install.sh
Executable file
|
@ -0,0 +1,39 @@
|
|||
#!/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."
|
Loading…
Reference in a new issue