diff --git a/.chezmoi.toml.tmpl b/.chezmoi.toml.tmpl index 741056f..af50f17 100644 --- a/.chezmoi.toml.tmpl +++ b/.chezmoi.toml.tmpl @@ -2,6 +2,7 @@ # It collects information about the system in order to determine # which of the _home.* dirs will be set as the .chezmoiroot # +{{- $scriptTempDir := "~/.cache/chezmoi/tmp" }} {{- $chassisType := "desktop" }} {{- $sysType := "posix" }} {{- if eq .chezmoi.os "darwin" }} @@ -18,7 +19,10 @@ {{- $chassisType = (output "powershell.exe" "-NoProfile" "-NonInteractive" "-Command" "if ((Get-CimInstance -Class Win32_Battery | Measure-Object).Count -gt 0) { Write-Output 'laptop' } else { Write-Output 'desktop' }") | trim }} {{- end }} +scriptTempDir={{- $scriptTempDir | quote }} + [scriptEnv] - CZ_CHASSIS="{{- $chassisType }}" - CZ_SYS="{{- $sysType }}" - CZ_OS="{{- .chezmoi.os }}" + CZ_SCRIPT_TEMPDIR={{- $scriptTempDir | quote }} + CZ_CHASSIS={{- $chassisType | quote }} + CZ_SYS={{- $sysType | quote }} + CZ_OS={{- .chezmoi.os | quote }} diff --git a/.chezmoiscripts/run_init.sh.tmpl b/.chezmoiscripts/run_init.sh.tmpl index 8b93ddc..9f1dc0f 100755 --- a/.chezmoiscripts/run_init.sh.tmpl +++ b/.chezmoiscripts/run_init.sh.tmpl @@ -2,9 +2,9 @@ set -e -#env | grep -E 'chezmoi|^CZ' +env | grep -E 'chezmoi|^CZ' cd "$CHEZMOI_SOURCE_DIR" -CZ_MODEL="$(ioreg -l | grep "product-name" | sed -Ee 's/^.*\<"(.*)\"\>.*$/\1/')" +#CZ_MODEL="$(ioreg -l | grep "product-name" | sed -Ee 's/^.*\<"(.*)\"\>.*$/\1/')" set | grep '^CZ_' printf 'System detected as %s/%s, setting up .chezmoiroot and initializing...\n' "$CZ_SYS" "$CZ_CHASSIS" if [ -r "base.chezmoiroot.$CZ_SYS.$CZ_CHASSIS" ]; then diff --git a/_src.posix/.chezmoi.toml.tmpl b/_src.posix/.chezmoi.toml.tmpl index 56873e0..2bb80c2 100644 --- a/_src.posix/.chezmoi.toml.tmpl +++ b/_src.posix/.chezmoi.toml.tmpl @@ -4,6 +4,9 @@ {{- $gitEmail := promptStringOnce . "gitEmail" "email address (for git commits)" -}} {{- $gitName := promptStringOnce . "gitName" "Full name (for git commits)" -}} +{{- $scriptTempDir := "~/.cache/chezmoi/tmp" }} +scriptTempDir={{- $scriptTempDir | quote }} + [data] {{- if ($sysname) }} sysname = {{ $sysname | quote }}