install.sh: remove extraneous trailing ';' characters
[girocco.git] / hooks / post-receive
blobdbfe0f0f812ac21b160e3753c7e2f63a52cf145c
1 #!/bin/sh
3 # Send notification through the taskd socket
5 # Beware, we MAY be running in a chroot!
7 set -e
9 sockpath=/etc/taskd.socket
10 reporoot=/@jailreporoot@
11 authuser="$LOGNAME"
12 cwd="$(pwd)"
13 if [ -x /usr/bin/perl ]; then
14 # Not in chroot...
15 . @basedir@/shlib.sh
17 sockpath="$cfg_chroot$sockpath"
18 reporoot="$cfg_reporoot"
20 # authuser needs to be set if not running in the chroot.
21 # Currently that can only be the case with https push in
22 # which case REMOTE_USER will contain the user name (possibly prefixed
23 # with "/UID=" and suffixed with "/dnQualifier=...").
24 # Fallback is the mirror_user if REMOTE_USER is not set.
25 authuser="${REMOTE_USER#/UID=}"
26 authuser="${authuser%/dnQualifier=*}"
27 [ -n authuser ] || authuser="$cfg_mirror_user"
29 projname="${cwd#$reporoot/}"
31 [ -S "$sockpath" ] || exit 0
33 while read line; do
34 echo "ref-change $authuser ${projname%.git} $line" | /bin/nc.openbsd -w 1 -U "$sockpath"
35 done
37 exit