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:
@@ -87,6 +87,7 @@ read -rd '' src <<EOF || true
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
. "${BASH_SOURCE[0]%/*}"/../test/lib/extra-container-check-version.sh
|
||||||
extra-container shell -E "$src" "${runCmd[@]}"
|
extra-container shell -E "$src" "${runCmd[@]}"
|
||||||
|
|
||||||
# The container is automatically deleted at exit
|
# 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
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
containerBin=$(type -P extra-container) || true
|
. "${BASH_SOURCE[0]%/*}"/extra-container-check-version.sh
|
||||||
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
|
|
||||||
|
|
||||||
exec "$container"/bin/container "$containerCommand" "$@"
|
exec "$container"/bin/container "$containerCommand" "$@"
|
||||||
|
|||||||
Reference in New Issue
Block a user