#!/usr/bin/env bash set -euo pipefail if [ ! -z ${GITHUB_ACTIONS-} ]; then set -x fi help() { cat <<'EOF' Install a binary release of ord hosted on GitHub USAGE: install.sh [options] FLAGS: -h, --help Display this message -f, --force Force overwriting an existing binary OPTIONS: --tag TAG Tag (version) of the crate to install, defaults to latest release --to LOCATION Where to install the binary [default: ~/bin] --target TARGET EOF } crate=ord url=https://github.com/ordinals/ord releases=$url/releases say() { echo "install.sh: $*" >&2 } err() { if [ ! -z ${tempdir-} ]; then rm -rf $tempdir fi say "error: $*" exit 1 } need() { if ! command -v $1 > /dev/null 2>&1; then err "need $1 (command not found)" fi } force=false while test $# -gt 0; do case $1 in --force | -f) force=true ;; --help | -h) help exit 0 ;; --tag) tag=$2 shift ;; --target) target=$2 shift ;;