Skip to content

fix(motd): apply the shared dark/light palette and heavier rules - #108

Merged
LucaLin233 merged 3 commits into
mainfrom
forge/motd-fixed-highlights
Dec 1, 2026
Merged

LucaLin233 merged 3 commits into
mainfrom
forge/motd-fixed-highlights

Conversation

@LucaLin233

Copy link
Copy Markdown
Owner

Summary

把已定稿的「SSH 登录 · 深浅共用配色」落到 MOTD payload:

  • 主机名 #0860C4、系统版本 #B32675、内核版本 #965000 改为深浅终端共用的固定真彩色,字重沿用原样(主机名/系统/内核保持粗体)。
  • 其余字段不动:正文/标签/分隔线仍为 SGR 39,CPU 33、负载 36、健康/警告 32/33/31、来源 IP 35、日期时间与来源行用 39,风险阈值不变。
  • 加粗图形:欢迎竖线 │→┃,欢迎区下横线与提示符上方横线 ─→━;内存/根盘进度条改为哈希块 █ 填充 + 重线 ━ 轨道,去掉原先细线 ─,仍按原 6 格与四舍五入填充。
  • 登录渲染路径(--last-login,即 PAM pam_exec)在登录记录之后输出一条 ━ 底横线,兼容有记录、无来源、无历史三种情况;登录数据仍不写入共享缓存,sshd drop-in / PAM 安装与恢复语义未改。
  • 不探测主题、不加背景色、不加主题机制;NO_COLOR/TERM=dumb/缺 TERM 行为与宽度回退(40 列兜底、按段折行)保持不变。

Scope

仅 tools/setup-motd.sh、modules/system-customize.sh(两处嵌入 payload 逐字节一致)与 tests/test-motd.sh;hash pin 更新为提取后 sha256。

Validation

  • bash -n:三个文件通过。
  • git diff --check:通过。
  • payload 一致:cmp 两处提取内容相同。
  • payload sha256:04152b5c08fd321c7d64046d82c3d1e8a90a287ace7a2ca505d0245b4de07ce1,与两处 pin 和测试断言一致。
  • 无凭据合成输入自验(提取 payload 直接运行 + 伪 lslogins):
    • 固定 RGB 恰好三处(8;96;196、179;38;117、150;80;0),无 38;5;、无亮色索引、无 48; 背景。
    • NO_COLOR / TERM=dumb 无转义且文本与彩色版逐字一致;缺 TERM 仍有颜色。
    • 宽/窄终端(20/32/40/80 列)每行不超宽;PAM 式无 COLUMNS 走 40 列。
    • 登录路径底横线在两条登录记录之后;无历史时只输出该横线。
    • 稳定夹具内存 50% → 3/6 填充、根盘 75% → 5/6 填充,█ 与 ━ 同现且无 ─。
  • 本机未套 ShellCheck(未安装);其余测试交 CI。

Risks

  • 固定 RGB 在极端终端主题下对比度下降,这是定稿明示取舍;只作用于三个字段。
  • 粗细字符依赖终端字体对 ┃/━/█ 的宽度,均为单宽度 Unicode 制表符,与原先 │/─ 同类。

Rollback

git revert 本 PR 的 squash commit,或 restore 工具回退已安装 MOTD 组;无配置、PAM 或 sshd 语义变化需要恢复。

Closes nothing; tracking issue n/a.

FORGE added 3 commits December 1, 2026 08:20
Hostname, OS version and kernel version now use the three RGB values fixed by
the approved dark/light design, while every other field keeps the terminal
theme colours. The welcome bar, both dividers and the memory/root-disk bars
switch to heavy/block glyphs, and the PAM login path prints one bottom rule
after the login record (also when no record exists).
A real host can legitimately sit at 0/6 or 6/6, so the live-output check now
only asserts six cells drawn from the block/heavy pair and no thin track.
Exact fill order and counts stay on the stable fixtures, plus new 0/4/100
percent cases for both endpoints.
Debian's C locale made [[ =~ [█━]{6} ]] and the sed bracket classes treat the
multi-byte glyphs as bytes, so a valid bar was rejected. The bar is now cut
after the percent sign with parameter expansion and validated by stripping the
two literal glyphs, which behaves the same in C and C.UTF-8.
@LucaLin233
LucaLin233 merged commit 01952ef into main Dec 1, 2026
16 checks passed
@LucaLin233
LucaLin233 deleted the forge/motd-fixed-highlights branch December 1, 2026 00:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant