From 9b51e26a6b57a7d50abe40a2378d7260a2192b9a Mon Sep 17 00:00:00 2001 From: Brandon Maier Date: Tue, 16 Apr 2024 15:00:49 +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..0fae19c --- /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-support + +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 Support to $BATS_LIBDIR"