mirror of
https://github.com/zokradonh/kopano-docker
synced 2025-06-07 07:56:12 +00:00
Print a proper (error) message when container is read-only, but packages should be installed (#321)
* print an error message instead of failing to start if container is read-only
This commit is contained in:
parent
3367b539b7
commit
b72359d000
@ -27,6 +27,7 @@ fi
|
||||
# Hint: this is not compatible with a read-only container.
|
||||
# The general recommendation is to already build a container that has all required packages installed.
|
||||
ADDITIONAL_KOPANO_PACKAGES=$(echo "$ADDITIONAL_KOPANO_PACKAGES" | tr -d '"')
|
||||
if [ -n "$(mkdir -p "/var/lib/apt/lists/" 2&> /dev/null)" ]; then
|
||||
[ -n "${ADDITIONAL_KOPANO_PACKAGES// }" ] && apt update
|
||||
[ -n "${ADDITIONAL_KOPANO_PACKAGES// }" ] && for installpkg in $ADDITIONAL_KOPANO_PACKAGES; do
|
||||
# shellcheck disable=SC2016 disable=SC2086
|
||||
@ -36,6 +37,12 @@ ADDITIONAL_KOPANO_PACKAGES=$(echo "$ADDITIONAL_KOPANO_PACKAGES" | tr -d '"')
|
||||
echo "INFO: $installpkg is already installed"
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo "Notice: Container is run read-only, skipping package installation."
|
||||
echo "If you want to have additional packages installed in the container either:"
|
||||
echo "- build your own image with the packages already included"
|
||||
echo "- switch the container to 'read_only: false'"
|
||||
fi
|
||||
|
||||
mkdir -p /tmp/"$SERVICE_TO_START" /var/run/kopano
|
||||
|
||||
|
@ -133,9 +133,6 @@ INSECURE=$INSECURE
|
||||
docker_repo=kopano
|
||||
COMPOSE_PROJECT_NAME=kopano
|
||||
|
||||
# Additional packages to install
|
||||
ADDITIONAL_KOPANO_PACKAGES=python3-grapi.backend.ldap
|
||||
|
||||
EOF
|
||||
else
|
||||
echo ".env already exists with initial configuration"
|
||||
|
@ -8,8 +8,10 @@ ADDITIONAL_KOPANO_PACKAGES=${ADDITIONAL_KOPANO_PACKAGES:-""}
|
||||
set -eu # unset variables are errors & non-zero return values exit the whole script
|
||||
[ "$DEBUG" ] && set -x
|
||||
|
||||
# TODO this is not compatible with a read-only container
|
||||
# Hint: this is not compatible with a read-only container.
|
||||
# The general recommendation is to already build a container that has all required packages installed.
|
||||
ADDITIONAL_KOPANO_PACKAGES=$(echo "$ADDITIONAL_KOPANO_PACKAGES" | tr -d '"')
|
||||
if [ -n "$(mkdir -p "/var/lib/apt/lists/" 2&> /dev/null)" ]; then
|
||||
[ -n "${ADDITIONAL_KOPANO_PACKAGES// }" ] && apt update
|
||||
[ -n "${ADDITIONAL_KOPANO_PACKAGES// }" ] && for installpkg in $ADDITIONAL_KOPANO_PACKAGES; do
|
||||
# shellcheck disable=SC2016 disable=SC2086
|
||||
@ -17,6 +19,12 @@ ADDITIONAL_KOPANO_PACKAGES=$(echo "$ADDITIONAL_KOPANO_PACKAGES" | tr -d '"')
|
||||
apt --assume-yes --no-upgrade install "$installpkg"
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo "Notice: Container is run read-only, skipping package installation."
|
||||
echo "If you want to have additional packages installed in the container either:"
|
||||
echo "- build your own image with the packages already included"
|
||||
echo "- switch the container to 'read_only: false'"
|
||||
fi
|
||||
|
||||
echo "Ensure directories"
|
||||
mkdir -p /run/sessions
|
||||
|
@ -14,7 +14,6 @@ if [ ! -e /kopano/"$SERVICE_TO_START".py ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# TODO how to best move this to /tmp?
|
||||
echo "Configure service '$SERVICE_TO_START'" | ts
|
||||
/usr/bin/python3 /kopano/"$SERVICE_TO_START".py
|
||||
|
||||
@ -60,7 +59,6 @@ if [ "${GRID_WEBAPP:-yes}" = "yes" ]; then
|
||||
jq '.apps.enabled += ["kopano-webapp"]' $CONFIG_JSON | sponge $CONFIG_JSON
|
||||
fi
|
||||
|
||||
# todo do not replace here, but in a temp location
|
||||
sed s/\ *=\ */=/g /tmp/kopano/kwebd.cfg > /tmp/kweb-env
|
||||
# always disable tls
|
||||
export tls=no
|
||||
|
@ -16,6 +16,7 @@ source /kopano/start-helper.sh
|
||||
# The general recommendation is to already build a container that has all required packages installed.
|
||||
ADDITIONAL_KOPANO_PACKAGES="$ADDITIONAL_KOPANO_PACKAGES $ADDITIONAL_KOPANO_WEBAPP_PLUGINS"
|
||||
ADDITIONAL_KOPANO_PACKAGES=$(echo "$ADDITIONAL_KOPANO_PACKAGES" | tr -d '"')
|
||||
if [ -n "$(mkdir -p "/var/lib/apt/lists/" 2&> /dev/null)" ]; then
|
||||
[ -n "${ADDITIONAL_KOPANO_PACKAGES// }" ] && apt update
|
||||
[ -n "${ADDITIONAL_KOPANO_PACKAGES// }" ] && for installpkg in $ADDITIONAL_KOPANO_PACKAGES; do
|
||||
# shellcheck disable=SC2016 disable=SC2086
|
||||
@ -25,6 +26,12 @@ ADDITIONAL_KOPANO_PACKAGES=$(echo "$ADDITIONAL_KOPANO_PACKAGES" | tr -d '"')
|
||||
echo "INFO: $installpkg is already installed"
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo "Notice: Container is run read-only, skipping package installation."
|
||||
echo "If you want to have additional packages installed in the container either:"
|
||||
echo "- build your own image with the packages already included"
|
||||
echo "- switch the container to 'read_only: false'"
|
||||
fi
|
||||
|
||||
# copy latest config template
|
||||
mkdir -p /tmp/webapp/
|
||||
|
@ -42,6 +42,7 @@ php_cfg_gen() {
|
||||
# Hint: this is not compatible with a read-only container.
|
||||
# The general recommendation is to already build a container that has all required packages installed.
|
||||
ADDITIONAL_KOPANO_PACKAGES=$(echo "$ADDITIONAL_KOPANO_PACKAGES" | tr -d '"')
|
||||
if [ -n "$(mkdir -p "/var/lib/apt/lists/" 2&> /dev/null)" ]; then
|
||||
[ -n "${ADDITIONAL_KOPANO_PACKAGES// }" ] && apt update
|
||||
[ -n "${ADDITIONAL_KOPANO_PACKAGES// }" ] && for installpkg in $ADDITIONAL_KOPANO_PACKAGES; do
|
||||
# shellcheck disable=SC2016 disable=SC2086
|
||||
@ -51,6 +52,12 @@ ADDITIONAL_KOPANO_PACKAGES=$(echo "$ADDITIONAL_KOPANO_PACKAGES" | tr -d '"')
|
||||
echo "INFO: $installpkg is already installed"
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo "Notice: Container is run read-only, skipping package installation."
|
||||
echo "If you want to have additional packages installed in the container either:"
|
||||
echo "- build your own image with the packages already included"
|
||||
echo "- switch the container to 'read_only: false'"
|
||||
fi
|
||||
|
||||
# copy latest config template
|
||||
mkdir -p /tmp/z-push/
|
||||
|
Loading…
x
Reference in New Issue
Block a user