aboutsummaryrefslogtreecommitdiff
path: root/lib/hooks.sh
blob: 8d5fc1db29a23301e27b4ddd22ffcadc13a90151 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Functions for hooks

# 1: Name of hook
call_hook() {
	if [ !  -x "hooks/$1.hook" ]; then
		debug "$1.hook was not found. Skipping."
		return
	fi

	debug "Running hook $1"

	hooks/$1.hook 2>&1 | (while read line; do echo [hook: $1] $line; done)
	RET=${PIPESTATUS[0]}

	if [ $RET -ne 0 ]; then
		warning "Hook $1 exitet with code $RET"
	fi
}