32 lines
1.2 KiB
Bash
32 lines
1.2 KiB
Bash
#!/bin/bash
|
|
set -e
|
|
|
|
# SSO plugin installer — runs before the original CryptPad entrypoint.
|
|
# Clones the cryptpad/sso plugin into the plugins volume if not already present
|
|
# or if the version has changed, then delegates to the real entrypoint.
|
|
|
|
PLUGIN_DIR="/cryptpad/lib/plugins/sso"
|
|
VERSION_FILE="${PLUGIN_DIR}/.version"
|
|
SSO_PLUGIN_VERSION="${SSO_PLUGIN_VERSION:-0.4.0}"
|
|
|
|
# Copy SSO config template into place (mounted as Docker config)
|
|
if [ -f /sso.js.tmpl ]; then
|
|
cp /sso.js.tmpl /cryptpad/config/sso.js
|
|
echo "[sso-entrypoint] Copied sso.js config into /cryptpad/config/sso.js"
|
|
fi
|
|
|
|
# Install/update the SSO plugin
|
|
if [ -f "${VERSION_FILE}" ] && [ "$(cat "${VERSION_FILE}")" = "${SSO_PLUGIN_VERSION}" ]; then
|
|
echo "[sso-entrypoint] SSO plugin ${SSO_PLUGIN_VERSION} already installed"
|
|
else
|
|
echo "[sso-entrypoint] Installing SSO plugin ${SSO_PLUGIN_VERSION} ..."
|
|
rm -rf "${PLUGIN_DIR}"
|
|
git clone --depth 1 --branch "${SSO_PLUGIN_VERSION}" \
|
|
https://github.com/cryptpad/sso.git "${PLUGIN_DIR}"
|
|
echo "${SSO_PLUGIN_VERSION}" > "${VERSION_FILE}"
|
|
echo "[sso-entrypoint] SSO plugin installed"
|
|
fi
|
|
|
|
# Hand off to the original CryptPad entrypoint
|
|
exec /bin/bash /cryptpad/docker-entrypoint.sh "$@"
|