1
0
Fork 0

Font install check: anchor to exact family 'Maple Mono NF'

The previous substring check (*"Maple Mono NF"* glob / grep -q substring)
matched 'Maple Mono NF CN' too, which silently skipped the Latin-only NF
install on boxes that had only the CJK variant installed (byte, kaiser —
they shipped with maple-font system package that defaults to NF CN).

Result: foot (and any other config asking for 'Maple Mono NF') silently
fell back to system sans on byte and kaiser, while looking like a
working terminal. Compounded by foot.ini asking for 'Maple Mono CN'
(see prior commit c6779c5), which masked the missing NF install on
miche (which has both CN and NF).

Fix: use fc-list : family | grep -qxF 'Maple Mono NF' which:
- prints one family per line (no style suffixes to confuse grep)
- -x anchors whole line
- -F fixed string (no regex)
- matches exactly 'Maple Mono NF' and nothing else

Why not fc-match? fc-match reports a substitute when the family isn't
installed (Noto/Liberation/DejaVu depending on distro), so it can't
distinguish 'NF installed' from 'NF not installed, fell back'.

Verified on byte: fc-list : family | grep -qxF 'Maple Mono NF' returns
1 (false) because byte has only 'Maple Mono NF CN', so the install will
now run on next chezmoi apply.
This commit is contained in:
Rain 2026-06-23 20:31:33 -04:00
parent c6779c57ce
commit 6644666cb1
2 changed files with 15 additions and 6 deletions

View file

@ -263,7 +263,9 @@ else
fi
# Step 9: Maple Mono NF font
if ! fc-list | grep -qi "Maple Mono NF"; then
# Match EXACT family "Maple Mono NF", not "Maple Mono NF CN" or other variants.
# See run_once_20-install-user-packages.sh.tmpl for the rationale.
if ! fc-list : family 2>/dev/null | grep -qxF 'Maple Mono NF'; then
log "installing Maple Mono NF font"
# Download the latest release zip
TMPFONT=$(mktemp -d)

View file

@ -290,11 +290,18 @@ fi
# Pin Maple-font version. Bump manually if a release breaks things.
MAPLE_FONT_VERSION="v7.9"
# fc-list check: bash string match instead of pipeline, because `set -o pipefail`
# in this script causes `fc-list | grep -q` to fail with SIGPIPE (exit 141) when
# grep exits early on first match — the pipeline then reports non-zero, the
# `if` evaluates to false, and the bootstrap re-installs the font unnecessarily.
if [[ "$(fc-list 2>/dev/null)" == *"Maple Mono NF"* ]]; then
# fc-list check: must match the EXACT family "Maple Mono NF", not substrings.
# `*Maple Mono NF*` glob / `grep -q "Maple Mono NF"` substring matches would also
# match "Maple Mono NF CN" (the CJK variant) and incorrectly skip the install.
# byte and kaiser both have system-wide `MapleMono-NF-CN` from a maple-font
# package install but no Latin-only `MapleMono-NF`, and the substring check
# silently let that slide. Use `fc-list : family` to print one family per line
# (no style suffixes), `grep -qxF` to match the exact whole line.
#
# Why not `fc-match "Maple Mono NF"`? fc-match reports a substitute if the family
# isn't installed (falls back to system sans), so it can't distinguish "NF
# installed" from "NF not installed, fell back to Noto/Liberation/DejaVu".
if fc-list : family 2>/dev/null | grep -qxF 'Maple Mono NF'; then
log "Maple Mono NF already installed"
else
{{ if eq .os_family "arch" -}}