install.sh: Make much less chatty by not passing -v madly everywhere
[girocco.git] / update-hook
blobebf26bf76fe1f5dbb4db49083183218c268a26b7
1 #!/bin/sh
3 # Currently, we just confine the mob user to the mob branch here.
5 # TODO: CIA support. Mailing list notifications support. Generalized
6 # branches push permissions support.
9 ## Girocco::Config::basedir
10 basedir=/home/repo/repomgr
12 set -e
14 if ! [ -x /usr/bin/perl ]; then
15 # We are INSIDE the chroot
17 if [ -O /var/run/mob ]; then
18 if [ x"$1" != x"refs/heads/mob" ]; then
19 echo "The mob user can push only to the 'mob' branch, sorry" >&2
20 exit 1
22 if [ x"$2" = x"0000000000000000000000000000000000000000" ]; then
23 echo "The mob user cannot _create_ the 'mob' branch, sorry" >&2
24 exit 2
28 exit 0
31 # We are NOT inside the chroot
33 . "$basedir"/jobs/shlib.sh
35 if [ "$cfg_permission_control" = "Hooks" ]; then
36 # We have some permission control to do!
37 proj="$(pwd)"
38 proj="${proj#$cfg_reporoot}"
39 # XXX: Sanity check on project name and $USER here? Seems superfluous.
40 if ! perl -I"$basedir" -MGirocco::Project -le 'exit(1) unless Girocco::Project->load("'$proj'")->can_user_push("'$USER'")'; then
41 echo "The user '$USER' does not have push permissions for project '$proj'" >&2
42 echo "You can adjust push permissions at $cfg_webadmurl/editproj.cgi?name=$proj" >&2
43 exit 3
47 exit 0