~cjwatson/launchpad-buildd/improve-depwait

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
#!/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 override sources.list in the chroot with a list of
# archives

# Expects build id as arg 1
# Expects sources.list lines as subsequent args

# Needs SUDO to be set to a sudo instance for passwordless access

set -e
exec 2>&1

SUDO=/usr/bin/sudo

BUILDID="$1"
shift

cd $HOME
cd "build-$BUILDID/chroot-autobuild/etc/apt"

echo "Overriding sources.list in build-$BUILDID"

$SUDO rm -f sources.list.new
(for archive; do
  echo "$archive"
done) | $SUDO tee sources.list.new >/dev/null
$SUDO mv sources.list.new sources.list