diff --git a/audit/build b/audit/build index 4d653dc..acae24e 100755 --- a/audit/build +++ b/audit/build @@ -1,7 +1,6 @@ #!/usr/bin/env bash set -euo pipefail -export ACME="$HOME/gh/acme/ACME_Lib" -ACME_BIN="$HOME/gh/acme/acme" +ACME_BIN="$(git rev-parse --show-toplevel)/bin/acme" if [[ "${SKIP-}" == "" ]] then diff --git a/bin/.acme-0.97.pkg b/bin/.acme-0.97.pkg new file mode 120000 index 0000000..383f451 --- /dev/null +++ b/bin/.acme-0.97.pkg @@ -0,0 +1 @@ +hermit \ No newline at end of file diff --git a/bin/README.hermit.md b/bin/README.hermit.md new file mode 100644 index 0000000..e889550 --- /dev/null +++ b/bin/README.hermit.md @@ -0,0 +1,7 @@ +# Hermit environment + +This is a [Hermit](https://github.com/cashapp/hermit) bin directory. + +The symlinks in this directory are managed by Hermit and will automatically +download and install Hermit itself as well as packages. These packages are +local to this environment. diff --git a/bin/acme b/bin/acme new file mode 120000 index 0000000..d5a7c8a --- /dev/null +++ b/bin/acme @@ -0,0 +1 @@ +.acme-0.97.pkg \ No newline at end of file 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 diff --git a/bin/hermit b/bin/hermit new file mode 100755 index 0000000..d13a24d --- /dev/null +++ b/bin/hermit @@ -0,0 +1,26 @@ +#!/bin/bash + +set -eo pipefail + +if [ -z "${HERMIT_STATE_DIR}" ]; then + case "$(uname -s)" in + Darwin) + export HERMIT_STATE_DIR="${HOME}/Library/Caches/hermit" + ;; + Linux) + export HERMIT_STATE_DIR="${XDG_CACHE_HOME:-${HOME}/.cache}/hermit" + ;; + esac +fi + +export HERMIT_DIST_URL="${HERMIT_DIST_URL:-https://github.com/cashapp/hermit/releases/download/stable}" +HERMIT_CHANNEL="$(basename "${HERMIT_DIST_URL}")" +export HERMIT_CHANNEL +export HERMIT_EXE=${HERMIT_EXE:-${HERMIT_STATE_DIR}/pkg/hermit@${HERMIT_CHANNEL}/hermit} + +if [ ! -x "${HERMIT_EXE}" ]; then + echo "Bootstrapping ${HERMIT_EXE} from ${HERMIT_DIST_URL}" 1>&2 + curl -fsSL "${HERMIT_DIST_URL}/install.sh" | /bin/bash 1>&2 +fi + +exec "${HERMIT_EXE}" --level=fatal exec "$0" -- "$@" diff --git a/bin/hermit.hcl b/bin/hermit.hcl new file mode 100644 index 0000000..0fa7f99 --- /dev/null +++ b/bin/hermit.hcl @@ -0,0 +1 @@ +sources = ["https://github.com/zellyn/retrocomputing-hermit-packages.git", "https://github.com/cashapp/hermit-packages.git"] \ No newline at end of file