mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-11-14 16:55:42 +00:00
Performance update for the docker entrypoint script
This commit is contained in:
parent
82cd384e5f
commit
78dd375ef8
@ -6,50 +6,88 @@ NO_COLOR="\033[0m"
|
|||||||
CHECK_MARK="\xE2\x9C\x93"
|
CHECK_MARK="\xE2\x9C\x93"
|
||||||
CROSS_MARK="\xE2\x9D\x8C"
|
CROSS_MARK="\xE2\x9D\x8C"
|
||||||
|
|
||||||
echo -n "Set container UID and GIDs to match the host system..."
|
|
||||||
|
|
||||||
if [[ "${NOPAQUE_UID}" == 0 ]]; then
|
if [[ "${NOPAQUE_UID}" == "0" ]]; then
|
||||||
echo -e "${RED_COLOR}${CROSS_MARK}${NO_COLOR}"
|
echo -e "${RED_COLOR}${CROSS_MARK}${NO_COLOR}"
|
||||||
echo "Running as root is not allowed"
|
echo "Running as root is not allowed"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
|
||||||
echo ""
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -n "- Updating docker GID ($(getent group docker | cut -d: -f3) -> ${DOCKER_GID})... "
|
|
||||||
groupmod --gid "${DOCKER_GID}" docker > /dev/null
|
echo "Set container UID and GIDs to match the host system..."
|
||||||
if [[ "${?}" == "0" ]]; then
|
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
# docker GID #
|
||||||
|
##############################################################################
|
||||||
|
if [[ "${DOCKER_GID}" == "$(getent group docker | cut -d: -f3)" ]]; then
|
||||||
|
echo -n "- docker GID is already matching..."
|
||||||
echo -e "${GREEN_COLOR}${CHECK_MARK}${NO_COLOR}"
|
echo -e "${GREEN_COLOR}${CHECK_MARK}${NO_COLOR}"
|
||||||
else
|
else
|
||||||
echo -e "${RED_COLOR}${CROSS_MARK}${NO_COLOR}"
|
echo -n "- Updating docker GID ($(getent group docker | cut -d: -f3) -> ${DOCKER_GID})... "
|
||||||
exit 1
|
groupmod --gid "${DOCKER_GID}" docker > /dev/null
|
||||||
|
if [[ "${?}" == "0" ]]; then
|
||||||
|
echo -e "${GREEN_COLOR}${CHECK_MARK}${NO_COLOR}"
|
||||||
|
else
|
||||||
|
echo -e "${RED_COLOR}${CROSS_MARK}${NO_COLOR}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -n "- Updating nopaque GID ($(id -g nopaque) -> ${NOPAQUE_GID})... "
|
|
||||||
groupmod --gid "${NOPAQUE_GID}" nopaque > /dev/null
|
##############################################################################
|
||||||
if [[ "${?}" == "0" ]]; then
|
# nopaque GID #
|
||||||
|
##############################################################################
|
||||||
|
if [[ "${NOPAQUE_GID}" == "$(id -g nopaque)" ]]; then
|
||||||
|
echo -n "- nopaque GID is already matching..."
|
||||||
echo -e "${GREEN_COLOR}${CHECK_MARK}${NO_COLOR}"
|
echo -e "${GREEN_COLOR}${CHECK_MARK}${NO_COLOR}"
|
||||||
else
|
else
|
||||||
echo -e "${RED_COLOR}${CROSS_MARK}${NO_COLOR}"
|
echo -n "- Updating nopaque GID ($(id -g nopaque) -> ${NOPAQUE_GID})... "
|
||||||
exit 1
|
groupmod --gid "${NOPAQUE_GID}" nopaque > /dev/null
|
||||||
|
if [[ "${?}" == "0" ]]; then
|
||||||
|
HAS_NOPAQUE_GID_CHANGED=true
|
||||||
|
echo -e "${GREEN_COLOR}${CHECK_MARK}${NO_COLOR}"
|
||||||
|
else
|
||||||
|
echo -e "${RED_COLOR}${CROSS_MARK}${NO_COLOR}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -n "- Updating nopaque directory group... "
|
||||||
|
chown -R :nopaque /home/nopaque
|
||||||
|
if [[ "${?}" == "0" ]]; then
|
||||||
|
echo -e "${GREEN_COLOR}${CHECK_MARK}${NO_COLOR}"
|
||||||
|
else
|
||||||
|
echo -e "${RED_COLOR}${CROSS_MARK}${NO_COLOR}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -n "- Updating nopaque UID ($(id -u nopaque) -> ${NOPAQUE_UID})... "
|
|
||||||
usermod --uid "${NOPAQUE_UID}" nopaque > /dev/null
|
##############################################################################
|
||||||
if [[ "${?}" == "0" ]]; then
|
# nopaque UID #
|
||||||
|
##############################################################################
|
||||||
|
if [[ "${NOPAQUE_UID}" == "$(id -u nopaque)" ]]; then
|
||||||
|
echo -n "- nopaque UID is already matching..."
|
||||||
echo -e "${GREEN_COLOR}${CHECK_MARK}${NO_COLOR}"
|
echo -e "${GREEN_COLOR}${CHECK_MARK}${NO_COLOR}"
|
||||||
else
|
else
|
||||||
echo -e "${RED_COLOR}${CROSS_MARK}${NO_COLOR}"
|
echo -n "- Updating nopaque UID ($(id -u nopaque) -> ${NOPAQUE_UID})... "
|
||||||
exit 1
|
usermod --uid "${NOPAQUE_UID}" nopaque > /dev/null
|
||||||
|
if [[ "${?}" == "0" ]]; then
|
||||||
|
echo -e "${GREEN_COLOR}${CHECK_MARK}${NO_COLOR}"
|
||||||
|
else
|
||||||
|
echo -e "${RED_COLOR}${CROSS_MARK}${NO_COLOR}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -n "- Updating nopaque directory owner... "
|
||||||
|
chown -R nopaque /home/nopaque
|
||||||
|
if [[ "${?}" == "0" ]]; then
|
||||||
|
echo -e "${GREEN_COLOR}${CHECK_MARK}${NO_COLOR}"
|
||||||
|
else
|
||||||
|
echo -e "${RED_COLOR}${CROSS_MARK}${NO_COLOR}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -n "- Updating nopaque directory owner and group... "
|
|
||||||
chown -R nopaque:nopaque /home/nopaque
|
|
||||||
if [[ "${?}" == "0" ]]; then
|
|
||||||
echo -e "${GREEN_COLOR}${CHECK_MARK}${NO_COLOR}"
|
|
||||||
else
|
|
||||||
echo -e "${RED_COLOR}${CROSS_MARK}${NO_COLOR}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
exec gosu nopaque ./boot.sh ${@}
|
exec gosu nopaque ./boot.sh ${@}
|
||||||
|
Loading…
Reference in New Issue
Block a user