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..378150f4336f89559f671107a5998543acca81ee |
--- /dev/null |
+++ b/tools/create_debian_chroot.sh |
@@ -0,0 +1,93 @@ |
+#!/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 Debina wheezy chroot environment for building Dart |
ricow1
2014/03/11 09:14:31
Debina -> Debian
Søren Gjesse
2014/03/19 07:46:58
Done.
|
+# Debian packages. |
+ |
+function usage { |
+ echo "Usage: $0 i386|amd64 be|dev|stable [target dir]" |
+ exit 1 |
+} |
+ |
+# Always expect two arguments, architecture and channel. |
ricow1
2014/03/11 09:14:31
update comment to expect 2 or 3 arguments
Søren Gjesse
2014/03/19 07:46:58
Done.
|
+if [ $# -lt 2 ] || [ $# -gt 3 ] |
+then |
+ usage |
+fi |
+ |
+ARCH=$1 |
+CHANNEL=$2 |
+ |
+if [ "$ARCH" != "i386" ] && [ "$ARCH" != "amd64" ] |
+then |
+ usage |
+fi |
+ |
+if [ "$CHANNEL" != "be" ] && \ |
+ [ "$CHANNEL" != "dev" ] && \ |
+ [ $CHANNEL != "stable" ] |
+then |
+ usage |
+fi |
+ |
+if [ "$CHANNEL" == "be" ] |
+then |
+ SRC_URI="http://dart.googlecode.com/svn/trunk/deps/all.deps" |
ricow1
2014/03/11 09:14:31
bleeding
Søren Gjesse
2014/03/19 07:46:58
Done.
|
+fi |
+if [ "$CHANNEL" == "dev" ] |
+then |
+ SRC_URI="http://dart.googlecode.com/svn/trunk/deps/all.deps" |
+fi |
+if [ "$CHANNEL" == "stable" ] |
+then |
+ SRC_URI="http://dart.googlecode.com/svn/branches/1.2/deps/all.deps" |
ricow1
2014/03/11 09:14:31
this will change every 6 weeks
Søren Gjesse
2014/03/19 07:46:58
Yes, I added this while testing the script, but ma
|
+fi |
+ |
+if [ $# -eq 3 ] |
+then |
+ CHROOT=$3 |
+else |
+ CHROOT=debian_$ARCH |
+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 |
+su -c /b/init_chroot.sh chrome-bot |
+EOF |
+ |
+# Create script for checking out the Dart sources. This uses two cat commands |
+# as the first part needs to bypass variable interpretation. |
+cat << 'EOF' > $CHROOT/b/init_chroot.sh |
+cd /b |
+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 |
+ |
+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 |