From 4bbf7c9d6b58e0cf985a376d4118943cd960c9c3 Mon Sep 17 00:00:00 2001 From: "Lockszmith (@wolfpack)" Date: Tue, 15 Apr 2025 16:13:14 -0400 Subject: [PATCH 1/2] Fix initialization and improve it's resiliancy --- .chezmoiscripts/run_init.sh.tmpl | 9 +++++++-- .../_src.posix/.chezmoiscripts/run_once_init.sh.tmpl | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.chezmoiscripts/run_init.sh.tmpl b/.chezmoiscripts/run_init.sh.tmpl index 7be5c8d..882467c 100755 --- a/.chezmoiscripts/run_init.sh.tmpl +++ b/.chezmoiscripts/run_init.sh.tmpl @@ -49,5 +49,10 @@ if ! [ -d ~/.cache/chezmoi/init_backup ]; then safe_backup ~/.zshrc ~/.zsh_history ~/.zprofile ~/.bashrc ~/.bash_history ~/.profile fi -# Brute force remove chezmoistate lock and restart init --apply -exec sh -c 'rm ~/.config/chezmoi/chezmoistate.boltdb && CZ_EXTR=1 chezmoi init --apply' +# Brute force remove chezmoistate lock and initialize chezmoi +# apply with CZ_EXTR=1 will run twice as some logic in chemzoiexternal +# requires tools that are downloaded with chezmoiexternal +exec sh -c 'rm ~/.config/chezmoi/chezmoistate.boltdb \ + && chezmoi init && chezmoi apply \ + && printf "apply with externals #1/2...\n" && CZ_EXTR=1 chezmoi apply \ + && printf "apply with externals #2/2...\n" && CZ_EXTR=1 chezmoi apply' diff --git a/chezmoi.roots/_src.posix/.chezmoiscripts/run_once_init.sh.tmpl b/chezmoi.roots/_src.posix/.chezmoiscripts/run_once_init.sh.tmpl index 92cc9ab..b02a2bb 100755 --- a/chezmoi.roots/_src.posix/.chezmoiscripts/run_once_init.sh.tmpl +++ b/chezmoi.roots/_src.posix/.chezmoiscripts/run_once_init.sh.tmpl @@ -1,3 +1,3 @@ #! /usr/bin/env bash -printf '_home init\s' +printf '_src.posix init\n' From 9a6dab3467f9add77df73e0d22ec5f7699dea69d Mon Sep 17 00:00:00 2001 From: "Lockszmith (@wolfpack)" Date: Tue, 15 Apr 2025 16:13:46 -0400 Subject: [PATCH 2/2] Repair cargo-binstall based externals --- chezmoi.roots/_src.posix/.chezmoiexternal.yaml.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chezmoi.roots/_src.posix/.chezmoiexternal.yaml.tmpl b/chezmoi.roots/_src.posix/.chezmoiexternal.yaml.tmpl index 1a878a7..e9f3c35 100644 --- a/chezmoi.roots/_src.posix/.chezmoiexternal.yaml.tmpl +++ b/chezmoi.roots/_src.posix/.chezmoiexternal.yaml.tmpl @@ -112,7 +112,7 @@ "refreshPeriod" $defaultRefresh ) -}}{{- end -}}{{- end -}}{{- end -}} -{{- if lookPath "jq" -}} +{{- if and (lookPath "jq") (lookPath "cargo-binstall") -}} {{- $path_prefix = or (get (dict "linux" "./") .chezmoi.os) "" -}} {{- with $app_name := "eza" -}} {{- with $bin_url := (output "sh" "-c" (