c430991d41
When the hook is triggered due to an cron job, the path may not contain "/usr/sbin/" and thus the daemon reload is not happening.
31 lines
572 B
Bash
Executable file
31 lines
572 B
Bash
Executable file
#!/bin/bash
|
|
|
|
# post-merge hook for Debian systems
|
|
#
|
|
# 1. copy to .git/hooks
|
|
# 2. to test run ".git/hooks/post-merge"
|
|
# 3. create cronjob running "git pull -q -C /etc/tinc/icvpn/"
|
|
#
|
|
|
|
fail() {
|
|
echo "$1" >&2
|
|
exit 1
|
|
}
|
|
|
|
BASE=$(git rev-parse --show-toplevel)
|
|
TINCCFG=$BASE/tinc.conf
|
|
test -w $TINCCFG || fail "ERR: $TINCCFG is not writeable"
|
|
|
|
sed -i '/^ConnectTo/d' $TINCCFG
|
|
|
|
for HOST in hosts/*; do
|
|
# skip hosts without address
|
|
grep -q '^Address' -- "$HOST" || continue
|
|
|
|
echo "ConnectTo = ${HOST##*/}" >> $TINCCFG
|
|
done
|
|
|
|
/usr/sbin/invoke-rc.d tinc reload icvpn
|
|
|
|
exit 0
|