Repository navigation
fix(motd): compact SSH login layout for mobile - #109
Merged
Merged
Conversation
Drop the fixed label column so the hostname opens the panel, compact uptime to 3天4小时, keep the aligned resource bars and the closing rule, and use one low-saturation ANSI palette that adapts to dark and light terminals. Both entry points share the same payload and hash.
Read the release name and codename from os-release instead of pinning Debian, drop the duplicated host check in the long-hostname loop, and assert the resource zone by its fields so the Ubuntu shard passes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
把 SSH 登录 MOTD 的状态面板改成移动端优先的紧凑版式:主机/系统/已运行可在同一行、
负载/内存/根盘/CPU/内核各占一行、底部两行
上次登录/来源,并在明确列宽下使用 10 格ASCII 进度条。列宽未知时(SSH PAM / run-parts 拿不到客户端宽度)兜底从旧 40 列改为 46 列。
Scope
tools/setup-motd.sh、modules/system-customize.sh:同一份 payload 同步修改,两份仍逐字节一致;保留既有采集、字段折行与安全安装/恢复链,只调整渲染布局、进度条格数与默认列宽。
1;32、来源 IP1;34、资源数字1;36、已用条36、其余39;无 truecolor、无固定 RGB、无背景填充;
NO_COLOR、TERM=dumb与 PAM 环境行为不变。tests/test-motd.sh:更新过时的欢迎横幅/固定 RGB/40 列/块字符断言,新增 46 列兜底、窄版 6 格条、宽版 10 格条、显式 COLUMNS 31/32/40/80 与溢出回退断言;版式断言改用固定短主机名
的稳定夹具,避免 CI 节点主机名长度影响 46 列合并行。
README.md:补充未知列宽兜底、显式COLUMNS优先、窄版说明与 ANSI 说明。Validation
git diff --check通过;bash -n通过:tools/setup-motd.sh、modules/system-customize.sh、tests/test-motd.sh。bash -n通过;两份 payloadcmp一致,sha256
e2d54d505aa733acc768c2de5ae0b3261bf9388b19afc615206f960f33199af9。TIOCSWINSZ46x30,无 SetEnv)登录,远端stty size回读46x30:面板 6 行 + PAM 2 行,最宽行 40 列;主机/已运行同行、内核/架构同行、10 格 ASCII 条均成立,
来源按
<IP>脱敏记录。Risks
并非 PAM/run-parts 能读到的真实列宽;客户端更窄时会在字段边界折行,不丢内容、不缩字号。
#见于真机截图,只读诊断归因到 zsh 的PROMPT_EOL_MARK提示符标记(zsh -f可复现同序列,位于 PAM 两行之后),不是本 payload 输出;Termark 下为何保留在屏仍待确认,如需处理应在 shell 提示符侧。
Rollback
单个 squash 提交,
git revert即可回到当前main的布局与 40 列兜底;生产侧恢复使用既有setup-motd.sh restore(组级快照,状态目录/var/lib/linux-setup/motd-backups)。