# /.bashrc — brintOS fbcon console shell rc for BASH-init machines (HWJS-C-1 # console-shell wiring, extended to the demo distros 2026-07-03). # # WHY: the framebuffer console (fbcon on /dev/tty1, rendered to the browser # canvas) only accepts typed text if SOMETHING is reading /dev/tty1. The # dev-machine dual-console wiring used busybox ash's $ENV rc # (distros/linux-6.12-musl-busybox/tools/fbcon-rc) with setsid+cttyhack; a # bash-init machine has NEITHER (bash ignores $ENV outside POSIX mode, and # coreutils ships no setsid). This rc is the bash-native equivalent: pid 1 is # `/init -i` (interactive, non-login) with HOME=/ from the host initEnvp, so # bash reads THIS file at startup. # # It spawns ONE additional interactive bash with stdio on /dev/tty1. # Limitation (documented, accepted): bash has no setsid builtin, so the tty1 # shell stays in pid 1's session and /dev/tty1 never becomes its controlling # terminal — typing/echo/commands work (the fbcon "typed text" surface), but # canvas Ctrl-C (VT ISIG -> fg pgrp of tty1's session) has no target. Full # job control on the canvas needs a setsid helper (the busybox machine gets # it via its inittab tty1 entry; a first-party setsid package is the # follow-up for bash machines). # # Guards: fire exactly once, in pid 1 only, only when the kernel actually # has a /dev/tty1 (a display-less boot skips silently — the rc is inert), # and NEVER under wasm_user_pin (see below). # # wasm_user_pin note (HISTORY): the glibc machine originally did NOT stage # this rc — under its wasm_user_pin cmdline fallback every blocking tty read # PINNED its pool Worker's JS thread, so a second idle console shell would # exhaust a cpu=2 pool and wedge the first fork(). CLOSED (HWJS-C-1, # 2026-07-03): glibc now decodes the -517 coro-park, the glibc machine runs # the cooperative default (wasm_user_pin removed from its MachineSpec) and # stages its own adapted copy of this rc — see # distros/linux-6.12-glibc-bash-coreutils/tools/fbcon-bashrc. # EMCRAFT-OVERLAY: brand prompt for the PID-1 console shell (HOME=/, so it # sources THIS file after the launcher env PS1 — a PS1= here wins). PS1='EMCRAFT:\w\$ ' if [ -z "${BRINTOS_FBCON_STARTED-}" ] && [ "$$" = 1 ] && [ -c /dev/tty1 ]; then export BRINTOS_FBCON_STARTED=1 TERM=linux PS1='EMCRAFT:\w\$ ' bash -i 0<>/dev/tty1 1>&0 2>&0 & fi