summaryrefslogtreecommitdiff
path: root/install-repos
blob: 92d7dbebc342ea8a9dee8052b5e281a3c1691d50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/sh -eu
set -eu

DIR="/data/git"
REPOS="$DIR/*.git"
HOOKS="pre-receive"
dir=`dirname $0`
BASE=`realpath $dir`

for git in $REPOS; do
	if [ -d "$git" ]; then
		cd $git
		name=`basename $git`
		simple=${name%.git}
		echo $name

		# Prepare the repository
		chown -R www:www .
		ln -sf $git $DIR/$simple
		find . -type f -print0 | xargs -0 chmod 660
		find . -type d -print0 | xargs -0 chmod 770

		# Install hooks
		for hook in $HOOKS; do
			ln -sf $BASE/$hook hooks/$hook
		done

		#  Repository settings
		git config core.sharedRepository=0660 || true
		git config receive.denyNonFastforwards=true || true
		touch git-daemon-export-ok
	fi
done