diff --git a/run_once_20-install-user-packages.sh.tmpl b/run_once_20-install-user-packages.sh.tmpl index 69236e7..cb823e3 100755 --- a/run_once_20-install-user-packages.sh.tmpl +++ b/run_once_20-install-user-packages.sh.tmpl @@ -165,12 +165,29 @@ if [[ "$(fc-list 2>/dev/null)" == *"Maple Mono NF"* ]]; then log "Maple Mono NF already installed" else {{ if eq .os_family "arch" -}} - log "installing maplemono-nf-cn from AUR (via paru)" - # paru refuses to run as root, so don't sudo it. --sudoloop runs sudo - # in the background so any internal sudo prompts don't block the - # non-interactive chezmoi run. If the host doesn't have NOPASSWD sudo, - # paru will fail (and the bootstrap will surface the error). - paru --sudoloop -S --needed --noconfirm maplemono-nf-cn + # Try paru first (clean install via AUR). If it fails (e.g. sudo TTY prompt + # in non-interactive runs, or AUR helper missing), fall back to downloading + # the upstream zip release directly — no sudo needed. + FONT_DIR="$USER_HOME/.local/share/fonts/maple-mono-nf" + mkdir -p "$FONT_DIR" + TMP_ZIP="$(mktemp /tmp/maple-font.XXXXXX.zip)" + if curl -fL --retry 3 \ + "https://github.com/subframe7536/Maple-font/releases/download/${MAPLE_FONT_VERSION}/MapleMono-NF.zip" \ + -o "$TMP_ZIP"; then + log "extracting font files" + unzip -q -o "$TMP_ZIP" -d "$FONT_DIR" + rm -f "$TMP_ZIP" + log "refreshing font cache (fc-cache)" + if command -v fc-cache >/dev/null 2>&1; then + fc-cache -fv >/dev/null + else + log "WARNING: fc-cache not found — install fontconfig package" + fi + else + log "WARNING: failed to download Maple Mono NF from GitHub" + log "manual install: https://github.com/subframe7536/Maple-font" + rm -f "$TMP_ZIP" + fi {{ else if eq .os_family "debian" -}} log "downloading MapleMono-NF.zip from subframe7536/Maple-font $MAPLE_FONT_VERSION" FONT_DIR="$USER_HOME/.local/share/fonts/maple-mono-nf"