summaryrefslogtreecommitdiffstats
path: root/scripts/pungify
blob: 48adb960879b277ed27ab272f32cbc82af70b868 (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/sh -x

# pungify - run pungi on a particular rawhide tree
# needs passed:
#	the tree version (usually a datestamp)
#	the arch
#	the hostname to connect to (can be user@host)
#
# Hosts must have valid mock development configs. More paths are hardcoded in this script than probably should be.

TREE=$1

ARCH=$2

HOST=$3

Hi there.

usage() {
	echo "Usage: pungify <tree> <arch> <host>"
	exit 1
}	

[ -z "$TREE" -o -z "$ARCH" -o -z "$HOST" ] && usage

su mock -c "ssh $HOST /bin/bash --" << EOF
	set -x
	mock -r fedora-devel-$ARCH-core --uniqueext=$TREE init || exit 1
	/usr/sbin/mock-helper yum --installroot /var/lib/mock/fedora-development-$ARCH-core-$TREE/root install pungi nfs-utils setarch || exit 1
	cp /etc/resolv.conf /var/lib/mock/fedora-development-$ARCH-core-$TREE/root/tmp
	setarch $ARCH mock -r fedora-devel-$ARCH-core --uniqueext=$TREE shell -- << EEE
		set -x
		cp /tmp/resolv.conf /etc/
		mkdir -p /tmp/treebuild.$TREE/{output,cache,development}
		cd /tmp/treebuild.$TREE
		touch rawhide.ks
                cat > /etc/yum.conf << EOY
[main]
pkgpolicy=newest
distroverpkg=redhat-release
tolerant=1
exactarch=1
obsoletes=1
gpgcheck=0
reposdir=/var/empty
metadata_expire=1800

[development]
name=Fedora Core - Development
baseurl=file:///tmp/treebuild.$TREE/development/$ARCH/os/
enabled=1
gpgcheck=0
EOY
		mount -t nfs -o ro,nolock ntap-fedora1.fedora.phx.redhat.com:/vol/fedora/build/koji/mash/rawhide-$TREE/development development
		rm -f /var/lib/rpm/__db*
		yum -y upgrade
		mkdir -p output/development/$ARCH/os/
		ln -s /tmp/treebuild.$TREE/development/$ARCH/os/Packages output/development/$ARCH/os/Packages
		ln -s /tmp/treebuild.$TREE/development/$ARCH/os/repodata output/development/$ARCH/os/repodata
		for minor in 0 1 2 3 4 5 6 7 ; do
			mknod /dev/loop\\\$minor b 7 \\\$minor
		done
		pungi -c ./rawhide.ks -B --destdir /tmp/treebuild.$TREE/output --cachedir /tmp/treebuild.$TREE/cache --ver development
		umount development
		rm -f /var/lib/rpm/__db*
		rm -rf output/development/$ARCH/os/{Packages,repodata}
EEE
EOF
# so, so wrong
rsync -vae "ssh -i /var/lib/mock/.ssh/id_dsa" $HOST:/var/lib/mock/fedora-development-$ARCH-core-$TREE/root/tmp/treebuild.$TREE/output/development/$ARCH/os/ /mnt/koji/mash/rawhide-$TREE/development/$ARCH/os/
rsync -vae "ssh -i /var/lib/mock/.ssh/id_dsa" $HOST:/var/lib/mock/fedora-development-$ARCH-core-$TREE/root/tmp/treebuild.$TREE/output/logs/* /mnt/koji/mash/rawhide-$TREE/logs/
su mock -c "ssh $HOST /bin/bash --" << EOF
	set -x
	mock -r fedora-devel-$ARCH-core --uniqueext=$TREE clean
EOF