summaryrefslogtreecommitdiffstats
path: root/scripts/firstrun/23-repos
blob: c4e2b92751f1d55e6c0d1702e2ca5b322ce1468f (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
41
42
43
44
45
46
# vim:ft=sh:
source config
DESTROOT="${CFG_DIR_WRKSPC}"
VCSCMD=git
POI=$(cat <<-EOF
	gwork/cluster~~~~~~~~~~~~~ssh://git.fedorahosted.org/git/cluster.git
	gwork/cluster-overview~~~~ssh://fedorapeople.org/home/fedora/jpokorny/public_git/cluster-overview.git
	gwork/conga-luci-1stgen~~~ssh://git.fedorahosted.org/git/conga-luci-1stgen.git
	gwork/conga~~~~~~~~~~~~~~~ssh://git.fedorahosted.org/git/conga.git
	gwork/luci~~~~~~~~~~~~~~~~ssh://git.fedorahosted.org/git/luci.git
	gwork/resource-agents~~~~~git://github.com/ClusterLabs/resource-agents.git
	gwork/resource-agents-my~~git@jnpkrn.github.com:jnpkrn/resource-agents.git
	gwork/fence-agents~~~~~~~~git://git.fedorahosted.org/fence-agents.git
	gwork/libqb~~~~~~~~~~~~~~~git://github.com/asalkeld/libqb.git
	gwork/corosync~~~~~~~~~~~~git://github.com/corosync/corosync.git
EOF
)

# grep: suppress also broken pipe message (?)
yum list installed 2>/dev/null | grep -qs ${VCSCMD} \
  || su -c "yum install ${VCSCMD}"

mkdir -p "${DESTROOT}"
pushd "${DESTROOT}" >/dev/null

for pkg in ${POI}; do
	dest=$(echo ${pkg} | tr -s '~' | cut -d~ -f1)
	dname=$(dirname ${dest})
	bname=$(basename ${dest})
	mkdir -p ${dname}
	pushd ${dname} >/dev/null
	echo "bname: ${bname}"
	test -d ${bname} \
	  || ${VCSCMD} clone "$(echo ${pkg} | tr -s '~' | cut -d~ -f2)" ${bname}
	cd ${bname}
	branch=$(${VCSCMD} for-each-ref --count=1 --sort=-committerdate \
	         --format='%(refname:short)' refs/heads/)
	if [ "$(${VCSCMD} rev-parse --abbrev-ref HEAD)" != "${BRANCH}" ]; then
		${VCSCMD} checkout ${branch}
	fi
	popd >/dev/null
done

popd >/dev/null
unset local pkg dest bname dname branch
unset DESTROOT PKGCMD BUILDSYS POI