#!/bin/sh # Vellum container entrypoint. # # Honours PUID/PGID the same way the rest of this stack does: when started as # root, take ownership of the data and cache directories and drop privileges to # the requested user. This is what lets a bind-mounted host directory owned by # an arbitrary UID work without the operator matching IDs by hand. # # If already running as non-root (rootless podman with --userns=keep-id), skip # all of it and just exec the binary. set -eu PUID="${PUID:-1001}" PGID="${PGID:-1001}" if [ "$(id -u)" != "0" ]; then exec /usr/local/bin/vellum "$@" fi # Non-recursive: the application creates its own files, and recursively # chowning a large thumbnail/page cache on every boot would be needlessly slow. for dir in /data /config; do mkdir -p "$dir" chown "$PUID:$PGID" "$dir" 2>/dev/null || true done exec su-exec "$PUID:$PGID" /usr/local/bin/vellum "$@"