blob: aaace452d1335d5dff67245929cf80b8fc6b2bad (
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
#!/bin/bash
#deb version number
suite=saucy
chroot=`mktemp -u --tmpdir=/srv`
version=0.7.2
set -e
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
if test -f ${suite}-crosschroot_${version}-2_all.deb; then
echo "${suite}-crosschroot-${version}-2.deb already exists - perhaps you wanted to bump version?"
read -r -p "Continue and regenerate existing version? [y/N] " a
if [[ "$a" = "y" || "$a" = "Y" ]]; then
:
else
exit 0
fi
fi
if test -z ${chroot}; then
echo "tmpdir nonexistent - bailing"
exit 1
fi
# create the sbuild chroot for target suite
echo "Doing debootstrap"
debootstrap --variant=buildd ${suite} ${chroot}
# and add our little modifications to that chroot
cp configchrootforarch ${chroot}/usr/local/bin/
# set up apt sources and turn off recommends
echo "Configuring apt"
cat <<-EOF > ${chroot}/etc/apt/sources.list.d/linaro-overlay.list
deb http://repo.linaro.org/ubuntu/linaro-overlay ${suite} main
deb-src http://repo.linaro.org/ubuntu/linaro-overlay ${suite} main
EOF
cat <<-EOF > ${chroot}/etc/apt/sources.list
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ ${suite} main universe
deb [arch=armhf,arm64] http://ports.ubuntu.com/ ${suite} main universe
deb-src http://archive.ubuntu.com/ubuntu/ ${suite} main universe
deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ ${suite}-updates main universe
deb [arch=armhf,arm64] http://ports.ubuntu.com/ ${suite}-updates main universe
deb-src http://archive.ubuntu.com/ubuntu/ ${suite}-updates main universe
EOF
cat <<-EOF > ${chroot}/etc/apt/apt.conf.d/30norecommends
APT::Install-Suggests "0";
APT::Install-Recommends "0";
EOF
#and set up an apt key for the linaro archive
echo "Installing apt key"
cp linarorepo.key ${chroot}/
chroot ${chroot} apt-key add linarorepo.key
rm ${chroot}/linarorepo.key
# now pack that up into filesystem structure suitable for use by schroot/sbuild
mkdir -p ${suite}-crosschroot/srv/chroots
mkdir -p ${suite}-crosschroot/etc/schroot/chroot.d
echo "Tarring up chroot"
tar -C ${chroot} -czf ${suite}-crosschroot/srv/chroots/${suite}-cross-buildd.tgz .
#tidy up debootstrapped chroot
if test -z ${chroot}; then
echo "tmpdir nonexistent - avoiding deleting /"
else
rm -rf ${chroot}
fi
#add schroot config file for the chroot tarball
cat <<-EOF > ${suite}-crosschroot/etc/schroot/chroot.d/${suite}-amd64-sbuild
[${suite}-amd64-sbuild]
type=file
description=Ubuntu ${suite}/amd64 autobuilder
file=/srv/chroots/${suite}-cross-buildd.tgz
groups=root,sbuild,ubuntu
root-groups=root,sbuild,ubuntu
EOF
#now pack all that up in a deb using alien
set +e
echo "Packaging result"
rm -rf saucy-crosschroot-${version}
(cd ${suite}-crosschroot; chown -R root: *)
tar -C ${suite}-crosschroot -czvf ${suite}-crosschroot.tgz .
fakeroot alien --version ${version} ${suite}-crosschroot.tgz
|