From f975e17e151224073b2cd9932b065bc4b30e517c Mon Sep 17 00:00:00 2001 From: Patrick Spek Date: Sun, 4 Dec 2022 11:31:06 +0100 Subject: Use file_rhash to avoid needlessly reloading tinc --- playbooks.d/vpn-tinc/playbook.bash | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'playbooks.d/vpn-tinc/playbook.bash') 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) -- cgit v1.1