Standardize hooks, add better key.txt bootstrapper, add update hook to detect --init

This commit is contained in:
2024-11-07 21:59:56 -06:00
parent a55abff9ac
commit a3601e0a35
4 changed files with 24 additions and 11 deletions

11
home/hooks/.init_pre.sh Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/bash
# note: CHEZMOI_UPDATE will be set if this was invoked indirectly by 'chezmoi update --init'
set -eu
# While key.txt is managed by Chezmoi, it's required for encrypted operations and needed to bootstrap other operations.
if [ ! -f ~/key.txt ]; then
rbw get "key.txt (age)" --field notes >>~/key.txt
rbw get "key.txt (age)" --field password >>~/key.txt
echo "key.txt bootstrapped"
fi