#!/bin/sh set -e -x export PATH="/usr/bin:$PATH" export PYTHONPATH="/srv/wiki-common/config" # Allow users to specify the UID/GID in the environment but # default these to the existing owner of the files in their # mounted config, which should be sane. DATA_DIR="/srv/wiki/data" if [[ -d "$DATA_DIR" ]]; then WIKIUID=${WIKIUID:-$(stat -c "%u" $DATA_DIR)} WIKIGID=${WIKIGID:-$(stat -c "%u" $DATA_DIR)} addgroup -g ${WIKIGID} -S wiki adduser -u ${WIKIUID} -S -H -D -G wiki wiki else echo "No data directory found" # This may be a debug session if a shell was requested otherwise it's a # hard failure if [[ "$1" != "/bin/sh" ]]; then exit 1 fi fi if [[ "$1" == "/bin/sh" ]]; then exec "$@" fi if [[ ! -d "/srv/wiki/data/cache/xapian/index" ]]; then /sbin/su-exec wiki:wiki \ moin --config-dir /srv/wiki/config index build --mode=rebuild fi exec "$@"