install.fairie/.config/age/run_once_before_decrypt-private-key.sh.tmpl

14 lines
406 B
Cheetah
Raw Normal View History

#!/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