chezmoi scriptTempDir related fixes
This commit is contained in:
parent
03a2310480
commit
d3ef7b6bcd
|
@ -1,7 +1,6 @@
|
|||
# This .chezmoi.toml file is used once only
|
||||
# It collects information about the system in order to determine
|
||||
# which of the _home.* dirs will be set as the .chezmoiroot
|
||||
#
|
||||
|
||||
{{- $githubToken := promptStringOnce . "githubToken" "Public GITHUB token (mostly for rate limits - !insecure!)" (or (
|
||||
env "CZ_GITHUB_ACCESS_TOKEN"
|
||||
|
@ -9,7 +8,7 @@
|
|||
) ( env "GITHUB_ACCESS_TOKEN"
|
||||
) ( env "GITHUB_TOKEN"
|
||||
)) -}}
|
||||
{{- $scriptTempDir := "~/.cache/chezmoi/tmp" }}
|
||||
{{- $scriptTempDir := or (env "CZ_SCRIPT_TEMPDIR") "~/.cache/chezmoi/tmp" }}
|
||||
|
||||
{{- $chassisType := "desktop" }}
|
||||
{{- $sysType := "posix" }}
|
||||
|
@ -32,8 +31,9 @@
|
|||
{{- $sysType = "windows" }}
|
||||
{{- $sysVendor = "pc" }}
|
||||
{{- $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 }}
|
||||
{{- end -}}
|
||||
|
||||
#
|
||||
scriptTempDir={{- $scriptTempDir | quote }}
|
||||
|
||||
[scriptEnv]
|
||||
|
|
22
.init.me.sh
22
.init.me.sh
|
@ -34,6 +34,28 @@ done
|
|||
set -e
|
||||
${SET_X:-:} -x
|
||||
|
||||
# Make sure temporary directory exists
|
||||
CZ_SCRIPT_TEMPDIR="${CZ_SCRIPT_TEMPDIR:-~/.cache/chezmoi/tmp}"
|
||||
mkdir -p "${CZ_SCRIPT_TEMPDIR}"
|
||||
|
||||
# (in debug x2 mode) Show the existing configuration before destroying it
|
||||
[[ -z "${CZ_DEBUG}" ]] || chezmoi cat-config
|
||||
|
||||
# Destroy existing chezmoi state
|
||||
rm -fR ~/.config/chezmoi ~/.local/share/chezmoi/.chezmoiroot
|
||||
|
||||
# Create a temporary chezmoi configuration bypass /tmp noexec situation
|
||||
mkdir -p ~/.config/chezmoi
|
||||
cat - > ~/.config/chezmoi/chezmoi.toml <<TOML
|
||||
scriptTempDir="${CZ_SCRIPT_TEMPDIR}"
|
||||
TOML
|
||||
|
||||
# Show the initial configuration in debug x2 mode
|
||||
[[ -z "${CZ_DEBUG}" ]] || chezmoi cat-config
|
||||
|
||||
# "It's show time!" - Re-initialize
|
||||
chezmoi init ${CZ_DEBUG} --apply
|
||||
unset SET_X
|
||||
|
||||
# Show the final configuration in debug x2 mode
|
||||
[[ -z "${CZ_DEBUG}" ]] || chezmoi cat-config
|
||||
|
|
Loading…
Reference in New Issue