diff --git a/run_once_20-install-user-packages-gentoo.sh.tmpl b/run_once_20-install-user-packages-gentoo.sh.tmpl index ff98e84..21f8f71 100644 --- a/run_once_20-install-user-packages-gentoo.sh.tmpl +++ b/run_once_20-install-user-packages-gentoo.sh.tmpl @@ -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) diff --git a/run_once_20-install-user-packages.sh.tmpl b/run_once_20-install-user-packages.sh.tmpl index 300b1be..1a076f9 100755 --- a/run_once_20-install-user-packages.sh.tmpl +++ b/run_once_20-install-user-packages.sh.tmpl @@ -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" -}}