Files
Frametop--frametop/scripts/in-box
T
DeeJanuzandClaude Opus 5.5 6dd9fb1ad8 One launch switch: scripts/in-box runs a program in the container it was built for
Every place an installed Frametop started a program with `distrobox enter dev --` now goes
through scripts/in-box: the pointer and power units, ft-gazed (ft-gaze, ft-eyes), the gaze
check's panel, the desktop's ft-screens, the remote desktop's krdp and VNC, and the three
settings apps. in-box starts the container in a scope of its own (container-up.sh, which now
takes the container's name) and becomes `distrobox enter BOX --`, so callers behave as before.

BOX is "dev" for a source install. A release names its own container in .frametop-release,
so the same tree runs from an image without editing nine call sites. FRAMETOP_BOX overrides
both. Development tools (frame.sh, the headless test, the gaze probe and lab) and hand
tracking, which install.sh doesn't install, keep using the dev container.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 20:54:13 -06:00

21 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# Runs on the Frame host: run a program of this tree in the container it was built for.
# scripts/in-box PROGRAM [ARGS...]
# A source install (a clone; the components' build.sh scripts build in the "dev" container)
# runs its programs in "dev". A release (pack/get-release.sh) runs them in the container made
# from its image, which its .frametop-release names (BOX=...). FRAMETOP_BOX in the environment
# overrides both, to try a tree in another container.
#
# It starts the container first, in a scope of its own (scripts/container-up.sh), then
# becomes `distrobox enter BOX -- PROGRAM ARGS...`: stdin, stdout, and the exit status pass
# through, and, as before, a signal to it doesn't reach the program in the container.
# podman needs the real XDG_RUNTIME_DIR; callers in a nested session pass theirs to the
# program with env, as they did with distrobox enter.
tree=$(cd "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")/.." && pwd)
box=${FRAMETOP_BOX:-$(sed -n 's/^BOX=//p' "$tree/.frametop-release" 2>/dev/null | tail -1)}
box=${box:-dev}
[[ $box =~ ^[A-Za-z0-9][A-Za-z0-9_.-]*$ ]] || { echo "in-box: not a container name: $box" >&2; exit 2; }
[ $# -gt 0 ] || { echo "usage: $0 PROGRAM [ARGS...]" >&2; exit 2; }
XDG_RUNTIME_DIR=/run/user/$(id -u) "$tree/scripts/container-up.sh" "$box"
exec "$HOME/.local/bin/distrobox" enter "$box" -- "$@"