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}
30
MIMETYPE=$($FILE -bi "$TARBALL")
32
if [ x"$MIMETYPE" = "xapplication/x-bzip2" ]; then
33
echo "Uncompressing the tarball..."
34
$BUNZIP2 -c < "$TARBALL" > "$TARBALL".tmp
35
mv "$TARBALL".tmp "$TARBALL"
42
echo "Unpacking chroot for build $BUILDID"
43
$SUDO $TAR -xf "$TARBALL"