gentoo install scripts: guard with os_family like overlays
Both run_once_20-install-user-packages-gentoo.sh.tmpl and
run_once_40-install-sway-gentoo.sh.tmpl were missing the os_family
template guard (the overlays script got it in the previous fix but
these two slipped through). On non-gentoo boxes — arch, debian —
chezmoi apply would run them and they'd try to 'emerge', failing
with 'sudo: emerge: command not found' and exit status 1, which
breaks topgrade.
Wrap each body in '$0{ if eq .os_family "gentoo" }' / '$0{ else }',
mirroring the chaotic-aur script's pattern and the overlays fix from
the previous commit. On non-gentoo boxes the rendered script reduces
to a single 'skipping' log line and exits 0; on gentoo boxes the full
body (including the existing .sway_setup gate on the sway script) is
preserved.
Verified by rendering both scripts with a gentoo-config override:
arch (live) -> 'skipping gentoo user-packages' / 'skipping sway'
gentoo -> full body (293 / 87 lines)
Both pass bash -n and actually exit 0 when run on this arch box.
This commit is contained in:
parent
c54e770914
commit
b78e23aa16
2 changed files with 12 additions and 2 deletions
|
|
@ -24,6 +24,7 @@ die() { printf '\033[1;31m[packages ERROR]\033[0m %s\n' "$*" >&2; exit 1; }
|
|||
USER_HOME="${HOME:-$(eval echo "~$(whoami)")}"
|
||||
ZSH_CUSTOM="${ZSH_CUSTOM:-$USER_HOME/.oh-my-zsh/custom}"
|
||||
|
||||
{{ if eq .os_family "gentoo" -}}
|
||||
# ----------------------------- GENTOO ---------------------------------------
|
||||
# On gentoo, `emerge` is the only PM (plus the GURU overlay for some
|
||||
# packages). Many of the user packages live in GURU, so we run emerge with
|
||||
|
|
@ -290,4 +291,8 @@ fi
|
|||
log "all user packages installed"
|
||||
zsh --version
|
||||
nvim --version | head -1
|
||||
tmux -V
|
||||
tmux -V
|
||||
{{ else -}}
|
||||
# Not a gentoo box — nothing to do (guarded by os_family above).
|
||||
log "skipping gentoo user-packages (os_family={{ .os_family }}, not gentoo)"
|
||||
{{ end -}}
|
||||
|
|
@ -12,6 +12,7 @@ set -euo pipefail
|
|||
|
||||
log() { printf '\033[1;34m[sway]\033[0m %s\n' "$*"; }
|
||||
|
||||
{{ if eq .os_family "gentoo" -}}
|
||||
# --- 0. Gate on .sway_setup ---
|
||||
{{ if not .sway_setup -}}
|
||||
log "sway_setup not enabled for this host (.sway_setup=false). Skipping."
|
||||
|
|
@ -87,4 +88,8 @@ mkdir -p ~/.config/chezmoi/features
|
|||
touch ~/.config/chezmoi/features/sway
|
||||
log "marked box: ~/.config/chezmoi/features/sway"
|
||||
|
||||
log "sway stack install complete"
|
||||
log "sway stack install complete"
|
||||
{{ else -}}
|
||||
# Not a gentoo box — nothing to do (guarded by os_family above).
|
||||
log "skipping gentoo sway install (os_family={{ .os_family }}, not gentoo)"
|
||||
{{ end -}}
|
||||
Loading…
Add table
Add a link
Reference in a new issue