Chromium Code Reviews| Index: tools/create_debian_chroot.sh |
| diff --git a/tools/create_debian_chroot.sh b/tools/create_debian_chroot.sh |
| new file mode 100755 |
| index 0000000000000000000000000000000000000000..384c8e7da916e7dc5201374e9104513dfed9fb10 |
| --- /dev/null |
| +++ b/tools/create_debian_chroot.sh |
| @@ -0,0 +1,106 @@ |
| +#!/bin/bash |
| +# |
| +# Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| +# for details. All rights reserved. Use of this source code is governed by a |
| +# BSD-style license that can be found in the LICENSE file. |
| +# |
| +# Script to create a Debian wheezy chroot environment for building Dart |
| +# Debian packages. |
| +# |
| +# If the third argument is passed the chroot is populated with a Dart |
| +# checkout of the specified version. |
| + |
| +function usage { |
| + echo "Usage: $0 i386|amd64 [target dir] [be|dev|<stable version>]]" |
| + exit 1 |
| +} |
| + |
| +# Expect two arguments, architecture, channel and optional directory. |
|
Bill Hesse
2014/03/20 10:20:20
optional channel, and optional directory
Søren Gjesse
2014/03/20 10:54:17
Done.
|
| +if [ $# -lt 1 ] || [ $# -gt 3 ] |
| +then |
| + usage |
| +fi |
| + |
| +ARCH=$1 |
| + |
| + |
| +#if [ $# -gt 1 ] |
|
ricow1
2014/03/19 08:08:33
commented out code
|
| +if [ -n "$2" ] |
| +then |
| + CHROOT=$2 |
| +else |
| + CHROOT=debian_$ARCH |
| +fi |
| + |
| +#if [ $# -gt 2 ] |
|
ricow1
2014/03/19 08:08:33
commented out code
|
| +if [ -n "$3" ] |
| +then |
| + CHANNEL=$3 |
| +fi |
| + |
| +if [ "$ARCH" != "i386" ] && [ "$ARCH" != "amd64" ] |
| +then |
| + usage |
| +fi |
| + |
| +if [ -n "$CHANNEL" ] |
| +then |
| + if [ "$CHANNEL" == "be" ] |
| + then |
| + SRC_URI="http://dart.googlecode.com/svn/branches/bleeding_edge/deps/all.deps" |
|
ricow1
2014/03/19 08:08:33
long line
|
| + elif [ "$CHANNEL" == "dev" ] |
| + then |
| + SRC_URI="http://dart.googlecode.com/svn/trunk/deps/all.deps" |
| + else |
| + SRC_URI="http://dart.googlecode.com/svn/branches/$CHANNEL/deps/all.deps" |
| + fi |
| +fi |
| + |
| +# Create Debian wheezy chroot. |
| +debootstrap --arch=$ARCH --components=main,restricted,universe,multiverse \ |
| + wheezy $CHROOT http://http.us.debian.org/debian/ |
| +chroot $CHROOT apt-get update |
| +mount -o bind /proc $CHROOT/proc # Needed for openjdk-6-jdk. |
| +chroot $CHROOT apt-get -y install \ |
| + debhelper python g++-4.6 openjdk-6-jdk git subversion |
| + |
| +# Add chrome-bot user. |
| +chroot $CHROOT groupadd --gid 1000 chrome-bot |
| +chroot $CHROOT useradd --gid 1000 --uid 1000 --create-home chrome-bot |
| +mkdir $CHROOT/b |
| +chown 1000:1000 $CHROOT/b |
| + |
| +# Create trampoline script for running the initialization as chrome-bot. |
| +cat << EOF > $CHROOT/b/init_chroot_trampoline.sh |
| +#!/bin/sh |
| +su -c /b/init_chroot.sh chrome-bot |
| +EOF |
| + |
| +# Create initialization script which does nothing. |
| +cat << 'EOF' > $CHROOT/b/init_chroot.sh |
| +#!/bin/sh |
| +cd /b |
| +EOF |
| + |
| +# If the channel is set extend the initialization script to check out |
| +# the Dart sources. This uses two cat commands as the first part needs |
| +# to bypass variable interpretation. |
| +if [ -n "$SRC_URI" ] |
| +then |
| +cat << 'EOF' >> $CHROOT/b/init_chroot.sh |
| +git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git |
| +export PATH=$PATH:/b/depot_tools |
| +EOF |
| + |
| +cat << EOF >> $CHROOT/b/init_chroot.sh |
| +gclient config $SRC_URI |
| +gclient sync |
| +gclient runhooks |
| +EOF |
| +fi |
| + |
| +chmod 755 $CHROOT/b/init_chroot_trampoline.sh |
| + |
| +chown 1000:1000 $CHROOT/b/init_chroot.sh |
| +chmod 755 $CHROOT/b/init_chroot.sh |
| +chroot $CHROOT /bin/sh /b/init_chroot_trampoline.sh |