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
|
#!/bin/sh
#
# Copyright 2009 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
# Buildd Slave tool to update a debian chroot
# Expects build id as arg 1, makes build-id to contain the build
# Needs SUDO to be set to a sudo instance for passwordless access
SUDO=/usr/bin/sudo
CHROOT=/usr/sbin/chroot
APTGET=/usr/bin/apt-get
BUILDID="$1"
ARCHITECTURETAG="$2"
ROOT=$HOME/build-$BUILDID/chroot-autobuild
OPTIONS="-o DPkg::Options::=--force-confold"
set -e
exec 2>&1
echo "Updating debian chroot for build $BUILDID"
hostarch=$(dpkg --print-architecture)
UNAME26=""
case $SUITE in
hardy*|lucid*|maverick*|natty*|oneiric*|precise*)
if setarch --help | grep -q uname-2.6; then
UNAME26="--uname-2.6"
fi
;;
esac
case $ARCHITECTURETAG in
armel|armhf|hppa|i386|lpia|mips|mipsel|powerpc|s390|sparc)
CHROOT="linux32 $UNAME26 $CHROOT"
;;
alpha|amd64|arm64|hppa64|ia64|ppc64|ppc64el|s390x|sparc64|x32)
CHROOT="linux64 $UNAME26 $CHROOT"
;;
esac
# Anything more fancy than amd64->ia32 is done with qemu+syscall
# emulation, handled via binfmt.misc hints to the kernel that require
# the statically-compiled qemu binary to appear in the same place both
# inside and outside the chroot.
if [ "$hostarch" != "$ARCHITECTURETAG" ]
then
case "$hostarch" in
i386|amd64|lpia)
case "$ARCHITECTURETAG" in
armel|armhf)
$SUDO /usr/bin/install /usr/bin/qemu-arm-static $ROOT/usr/bin/
;;
arm64)
$SUDO /usr/bin/install /usr/bin/qemu-aarch64-static $ROOT/usr/bin/
;;
esac
;;
esac
fi
export LANG=C
export DEBIAN_FRONTEND=noninteractive
export TTY=unknown
if ! $SUDO $CHROOT $ROOT $APTGET -uy update < /dev/null; then
echo "Waiting 15 seconds and trying again ..." >&2
sleep 15
$SUDO $CHROOT $ROOT $APTGET -uy update < /dev/null
fi
$SUDO $CHROOT $ROOT $APTGET $OPTIONS -uy --purge dist-upgrade < /dev/null
|