#!/bin/bash set -e if [[ "$*" == npm*start* ]]; then for dir in "$GHOST_SOURCE/content"/*/; do targetDir="$GHOST_CONTENT/$(basename "$dir")" mkdir -p "$targetDir" if [ -z "$(ls -A "$targetDir")" ]; then tar -c --one-file-system -C "$dir" . | tar xC "$targetDir" fi done if [ ! -e "$GHOST_CONTENT/config.js" ]; then sed -r ' s/127\.0\.0\.1/0.0.0.0/g; s!path.join\(__dirname, (.)/content!path.join(process.env.GHOST_CONTENT, \1!g; ' "$GHOST_SOURCE/config.example.js" > "$GHOST_CONTENT/config.js" fi ln -sf "$GHOST_CONTENT/config.js" "$GHOST_SOURCE/config.js" exec "$@" fi exec "$@"