Update .local/share/chezmoi/home/.chezmoiscripts/universal/run_once_before_decrypt-age-key.tmpl, .local/share/chezmoi/home/key.txt.age, .local/share/chezmoi/home/.chezmoi.yaml.tmpl

This commit is contained in:
Brian Zalewski 2022-11-30 08:57:45 +00:00
parent 37970ee4e5
commit 553a15f30d
3 changed files with 17 additions and 11 deletions

View file

@ -118,12 +118,12 @@
{{- writeToStdout "Chezmoi is running in headless environment.\n" -}}
{{- end -}}
# encryption: "age"
# age:
# identity: "{{ .chezmoi.homeDir }}/.config/age/chezmoi.txt"
# recipient: "age1necy24c4lzxheey4p2m8v4q000n442wyv47qc640ulyxx9l8dpesdqv7ey"
# gpg:
# recipient: "{{ $gpgKeyId }}"
encryption: "age"
age:
identity: "{{ .chezmoi.homeDir }}/.config/age/chezmoi.txt"
recipient: "age1necy24c4lzxheey4p2m8v4q000n442wyv47qc640ulyxx9l8dpesdqv7ey"
gpg:
recipient: "{{ $gpgKeyId }}"
data:
host:
arch: "{{ .chezmoi.arch }}"

View file

@ -2,8 +2,14 @@
XDG_CONFIG_HOME="$HOME/.config"
#if [ ! -f "${XDG_CONFIG_HOME}/age/chezmoi.txt" ]; then
# mkdir -p "${XDG_CONFIG_HOME}/age"
# age --decrypt --output "${XDG_CONFIG_HOME}/age/chezmoi.txt" "{{ .chezmoi.sourceDir }}/chezmoi.txt.age"
# chmod 600 "${XDG_CONFIG_HOME}/age/chezmoi.txt"
#fi
if [ ! -f "${XDG_CONFIG_HOME}/age/chezmoi.txt" ]; then
mkdir -p "${XDG_CONFIG_HOME}/age"
echo "Press CTRL+C if you have not set up your encryption token yet"
age --decrypt --output "${XDG_CONFIG_HOME}/age/chezmoi.txt" "{{ .chezmoi.sourceDir }}/key.txt.age" || EXIT_CODE=$?
if [ -n "$EXIT_CODE" ]; then
echo "Proceeding without decrypting age encryption key stored at ~/.local/share/chezmoi/home/key.txt.age"
echo "To have Chezmoi handle your encryption (so you can store your private files publicly) take a look at https://www.chezmoi.io/user-guide/frequently-asked-questions/encryption/#how-do-i-configure-chezmoi-to-encrypt-files-but-only-request-a-passphrase-the-first-time-chezmoi-init-is-run"
else
chmod 600 "${XDG_CONFIG_HOME}/age/chezmoi.txt"
fi
fi