Skip to content
Snippets Groups Projects
Commit 6659e188 authored by Bartek Wrona's avatar Bartek Wrona
Browse files

Docker entrypoint and startup script support clive user ID switching (to match host user)

parent 9d31fb4c
No related branches found
No related tags found
2 merge requests!455V1.27.5.15 release,!442issue #251 - defined script to launch clive-TUI.
#! /bin/bash
#!/bin/bash
set -euo pipefail
SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
if [[ "$EUID" -eq 0 ]]; then
if [[ -z "${CLIVE_UID:-}" ]]; then
echo "Warning: variable CLIVE_UID is not set or set to an empty value." >&2
elif ! [[ "${CLIVE_UID}" =~ ^[0-9]+$ ]] ; then
echo "Error: variable CLIVE_UID is set to '${CLIVE_UID}' and not an integer. Exiting..." >&2
exit 1
elif [[ "${CLIVE_UID}" -ne 0 ]];
then
if [[ "${CLIVE_UID}" -ne $(id -u clive) ]];
then
echo "Setting user clive's UID to value '${CLIVE_UID}'"
usermod -o -u "${CLIVE_UID}" clive
fi
echo "Respawning entrypoint as user clive"
sudo -HEnu clive /bin/bash "${SCRIPTPATH}/entrypoint.sh" "$@"
exit 0
fi
fi
TESTNET_NODE_LOG_FILE=testnet_node.log
print_help() {
......@@ -57,6 +79,9 @@ while [ $# -gt 0 ]; do
shift
done
cd /clive
source "${PYTHON_VENV_PATH}/bin/activate"
if [ "${TESTNET_MODE}" = "0" ]; then
if [ "${INTERACTIVE_CLI_MODE}" = "0" ]; then
echo "Launching clive in TUI mode on mainnet"
......
......@@ -109,4 +109,4 @@ then
add_docker_arg "${CLIVE_DATA_LOCATION_DIR}:${CLIVE_DATA_LOCATION_DIR}"
fi
docker run --detach-keys='ctrl-@,ctrl-q' --rm -it -e HIVED_UID="$(id -u)" --stop-timeout=180 "${DOCKER_ARGS[@]}" "${IMAGE_NAME}" "${CMD_ARGS[@]}"
docker run --detach-keys='ctrl-@,ctrl-q' --rm -it -e CLIVE_UID="$(id -u)" --stop-timeout=180 "${DOCKER_ARGS[@]}" "${IMAGE_NAME}" "${CMD_ARGS[@]}"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment