#!/bin/sh
# atlas — EDON Atlas from the shell (atlas-cli). The appliance's Deno (edon-deno) runs it: --no-config, so a deno.json in
# the current directory changes nothing; no network but the console's Unix socket; the modules compiled by the postinst
# are in /var/cache/atlas-cli (root's: another account compiles them in its own cache, and cannot reach the socket anyway).
if [ -w /var/cache/atlas-cli ]; then
  DENO_DIR=/var/cache/atlas-cli
  export DENO_DIR
fi
# The one socket the command may reach (Deno asks for it as net access).
SOCKET="${ATLAS_CLI_SOCKET:-/run/atlas/cli.sock}"
exec /usr/bin/deno run --quiet --no-prompt --no-config "--allow-net=unix:$SOCKET" --allow-read --allow-write --allow-env /usr/lib/atlas-cli/src/main.ts "$@"
