install.fairie/dotfiles/.local/share/chezmoi/home/.chezmoiscripts/universal/run_once_before_decrypt-age-key.tmpl

9 lines
292 B
Bash

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