Adds hooks for secrets

This commit is contained in:
Michel Fedde 2025-09-27 15:23:22 +02:00
parent 63fcd502a8
commit 7a56328fad
4 changed files with 50 additions and 11 deletions

28
.config/yadm/hooks/post_pull Executable file
View file

@ -0,0 +1,28 @@
#!/bin/bash
loadSecretsRepo() {
secretsGitPath="ssh://secrets-git-host/neintonine/yadm-config-secrets.git"
secretsFolderPath="$HOME/.local/share/secrets"
configFile="$HOME/.ssh/config"
if [[ -d "$secretsFolderPath/.git" ]]; then
git --git-dir "$secretsFolderPath/.git" --work-tree "$secretsFolderPath" pull --ff-only
return 0
fi
if [[ ! -f "$configFile" ]]; then
echo "Can't find the ssh config file!"
return 1
fi
if ! grep "Host secrets-git-host" "$configFile" >/dev/null; then
echo "Can't find secrets-git-host config"
return 1
fi
git clone "$secretsGitPath" "$secretsFolderPath"
}
echo "# Updating secrets"
loadSecretsRepo
"$secretsFolderPath/deploy.sh"