OLD | NEW |
---|---|
(Empty) | |
1 #!/bin/bash | |
2 # | |
3 # Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | |
4 # for details. All rights reserved. Use of this source code is governed by a | |
5 # BSD-style license that can be found in the LICENSE file. | |
6 # | |
7 # Script to create a Debian wheezy chroot environment for building Dart | |
8 # Debian packages. | |
9 # | |
10 # If the third argument is passed the chroot is populated with a Dart | |
11 # checkout of the specified version. | |
12 | |
13 function usage { | |
14 echo "Usage: $0 i386|amd64 [target dir] [be|dev|<stable version>]]" | |
15 exit 1 | |
16 } | |
17 | |
18 # 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.
| |
19 if [ $# -lt 1 ] || [ $# -gt 3 ] | |
20 then | |
21 usage | |
22 fi | |
23 | |
24 ARCH=$1 | |
25 | |
26 | |
27 #if [ $# -gt 1 ] | |
ricow1
2014/03/19 08:08:33
commented out code
| |
28 if [ -n "$2" ] | |
29 then | |
30 CHROOT=$2 | |
31 else | |
32 CHROOT=debian_$ARCH | |
33 fi | |
34 | |
35 #if [ $# -gt 2 ] | |
ricow1
2014/03/19 08:08:33
commented out code
| |
36 if [ -n "$3" ] | |
37 then | |
38 CHANNEL=$3 | |
39 fi | |
40 | |
41 if [ "$ARCH" != "i386" ] && [ "$ARCH" != "amd64" ] | |
42 then | |
43 usage | |
44 fi | |
45 | |
46 if [ -n "$CHANNEL" ] | |
47 then | |
48 if [ "$CHANNEL" == "be" ] | |
49 then | |
50 SRC_URI="http://dart.googlecode.com/svn/branches/bleeding_edge/deps/all.deps " | |
ricow1
2014/03/19 08:08:33
long line
| |
51 elif [ "$CHANNEL" == "dev" ] | |
52 then | |
53 SRC_URI="http://dart.googlecode.com/svn/trunk/deps/all.deps" | |
54 else | |
55 SRC_URI="http://dart.googlecode.com/svn/branches/$CHANNEL/deps/all.deps" | |
56 fi | |
57 fi | |
58 | |
59 # Create Debian wheezy chroot. | |
60 debootstrap --arch=$ARCH --components=main,restricted,universe,multiverse \ | |
61 wheezy $CHROOT http://http.us.debian.org/debian/ | |
62 chroot $CHROOT apt-get update | |
63 mount -o bind /proc $CHROOT/proc # Needed for openjdk-6-jdk. | |
64 chroot $CHROOT apt-get -y install \ | |
65 debhelper python g++-4.6 openjdk-6-jdk git subversion | |
66 | |
67 # Add chrome-bot user. | |
68 chroot $CHROOT groupadd --gid 1000 chrome-bot | |
69 chroot $CHROOT useradd --gid 1000 --uid 1000 --create-home chrome-bot | |
70 mkdir $CHROOT/b | |
71 chown 1000:1000 $CHROOT/b | |
72 | |
73 # Create trampoline script for running the initialization as chrome-bot. | |
74 cat << EOF > $CHROOT/b/init_chroot_trampoline.sh | |
75 #!/bin/sh | |
76 su -c /b/init_chroot.sh chrome-bot | |
77 EOF | |
78 | |
79 # Create initialization script which does nothing. | |
80 cat << 'EOF' > $CHROOT/b/init_chroot.sh | |
81 #!/bin/sh | |
82 cd /b | |
83 EOF | |
84 | |
85 # If the channel is set extend the initialization script to check out | |
86 # the Dart sources. This uses two cat commands as the first part needs | |
87 # to bypass variable interpretation. | |
88 if [ -n "$SRC_URI" ] | |
89 then | |
90 cat << 'EOF' >> $CHROOT/b/init_chroot.sh | |
91 git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git | |
92 export PATH=$PATH:/b/depot_tools | |
93 EOF | |
94 | |
95 cat << EOF >> $CHROOT/b/init_chroot.sh | |
96 gclient config $SRC_URI | |
97 gclient sync | |
98 gclient runhooks | |
99 EOF | |
100 fi | |
101 | |
102 chmod 755 $CHROOT/b/init_chroot_trampoline.sh | |
103 | |
104 chown 1000:1000 $CHROOT/b/init_chroot.sh | |
105 chmod 755 $CHROOT/b/init_chroot.sh | |
106 chroot $CHROOT /bin/sh /b/init_chroot_trampoline.sh | |
OLD | NEW |