summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Spek <p.spek@tyil.nl>2022-12-04 11:31:06 +0100
committerPatrick Spek <p.spek@tyil.nl>2022-12-04 11:31:06 +0100
commitf975e17e151224073b2cd9932b065bc4b30e517c (patch)
tree2f8f83997f94af11d71ecd113f1bb1cba56b30f9
parent9945b14b03fa226b78ecbb7ddd556fafc0de5748 (diff)
Use file_rhash to avoid needlessly reloading tinc
-rw-r--r--playbooks.d/vpn-tinc/playbook.bash6
1 files changed, 5 insertions, 1 deletions
diff --git a/playbooks.d/vpn-tinc/playbook.bash b/playbooks.d/vpn-tinc/playbook.bash
index 9cce9a6..0112072 100644
--- a/playbooks.d/vpn-tinc/playbook.bash
+++ b/playbooks.d/vpn-tinc/playbook.bash
@@ -98,8 +98,9 @@ playbook_add()
playbook_sync()
{
local dir="$(config "fs.etcdir")/tinc/tyilnet"
- local name="$(tr "." "_" <<< "${BASHTARD_PLATFORM[fqdn]}")"
local host
+ local name="$(tr "." "_" <<< "${BASHTARD_PLATFORM[fqdn]}")"
+ local rhash="$(file_rhash "$dir/hosts")"
info "$BASHTARD_PLAYBOOK" "Regenerating tinc hosts"
rm -fr -- "$dir/hosts"
@@ -115,6 +116,9 @@ playbook_sync()
done
[[ "$BASHTARD_COMMAND" == "add" ]] && return
+ [[ "$rhash" == "$(file_rhash "$dir/hosts")" ]] && return
+
+ info "$BASHTARD_PLAYBOOK" "Reloading service"
case "${BASHTARD_PLATFORM[init]}" in
systemd)