Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

1.6 KB
Raw Blame
#!/bin/bash
# Runs linux-poc.mjs inside a disposable Debian container as uid 1000 with four
# extra tmpfs volumes: one owned by the user (-> $topdir/.Trash-1000), one with a
# root-planted symlink `.Trash-1000 -> /tmp/evil` (-> TRASH_DIR_UNSAFE refusal),
# one with a root-created sticky .Trash (-> $topdir/.Trash/1000), and one
# root-owned 755 topdir where no trash directory can be created (-> EACCES
# refusal). GLib's `gio trash` and trash-cli are installed as independent
# reference implementations. Usage: linux-docker-run.sh <this directory>
set -u
POC_DIR="$1"
# The repository layout is reproduced under /home/node/repo so the `xdgTrash.mjs`
# shim's relative re-export of server/lib/nativeTrashXdg.js resolves in the container.
REPO_ROOT="$(cd "$POC_DIR/../../../.." && pwd)"
docker run --rm \
  --tmpfs /mnt/vol:uid=1000,gid=1000,mode=755 \
  --tmpfs /mnt/vol2:uid=0,gid=0,mode=755 \
  --tmpfs /mnt/vol3:uid=0,gid=0,mode=755 \
  --tmpfs /mnt/vol4:uid=0,gid=0,mode=755 \
  -v "$POC_DIR:/poc:ro" \
  -v "$REPO_ROOT/server/lib:/home/node/repo/server/lib:ro" \
  node:22-bookworm bash -c '
set -e
export DEBIAN_FRONTEND=noninteractive
apt-get update -qq >/dev/null 2>&1
apt-get install -y -qq libglib2.0-bin trash-cli >/dev/null 2>&1
mkdir -m 777 /mnt/vol2/pub /mnt/vol3/pub /mnt/vol4/pub /tmp/evil
ln -s /tmp/evil /mnt/vol2/.Trash-1000
mkdir -m 1777 /mnt/vol3/.Trash
mkdir -p /home/node/repo/docs/research/assets
cp -r /poc /home/node/repo/docs/research/assets/native-trash-poc && chown -R node:node /home/node/repo/docs
su node -c "cd /home/node/repo/docs/research/assets/native-trash-poc && HOME=/home/node node linux-poc.mjs"
'