From 0cc12f050a218fbe8533fee15e611f3da8dcb14e Mon Sep 17 00:00:00 2001 From: rain Date: Sun, 21 Jun 2026 19:37:06 -0400 Subject: [PATCH] Fix .chezmoi.yaml.tmpl: handle missing ID_LIKE on debian-stable debian-stable's /etc/os-release has no ID_LIKE field. Template crashed with 'map has no entry for key idLike' when chezmoi init ran on rye. Two fixes: 1. hasKey() guard around .chezmoi.osRelease.idLike so missing key doesn't error out 2. Flip contains() arg order: sprig's signature is contains(substr, str), not contains(str, substr). Was checking backwards. Tested against: - miche (ID=debian-derivative with ID_LIKE=arch) -> os_family=arch - empty ID_LIKE fallback (debian-stable) -> falls through to .id=debian -> os_family=debian --- .chezmoi.yaml.tmpl | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.chezmoi.yaml.tmpl b/.chezmoi.yaml.tmpl index e86fde3..d5dbcb0 100644 --- a/.chezmoi.yaml.tmpl +++ b/.chezmoi.yaml.tmpl @@ -1,8 +1,12 @@ {{- $osFamily := "unknown" -}} -{{- if eq .chezmoi.osRelease.idLike "arch" -}} -{{- $osFamily = "arch" -}} -{{- else if or (eq .chezmoi.osRelease.id "debian") (eq .chezmoi.osRelease.idLike "debian") -}} -{{- $osFamily = "debian" -}} +{{- $idLike := "" -}} +{{- if hasKey .chezmoi.osRelease "idLike" -}} + {{- $idLike = .chezmoi.osRelease.idLike -}} +{{- end -}} +{{- if or (eq .chezmoi.osRelease.id "arch") (contains "arch" $idLike) -}} + {{- $osFamily = "arch" -}} +{{- else if or (eq .chezmoi.osRelease.id "debian") (contains "debian" $idLike) -}} + {{- $osFamily = "debian" -}} {{- end -}} encryption: "age" sourceDir: {{ .chezmoi.sourceDir | quote }}