aboutsummaryrefslogtreecommitdiffstats
path: root/bin/activate-hermit
diff options
context:
space:
mode:
authorAlec Thomas <alec@swapoff.org>2021-12-02 21:45:18 +1100
committerAlec Thomas <alec@swapoff.org>2021-12-02 21:54:09 +1100
commit3989cf4cf81da1077a501a1d53e6114f55b812f9 (patch)
tree039b9df9ec583b485ae4edf656d9f5fa4384dad1 /bin/activate-hermit
parente3e64afb7bdf650e751ec2f08ae2afd48a7a1c7d (diff)
Hermitise and upgrade Catch.HEADmaster
Diffstat (limited to 'bin/activate-hermit')
-rwxr-xr-xbin/activate-hermit19
1 files changed, 19 insertions, 0 deletions
diff --git a/bin/activate-hermit b/bin/activate-hermit
new file mode 100755
index 0000000..3b191fb
--- /dev/null
+++ b/bin/activate-hermit
@@ -0,0 +1,19 @@
+#!/bin/bash
+# This file must be used with "source bin/activate-hermit" from bash or zsh.
+# You cannot run it directly
+
+if [ "${BASH_SOURCE-}" = "$0" ]; then
+ echo "You must source this script: \$ source $0" >&2
+ exit 33
+fi
+
+BIN_DIR="$(dirname "${BASH_SOURCE[0]:-${(%):-%x}}")"
+if "${BIN_DIR}/hermit" noop > /dev/null; then
+ eval "$("${BIN_DIR}/hermit" activate "${BIN_DIR}/..")"
+
+ if [ -n "${BASH-}" ] || [ -n "${ZSH_VERSION-}" ]; then
+ hash -r 2>/dev/null
+ fi
+
+ echo "Hermit environment $("${HERMIT_ENV}"/bin/hermit env HERMIT_ENV) activated"
+fi