#!/bin/sh set -e # Ensure the data directory exists and is writable by the app user on every # container start. Bind-mounted host directories (docker-compose ./data, # Unraid appdata, etc.) are often owned by root or "nobody", which would # otherwise make the unprivileged "node" user unable to create trxtd.db. mkdir -p /app/data # Prefer chown (sets node:node). On filesystems that do not support chown # (some network/9p mounts), fall back to making the directory world-writable. if ! chown -R node:node /app/data 2>/dev/null; then chmod 777 /app/data 2>/dev/null || true fi # Drop privileges to the unprivileged node user when su-exec is available, # otherwise run as root (still fully functional). if command -v su-exec >/dev/null 2>&1; then exec su-exec node "$@" fi exec "$@"