nix-bitcoin/test/lib/extra-container-check-version.sh
Erik Arvstedt 76dc7b92e1
examples/deploy-container.sh: add extra-container version check
It now uses the same version check as
make-container.sh (which is called by run-tests.sh)
2023-07-19 17:22:01 +02:00

14 lines
718 B
Bash

containerBin=$(type -P extra-container) || true
if [[ ! ($containerBin && $(realpath "$containerBin") == *extra-container-0.12*) ]]; then
echo
echo "Building extra-container. Skip this step by adding extra-container 0.12 to PATH."
nix build --out-link /tmp/extra-container "${BASH_SOURCE[0]%/*}"/../..#extra-container
# When this script is run as root, e.g. when run in an extra-container shell,
# chown the gcroot symlink to the regular (login) user so that the symlink can be
# overwritten when this script is run without root.
if [[ $EUID == 0 ]]; then
chown "$(logname):" --no-dereference /tmp/extra-container
fi
export PATH="/tmp/extra-container/bin${PATH:+:}$PATH"
fi