#!/bin/sh # Clean and install Nextcloud OCS nodes into /data at runtime. # /data is a Docker volume that masks build-time COPY. set -eu echo "[entrypoint] Installing nextcloud nodes into /data..." SRC="/opt/nextcloud-nodes/node-red-contrib-nextcloud-ocs" DST_DIR="/data/node_modules" DST="$DST_DIR/node-red-contrib-nextcloud-ocs" echo "[entrypoint] Source: $SRC" echo "[entrypoint] Target: $DST" if [ ! -d "$SRC" ]; then echo "[entrypoint] ERROR: source directory missing: $SRC" >&2 ls -la /opt || true ls -la /opt/nextcloud-nodes || true exit 1 fi mkdir -p "$DST_DIR" rm -rf "$DST" cp -a "$SRC" "$DST_DIR/" if [ ! -f "$DST/package.json" ]; then echo "[entrypoint] ERROR: install did not produce $DST/package.json" >&2 echo "[entrypoint] Debug: listing /data and /data/node_modules" >&2 ls -la /data || true ls -la "$DST_DIR" || true exit 1 fi # Ensure Node-RED can read editor files and load nodes as the non-root user. chown -R node-red:node-red /data "$DST_DIR" "$DST" || true chmod -R a+rX "$DST" || true export NODE_RED_USER_DIR=/data # Start Node-RED explicitly with /data as userDir so it discovers # nodes from /data/node_modules/** based on each module's package.json. exec node-red --userDir /data