mirror of
https://github.com/fort-nix/nix-bitcoin.git
synced 2024-09-11 15:05:40 +03:00
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)
This commit is contained in:
parent
6c2d1108a4
commit
76dc7b92e1
@ -87,6 +87,7 @@ read -rd '' src <<EOF || true
|
||||
};
|
||||
}
|
||||
EOF
|
||||
. "${BASH_SOURCE[0]%/*}"/../test/lib/extra-container-check-version.sh
|
||||
extra-container shell -E "$src" "${runCmd[@]}"
|
||||
|
||||
# The container is automatically deleted at exit
|
||||
|
13
test/lib/extra-container-check-version.sh
Normal file
13
test/lib/extra-container-check-version.sh
Normal file
@ -0,0 +1,13 @@
|
||||
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
|
@ -71,18 +71,6 @@ while [[ $# -gt 0 ]]; do
|
||||
esac
|
||||
done
|
||||
|
||||
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 "$scriptDir"/..#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
|
||||
. "${BASH_SOURCE[0]%/*}"/extra-container-check-version.sh
|
||||
|
||||
exec "$container"/bin/container "$containerCommand" "$@"
|
||||
|
Loading…
Reference in New Issue
Block a user