~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/canonical/buildd/unpack-chroot

  • Committer: Curtis Hovey
  • Date: 2011-08-21 14:21:06 UTC
  • mto: This revision was merged to the branch mainline in revision 13745.
  • Revision ID: curtis.hovey@canonical.com-20110821142106-x93hajd6iguma8gx
Update test that was enforcing bad grammar.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
#
 
3
# Copyright 2009 Canonical Ltd.  This software is licensed under the
 
4
# GNU Affero General Public License version 3 (see the file LICENSE).
 
5
 
 
6
# Buildd Slave tool to unpack a chroot tarball
 
7
 
 
8
# Expects build id as arg 1, makes build-id to contain the build
 
9
# Expects bzip2 compressed tarball as arg 2
 
10
 
 
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)
 
15
 
 
16
export PATH=/usr/bin:/bin:/usr/sbin:/sbin:${PATH}
 
17
 
 
18
NTPDATE=ntpdate
 
19
TAR=tar
 
20
SUDO=sudo
 
21
BUNZIP2=bunzip2
 
22
FILE=file
 
23
 
 
24
BUILDID="$1"
 
25
TARBALL="$2"
 
26
 
 
27
set -e
 
28
 
 
29
exec 2>&1
 
30
 
 
31
MIMETYPE=$($FILE -bi "$TARBALL")
 
32
 
 
33
if [ x"$MIMETYPE" = "xapplication/x-bzip2" ]; then
 
34
  echo "Uncompressing the tarball..."
 
35
  $BUNZIP2 -c < "$TARBALL" > "$TARBALL".tmp
 
36
  mv "$TARBALL".tmp "$TARBALL"
 
37
  exec $0 "$@"
 
38
fi
 
39
 
 
40
if [ -f /etc/launchpad-buildd/default ]; then
 
41
  eval `grep ntphost /etc/launchpad-buildd/default | sed 's/ //g'`
 
42
fi
 
43
if [ -n "$ntphost" ]; then
 
44
  echo "Synching the system clock with the buildd NTP service..."
 
45
  $SUDO $NTPDATE -u $ntphost
 
46
fi
 
47
 
 
48
cd $HOME
 
49
cd "build-$BUILDID"
 
50
 
 
51
echo "Unpacking chroot for build $BUILDID"
 
52
$SUDO $TAR -xf "$TARBALL"