Files
Panama/config/bash/shell
T
Gabriel Brown 153554b5df Make ./install something you could hand a stranger
The audit's third tier: everything between this installer and a fresh machine
it has never met.

The one path that could cost a person their display: the interview probes
Secure Boot with mokutil, which install-packages had not installed yet, so on
a minimal base the MOK question silently never fired -- and install-hardware
still installed akmod-nvidia and blacklisted nouveau, arming a reboot into an
unloadable driver with its fallback disabled. The probe tools (pciutils,
mokutil, fwupd) now bootstrap beside gum, and install-hardware re-checks
Secure Boot for itself and refuses the driver rather than the display.

Secrets leave the checkout: the personal environment moves to
~/.config/panama/env at mode 600 by migration, and .bashrc sources it with a
permission check that quietly re-tightens drift. change-settings no longer
overwrites /etc/dnf/dnf.conf -- two performance keys are set additively, the
defaultyes=True that made every `dnf remove` treat Enter as yes is gone, and
a migration strips it from machines that already received it.

Package installation survives the world changing: the initial and desktop
lists run with --skip-unavailable and a report_missing pass that names what
was skipped (resolved through --whatprovides, so capability names like awk
do not cry wolf); the openh264, appstream and core-group extras go through
soft; RustDesk resolves its RPM for the machine's own architecture; and the
Claude Desktop repository script is fetched to a kept file and run, never
piped from the network into root.

The hardware predicates stop guessing: a wireless mouse's scope=Device
battery no longer turns a tower into a laptop, USB-PD-only machines read
their power state from the battery's own status instead of being permanently
"on AC", the lid falls back to logind's LidClosed where ACPI is silent, and
charge limits reach every pack of a two-battery machine in one authorization
-- with the reported percentage summed across packs.

And the parsers stop assuming this machine: snapper is read through
--machine-readable csv with named columns instead of a localized box-drawing
table, and reports whether snapshots are even possible so ext4 and
unconfigured-btrfs stop looking identical; fprintd is parsed under LC_ALL=C;
the hypridle drop-in resolves the binary it points at; the recorder's render
node became an "auto" token resolved at record time; update-grub writes the
config its firmware actually boots; the nvm prompt hook and the SSH tmux
takeover are guarded; hipblas and rocm-opencl move to an opt-in gpu-compute
category; and the two interactive python tools' libraries are declared.

Claude-Session: https://claude.ai/code/session_01Epx9ZC1gwm81K3jm9x9CKh
2026-08-23 12:10:03 -04:00

62 lines
2.5 KiB
Bash

#!/usr/bin/env bash
# Editor used by CLI
export EDITOR="nvim"
export SUDO_EDITOR="$EDITOR"
export SSH_ASKPASS=/usr/bin/ksshaskpass
export SSH_ASKPASS_REQUIRE=prefer
# Define Paths
export CARGO_PATH="$HOME/.cargo"
export BUN_INSTALL="$HOME/.bun"
export PYENV_ROOT="$HOME/.pyenv"
export PNPM_HOME="$HOME/.local/share/pnpm"
export NVM_DIR="$HOME/.nvm"
export ANDROID_SDK_HOME="$HOME/.local/share/Android"
export GOPATH="$HOME/.local/share/go"
export DOTNETPATH="$HOME/.dotnet/tools"
# Podman
# export DOCKER_HOST=unix:///run/user/1000/podman/podman.sock
# Set complete path
export PATH="$HOME/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PANAMA_PATH/bin:$BUN_INSTALL/bin:$CARGO_PATH/bin:$PNPM_HOME/bin:$PYENV_ROOT/bin:$HOME/.rbenv/bin:/usr/lib/ccache/bin/:$GOPATH/bin:$DOTNETPATH"
# Nvm. Guarded because the file belongs to the nvm package: before that is
# installed it does not exist, and an unconditional source means every shell on
# a fresh machine opens with an error.
[ -f /etc/profile.d/nvm.sh ] && source /etc/profile.d/nvm.sh
# Auto-switch Node version when entering a directory with .nvmrc
_nvm_auto_use() {
# Guarded on nvm actually being loaded: without this, a machine where the
# nvm profile script is absent printed "command not found" on every single
# prompt in any directory carrying a .nvmrc.
if [[ -f .nvmrc ]] && type -t nvm >/dev/null 2>&1; then
nvm use --silent
fi
}
export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND; }_nvm_auto_use"
# Auto-start or attach tmux for SSH interactive shells. A deliberate Panama
# behavior (tmux is in initial-packages, and a dropped SSH session keeping its
# work is the point), but guarded: it must not replace the shell of someone
# whose machine lacks tmux, and PANAMA_SSH_TMUX=off turns it off for people
# who want a plain shell -- set it in ~/.config/panama/env.
if [[ -n "$SSH_CONNECTION" && -z "$TMUX" && $- == *i* \
&& "${PANAMA_SSH_TMUX:-on}" != "off" ]] && command -v tmux >/dev/null 2>&1; then
exec tmux new-session -A -s main
fi
# Zoxide
eval "$(zoxide init bash)"
# Oh My Posh
# Guarded for the same reason the nvm source above is: oh-my-posh is a package,
# and a shell opened before it is installed -- a stage re-run by hand, an
# install that failed partway -- would otherwise print command-not-found on
# every prompt. An unthemed prompt is a worse shell; an erroring one is a
# broken-looking machine.
if command -v oh-my-posh >/dev/null 2>&1; then
eval "$(oh-my-posh init bash --config "$PANAMA_PATH/config/dot/ohmyposh/gib.omp.json")"
fi