#!/bin/zsh
# console-login — exec ttymon on /dev/console with a properly quoted prompt.## Wrapping ttymon in a script (instead of inlining in exec.start) sidesteps# zyginit's str.split-on-space tokenizer, which doesn't honor shell quotes.# Inline the ttymon invocation here where the shell DOES quote correctly,# then exec so ttymon becomes the supervisor's direct child.set -e
set -u
# Write a LOGIN_PROCESS utmpx entry for the PID that's about to become# ttymon (this script's PID, since we use `exec` below). ttymon's# getty_account() (tmutmp.c) updates an existing entry — it does not# create one — so without this, login(1) walks utmpx, finds nothing# matching its PID, and exits with "No utmpx entry. You must exec# login from the lowest level shell."/etc/zyginit/services/console-login/write_login_utmpx co console $$
# -T sun-color: tell the login session to use the sun-color terminfo# entry, which matches illumos's in-kernel `tem` console emulator.# Without this, zshenv's fallback to TERM=xterm leaks raw ANSI escapes# ((B, [B, etc.) through the zsh prompt because tem doesn't implement# the full xterm spec.exec /usr/lib/saf/ttymon \
-g \
-d /dev/console \
-l console \
-m ldterm,ttcompat \
-T sun-color \
-h \
-p "hammerhead console login: "