Files
radicle-explorer/scripts/install-binaries
T
Shawn Webb e0c75d4204 Fix shebang lines for a few scripts
On the BSDs, bash is typically installed in /usr/local/bin.

Signed-off-by:	Shawn Webb <shawn.webb@hardenedbsd.org>
2024-05-08 20:34:47 +00:00

55 lines
1.7 KiB
Bash
Executable File

#!/usr/bin/env bash
set -e
REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || echo "$PWD")
RELEASE=$(cat "$REPO_ROOT/tests/support/heartwood-release")
BINARY_PATH=$REPO_ROOT/tests/tmp/bin/$RELEASE
OS=$(uname)
show_usage() {
echo
echo "Installs binaries required for running e2e test suite."
echo
echo "USAGE:"
echo " install-binaries [-s|h]"
echo
echo "OPTIONS:"
echo " -s --show-path Print the binary path, and skip installation."
echo " -h --help Print this Help."
echo
}
while [ $# -ne 0 ]; do
case "$1" in
--show-path | -s)
echo "$BINARY_PATH"
exit
;;
--help | -h)
show_usage
exit
;;
esac
done
if test -d "$BINARY_PATH"; then
echo ✅ "Folder $BINARY_PATH exists already skipping download."
else
mkdir -p "$BINARY_PATH"
case "$OS" in
Darwin)
echo Downloading "$RELEASE" from "https://files.radicle.xyz/releases/$RELEASE/radicle-aarch64-apple-darwin.tar.xz"
curl --fail -s "https://files.radicle.xyz/releases/$RELEASE/radicle-aarch64-apple-darwin.tar.xz" | tar -xJ --strip-components=2 -C "$BINARY_PATH" "radicle-$RELEASE-aarch64-apple-darwin/bin/" || (echo "Download failed" && exit 1)
;;
Linux)
echo Downloading "$RELEASE" from "https://files.radicle.xyz/releases/$RELEASE/radicle-x86_64-unknown-linux-musl.tar.xz"
curl --fail -s "https://files.radicle.xyz/releases/$RELEASE/radicle-x86_64-unknown-linux-musl.tar.xz" | tar -xJ --strip-components=2 -C "$BINARY_PATH" "radicle-$RELEASE-x86_64-unknown-linux-musl/bin/" || (echo "Download failed" && exit 1)
;;
*)
echo "There are no precompiled binaries for your OS: $OS, compile $RELEASE manually and make sure it's in PATH." && exit 1
;;
esac
fi
echo