3
# Copyright 2009 Canonical Ltd. This software is licensed under the
4
# GNU Affero General Public License version 3 (see the file LICENSE).
6
# Buildd Slave tool to unpack a chroot tarball
8
# Expects build id as arg 1, makes build-id to contain the build
9
# Expects bzip2 compressed tarball as arg 2
11
# Needs TAR to be set to a gnu tar instance, that needs bzip2
12
# Needs SUDO to be set to a sudo instance for passwordless access
13
# BUNZIP2 must un-bzip2
14
# FILE must implement the -b and -i arguments (so a Debianish file)
16
export PATH=/usr/bin:/bin:/usr/sbin:/sbin:${PATH}
31
MIMETYPE=$($FILE -bi "$TARBALL")
33
if [ x"$MIMETYPE" = "xapplication/x-bzip2" ]; then
34
echo "Uncompressing the tarball..."
35
$BUNZIP2 -c < "$TARBALL" > "$TARBALL".tmp
36
mv "$TARBALL".tmp "$TARBALL"
40
if [ -f /etc/launchpad-buildd/default ]; then
41
eval `grep ntphost /etc/launchpad-buildd/default | sed 's/ //g'`
43
if [ -n "$ntphost" ]; then
44
echo "Synching the system clock with the buildd NTP service..."
45
$SUDO $NTPDATE -u $ntphost
51
echo "Unpacking chroot for build $BUILDID"
52
$SUDO $TAR -xf "$TARBALL"