Adds hooks for secrets
This commit is contained in:
parent
63fcd502a8
commit
7a56328fad
4 changed files with 50 additions and 11 deletions
28
.config/yadm/hooks/post_pull
Executable file
28
.config/yadm/hooks/post_pull
Executable 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"
|
||||
Loading…
Add table
Add a link
Reference in a new issue