17 lines
475 B
Bash
17 lines
475 B
Bash
#!/bin/sh
|
|
set -e
|
|
|
|
# If running as root, fix ownership of /data, then drop privileges
|
|
if [ "$(id -u)" = "0" ]; then
|
|
mkdir -p /data
|
|
chown -R appuser:appgroup /data || echo "Warn: could not chown /data"
|
|
# Copy example config only if missing target
|
|
if [ ! -f /app/config.yaml ] && [ -f /app/config.example.yaml ]; then
|
|
cp /app/config.example.yaml /app/config.yaml
|
|
chown appuser:appgroup /app/config.yaml || true
|
|
fi
|
|
exec su-exec appuser "$@"
|
|
else
|
|
exec "$@"
|
|
fi
|