~launchpad-pqm/launchpad/devel

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
#!/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)

case $hostarch in
  hppa|powerpc|sparc)
    CHROOT="linux32 $CHROOT"
    ;;
  amd64)
    if [ "$hostarch" != "$ARCHITECTURETAG" ]; then
      CHROOT="linux32 $CHROOT"
    fi
    ;;
esac

export LANG=C
export DEBIAN_FRONTEND=noninteractive
export TTY=unknown

$SUDO $CHROOT $ROOT $APTGET -uy update < /dev/null
$SUDO $CHROOT $ROOT $APTGET $OPTIONS -uy --purge dist-upgrade < /dev/null