Files
platform/scripts/setup-old/officer-set-display.sh
pastilhasandClaude Opus 5 34bb8fc22a put the superseded setup scripts in setup-old, and repair what the move broke
scripts/setup/ is now what the new installer is being built in — machine-setup/
for the box, officer-setup.sh for the platform on top — and everything being
replaced moved to scripts/setup-old/. It still works and is still what to run.

Three things the move broke, and what each needed:

  starship.toml is not an old-setup artifact. os-user-shell.ts reads it at
  RUNTIME to seed a member's ~/.config/starship.toml when their Linux account is
  provisioned, and line 125 reads it inside a try whose catch returns
  "could not read the shell templates" — so account provisioning would have
  failed outright, not degraded. Moved back to scripts/setup/, which is where it
  belongs anyway (one file, both audiences) and which leaves the code correct
  with no edit.

  package.json's `setup` script pointed at a path that no longer exists. It now
  points at officer-setup.sh, where the installer is going, rather than at
  setup-old/ which is temporary.

  officer-setup.sh was created empty. An empty script exits 0, so `bun setup`
  would have reported success while doing nothing — worse than the broken path
  it replaced. It now explains that it is not written yet and exits 1, naming
  the setup-old script to run meanwhile.

Also brought .tmux.conf and ufw-docker-rules.conf in beside machine-setup.sh,
which reads both from SCRIPT_DIR and had been silently skipping them since the
script was vendored. ssh-keys.zip deliberately stays out: it is key material,
and *.zip is ignored.

Comments in os-user-claude.ts, app-store/preflight.ts and two docs still name the
old scripts/setup/setup.sh path. Left alone on purpose — repointing them at
setup-old/ only to repoint them again when officer-setup.sh lands is churn.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-12 17:07:28 +00:00

39 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/env bash
# Pick the largest sane mode on whichever output is connected, at session start.
#
# With no monitor attached the connector's EDID comes from drm.edid_firmware (see the kernel command
# line). That EDID advertises plenty of modes but its *preferred* one is the captured screen's native
# resolution, which may be tiny — GNOME picks preferred, so an 800x480 panel yields an 800x480
# desktop. monitors.xml is the documented override but its monitor matching proved unreliable here,
# so set the mode directly. No-ops when the mode is already right, so it is safe to run repeatedly.
set -eu
MAX_WIDTH="${OFFICER_MAX_WIDTH:-1920}"
# The session's X server may not be up yet when autostart fires.
for _ in $(seq 1 20); do
xrandr --query >/dev/null 2>&1 && break
sleep 0.5
done
xrandr --query >/dev/null 2>&1 || exit 0
output=$(xrandr --query | awk '/ connected/ { print $1; exit }')
[ -n "$output" ] || exit 0
# Modes are listed under the output but are not reliably sorted, so pick the widest that fits.
mode=$(
xrandr --query \
| sed -n "/^${output} connected/,/^[^ ]/p" \
| awk '/^[[:space:]]+[0-9]+x[0-9]+/ { print $1 }' \
| awk -F x -v max="$MAX_WIDTH" '
{ w = $1 + 0; h = $2 + 0 }
w <= max && (w > bw || (w == bw && h > bh)) { bw = w; bh = h; best = $0 }
END { if (best) print best }'
)
[ -n "$mode" ] || exit 0
current=$(xrandr --query | awk -v o="$output" '$1 == o { print $3 }' | cut -d+ -f1)
[ "$current" = "$mode" ] && exit 0
xrandr --output "$output" --mode "$mode" || true