git » repo-mgmt.git » main » tree

[main] / set-git-arr-hook.sh

#!/bin/sh
SRV=/mnt/nfs/git
set -e
mkdir -p $SRV/{sources,{core,base,kde5}-pkgbuilds}

asowner() {
	if [[ -O . ]]; then
		$1
	else
		su builder -c "$1"
	fi
}

doagit() {
	local g=$(basename ${2::-5})
	cd $SRV/$1
	[ ! -e $g.git ] && return 0
	cd $g.git
	[ -e hooks/post-receive ] && return 0
	echo $1/$g
	git config hooks.git-arr-config /sources/repo-mgmt/$5
 	git config hooks.git-arr-output $SRV/$1
	cp /usr/lib/git-arr/hooks/post-receive hooks/post-receive
}

doatree() {
	cd /$1
	local GITS=$(find -mindepth 2 -maxdepth 2 -name '.git' -type d)

	for g in $GITS; do
		doagit $2 $g $1 "$3" $4
	done
}

doatree sources sources "ARMLFS /sources/" git-arr-sources.cfg
for repo in core base kde5; do
	doatree sources/$repo-pkgbuilds $repo-pkgbuilds "$repo " git-arr-$repo.cfg
done

#./git-arr-all.sh