install.sh: Actually check if $cfg_git_bin provides git-mirror
[girocco/mytab.git] / update-hook
blobe3747f8183e6f72164d6987d0b08473f4cde2d6f
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)"; proj="${proj#$cfg_reporoot/}"; proj="${proj%.git}"
38 # XXX: Sanity check on project name and $USER here? Seems superfluous.
39 if ! perl -I"$basedir" -MGirocco::Project -le 'exit(1) unless Girocco::Project->load("'$proj'")->can_user_push("'$USER'")'; then
40 echo "The user '$USER' does not have push permissions for project '$proj'" >&2
41 echo "You can adjust push permissions at $cfg_webadmurl/editproj.cgi?name=$proj" >&2
42 exit 3
46 exit 0