2 ## (c) Bernhard Tittelbach 2017-10-28, Tschunk-License
3 ## (c) nicoo 2018-05-20, Tschunk-License
4 ## this is the post-recieve hook installed in /home/tuergit/keys.git/hooks/
8 keys_branch=$(git config hooks.keys_branch 2>/dev/null)
9 keys_file=$(git config hooks.keys_file 2>/dev/null)
10 keys_pipe_to=$(git config hooks.keys_pipe_to 2>/dev/null)
12 keys_branch=${keys_branch:-master}
13 keys_file=${keys_file:-keys}
14 keys_pipe_to=${keys_pipe_to:-/usr/local/bin/update-keys-from-stdin.sh}
16 changedcommits=$( grep "refs/heads/${keys_branch}" | sed 's/\([0-9a-f]\+\)\s\+\([0-9a-f]\+\)\s\+.*/\1..\2/;' )
19 git show "${keys_branch}:${keys_file}"
22 if git whatchanged --oneline $changedcommits | grep -qe "^:.*${keys_file}\$"; then
23 echo "./$keys_file changed in pushed commits. Updating keys in firmware!"
25 catgitkeyfile | ${keys_pipe_to}
27 echo "./$keys_file not changed, not updating keys in firmware"