install.fairie/.config/age/run_once_before_decrypt-private-key.sh.tmpl
2022-11-30 05:43:19 +00:00

13 lines
406 B
Bash

#!/bin/sh
if [ ! -f "$HOME/.config/age/headless.txt" ]; then
logg 'Generating age public key under `~/.config/age/key.txt`'
age-keygen > "$HOME/.config/age/headless.txt"
fi
if [ -f "{{ .chezmoi.sourceDir }}/key.txt.age" ]; then
# TODO
logg 'Decrypting age key'
age --decrypt --output "$HOME/.config/age/key.txt" "{{ .chezmoi.sourceDir }}/key.txt.age"
chmod 600 "$HOME/.config/age/key.txt"
fi