2015-12-06 11:02:17 +02:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
|
2017-08-06 04:34:48 +02:00
|
|
|
# allow the container to be started with `--user`
|
|
|
|
if [[ "$*" == node*current/index.js* ]] && [ "$(id -u)" = '0' ]; then
|
|
|
|
chown -R node "$GHOST_CONTENT"
|
|
|
|
exec su-exec node "$BASH_SOURCE" "$@"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "$*" == node*current/index.js* ]]; then
|
|
|
|
baseDir="$GHOST_INSTALL/content.orig"
|
|
|
|
for src in "$baseDir"/*/ "$baseDir"/themes/*; do
|
|
|
|
src="${src%/}"
|
|
|
|
target="$GHOST_CONTENT/${src#$baseDir/}"
|
|
|
|
mkdir -p "$(dirname "$target")"
|
|
|
|
if [ ! -e "$target" ]; then
|
|
|
|
tar -cC "$(dirname "$src")" "$(basename "$src")" | tar -xC "$(dirname "$target")"
|
2015-12-06 11:02:17 +02:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2017-08-06 04:34:48 +02:00
|
|
|
knex-migrator-migrate --init --mgpath "$GHOST_INSTALL/current"
|
2015-12-06 11:02:17 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
exec "$@"
|