git » repo-mgmt.git » commit 5dd1aa3

a couple more helpers

author Urja (ARMLFS builder)
2024-07-13 06:55:14 UTC
committer Urja (ARMLFS builder)
2024-07-13 06:55:14 UTC
parent d06d89290cc988a0855b54d92ea9798310e39dd1

a couple more helpers

gits-push.sh +33 -0
set-git-arr-hook.sh +40 -0

diff --git a/gits-push.sh b/gits-push.sh
new file mode 100755
index 0000000..e89cac8
--- /dev/null
+++ b/gits-push.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+asowner() {
+	set -e
+	if [[ -O . ]]; then
+		$1
+	else
+		su builder -c "$1"
+	fi
+	set +e
+}
+
+doagit() {
+	local g=$(basename ${2::-5})
+	echo /$3/$g
+	cd /$3/$g
+	local CMD="git push origin"
+	asowner "$CMD"
+}
+
+doatree() {
+	cd /$1
+	local GITS=$(find -mindepth 2 -maxdepth 2 -name '.git' -type d)
+
+	for g in $GITS; do
+		doagit $2 $g $1 "$3"
+	done
+}
+
+doatree sources sources
+for repo in core base kde5; do
+	doatree sources/$repo-pkgbuilds $repo-pkgbuilds
+done
+
diff --git a/set-git-arr-hook.sh b/set-git-arr-hook.sh
new file mode 100755
index 0000000..efb6d6d
--- /dev/null
+++ b/set-git-arr-hook.sh
@@ -0,0 +1,40 @@
+#!/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