summaryrefslogtreecommitdiff
path: root/generate-mrconfig.sh
blob: d56d3a9d98ed623c8fff1917fadda8b178d011ad (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
35
36
37
38
39
40
#!/bin/sh
# Generate a .mrconfig containing all private repos
# adopted from https://github.com/svend/home-bin/blob/master/gen-mrconfig-priv


# Usage
# ./gen-mrconfig.sh GIT_REPO_URL
#
# Example
# ./gen-mrconfig.sh gitolite@some.ho.st


SSH=$1

gen_mrconfig ()
{
	while read s; do
		echo "[$(basename $s)]"
		echo "checkout = git clone ssh://$SSH/$s"
		echo
	done
}

#ssh $SSH expand |
ssh $SSH  |
# gitolite outputs list with DOS line endings
tr -d '\r' |
# only pick lines with space at the beginning
grep '^ ' |

# Last field contains the repo name
awk '{print $NF}' | 
# filter out all special gitolite groups, i.e. @all
grep -v '^@' |
 
# All private repos are under svend-priv/
#grep -e '^svend-priv/' -e '^gitolite-admin$' | 
gen_mrconfig |
# Delete last empty line
sed '$d'