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 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.
| |
8 # Debian packages. | |
9 | |
10 function usage { | |
11 echo "Usage: $0 i386|amd64 be|dev|stable [target dir]" | |
12 exit 1 | |
13 } | |
14 | |
15 # 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.
| |
16 if [ $# -lt 2 ] || [ $# -gt 3 ] | |
17 then | |
18 usage | |
19 fi | |
20 | |
21 ARCH=$1 | |
22 CHANNEL=$2 | |
23 | |
24 if [ "$ARCH" != "i386" ] && [ "$ARCH" != "amd64" ] | |
25 then | |
26 usage | |
27 fi | |
28 | |
29 if [ "$CHANNEL" != "be" ] && \ | |
30 [ "$CHANNEL" != "dev" ] && \ | |
31 [ $CHANNEL != "stable" ] | |
32 then | |
33 usage | |
34 fi | |
35 | |
36 if [ "$CHANNEL" == "be" ] | |
37 then | |
38 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.
| |
39 fi | |
40 if [ "$CHANNEL" == "dev" ] | |
41 then | |
42 SRC_URI="http://dart.googlecode.com/svn/trunk/deps/all.deps" | |
43 fi | |
44 if [ "$CHANNEL" == "stable" ] | |
45 then | |
46 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
| |
47 fi | |
48 | |
49 if [ $# -eq 3 ] | |
50 then | |
51 CHROOT=$3 | |
52 else | |
53 CHROOT=debian_$ARCH | |
54 fi | |
55 | |
56 # Create Debian wheezy chroot. | |
57 debootstrap --arch=$ARCH --components=main,restricted,universe,multiverse \ | |
58 wheezy $CHROOT http://http.us.debian.org/debian/ | |
59 chroot $CHROOT apt-get update | |
60 mount -o bind /proc $CHROOT/proc # Needed for openjdk-6-jdk. | |
61 chroot $CHROOT apt-get -y install \ | |
62 debhelper python g++-4.6 openjdk-6-jdk git subversion | |
63 | |
64 # Add chrome-bot user. | |
65 chroot $CHROOT groupadd --gid 1000 chrome-bot | |
66 chroot $CHROOT useradd --gid 1000 --uid 1000 --create-home chrome-bot | |
67 mkdir $CHROOT/b | |
68 chown 1000:1000 $CHROOT/b | |
69 | |
70 # Create trampoline script for running the initialization as chrome-bot. | |
71 cat << EOF > $CHROOT/b/init_chroot_trampoline.sh | |
72 su -c /b/init_chroot.sh chrome-bot | |
73 EOF | |
74 | |
75 # Create script for checking out the Dart sources. This uses two cat commands | |
76 # as the first part needs to bypass variable interpretation. | |
77 cat << 'EOF' > $CHROOT/b/init_chroot.sh | |
78 cd /b | |
79 git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git | |
80 export PATH=$PATH:/b/depot_tools | |
81 EOF | |
82 | |
83 cat << EOF >> $CHROOT/b/init_chroot.sh | |
84 gclient config $SRC_URI | |
85 gclient sync | |
86 gclient runhooks | |
87 EOF | |
88 | |
89 chmod 755 $CHROOT/b/init_chroot_trampoline.sh | |
90 | |
91 chown 1000:1000 $CHROOT/b/init_chroot.sh | |
92 chmod 755 $CHROOT/b/init_chroot.sh | |
93 chroot $CHROOT /bin/sh /b/init_chroot_trampoline.sh | |
OLD | NEW |