|
root / base / usr / src / zyginit / services / console-login / start.sh
start.sh Bash 33 lines 1.3 KB
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/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: "