From d6d6ef23af95dd6ec3ccc56b25f7eced013f3c40 Mon Sep 17 00:00:00 2001 From: Brandon Maier Date: Tue, 16 Apr 2024 15:00:13 +0000 Subject: [PATCH] add distro packaging installer Copy the arguments from the bats-core install.sh so that bats libraries can be packaged in the same manner as bats-core. --- install.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 install.sh diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..1d4d96b --- /dev/null +++ b/install.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +set -e + +BATS_ROOT="${0%/*}" +PREFIX="${1%/}" +LIBDIR="${2:-lib}" + +if [[ -z "$PREFIX" ]]; then + printf '%s\n' \ + "usage: $0 [base_libdir]" \ + " e.g. $0 /usr/local" \ + " $0 /usr/local lib64" >&2 + exit 1 +fi + +BATS_LIBDIR=$PREFIX/$LIBDIR/bats/bats-assert + +install -d -m 755 "$BATS_LIBDIR/src" +install -m 755 "$BATS_ROOT/load.bash" "$BATS_LIBDIR" +install -m 755 "$BATS_ROOT/src/"* "$BATS_LIBDIR/src" + +echo "Installed Bats Assert to $BATS_LIBDIR"