Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(314)

Side by Side Diff: tools/create_debian_chroot.sh

Issue 193723006: Add script to create a Debian chroot environment (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Long line Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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
11 function usage {
12 USAGE="Usage: $0 i386|amd64 [target dir] [be|dev|<stable version>]]\n
13 \n
14 The first mandatory argument speciifies the CPU architecture using\n
15 the Debian convention (e.g. i386 and amd64).\n
16 \n
17 The second optional argument specifies the destination\n
18 directory. This defaults to 'debian_<architecture>'.\n
19 \n
20 The third optional argument specifies whether the chroot is\n
21 populated with a Dart checkout. Use 'be' for bleeding edge, 'dev'\n
22 for trunk/developer or the specific version number for a stable\n
23 version (e.g. 1.2)."
24
25 echo -e $USAGE
26 exit 1
27 }
28
29 # Expect one to three arguments, architecture, optional directory and
30 # optional channel.
31 if [ $# -lt 1 ] || [ $# -gt 3 ]
32 then
33 usage
34 fi
35
36 ARCH=$1
37
38 if [ -n "$2" ]
39 then
40 CHROOT=$2
41 else
42 CHROOT=debian_$ARCH
43 fi
44
45 if [ -n "$3" ]
46 then
47 CHANNEL=$3
48 fi
49
50 if [ "$ARCH" != "i386" ] && [ "$ARCH" != "amd64" ]
51 then
52 usage
53 fi
54
55 SVN_REPRO="http://dart.googlecode.com/svn/"
56 if [ -n "$CHANNEL" ]
57 then
58 if [ "$CHANNEL" == "be" ]
59 then
60 SVN_PATH="branches/bleeding_edge/deps/all.deps"
61 elif [ "$CHANNEL" == "dev" ]
62 then
63 SVN_PATH="trunk/deps/all.deps"
64 else
65 SVN_PATH="branches/$CHANNEL/deps/all.deps"
66 fi
67 fi
68 SRC_URI=$SVN_REPRO$SVN_PATH
69
70 # Create Debian wheezy chroot.
71 debootstrap --arch=$ARCH --components=main,restricted,universe,multiverse \
72 wheezy $CHROOT http://http.us.debian.org/debian/
73 chroot $CHROOT apt-get update
74 mount -o bind /proc $CHROOT/proc # Needed for openjdk-6-jdk.
75 chroot $CHROOT apt-get -y install \
76 debhelper python g++-4.6 openjdk-6-jdk git subversion
77
78 # Add chrome-bot user.
79 chroot $CHROOT groupadd --gid 1000 chrome-bot
80 chroot $CHROOT useradd --gid 1000 --uid 1000 --create-home chrome-bot
81 mkdir $CHROOT/b
82 chown 1000:1000 $CHROOT/b
83
84 # Create trampoline script for running the initialization as chrome-bot.
85 cat << EOF > $CHROOT/b/init_chroot_trampoline.sh
86 #!/bin/sh
87 su -c /b/init_chroot.sh chrome-bot
88 EOF
89
90 # Create initialization script which does nothing.
91 cat << 'EOF' > $CHROOT/b/init_chroot.sh
92 #!/bin/sh
93 cd /b
94 EOF
95
96 # If the channel is set extend the initialization script to check out
97 # the Dart sources. This uses two cat commands as the first part needs
98 # to bypass variable interpretation.
99 if [ -n "$SRC_URI" ]
100 then
101 cat << 'EOF' >> $CHROOT/b/init_chroot.sh
102 git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
103 export PATH=$PATH:/b/depot_tools
104 EOF
105
106 cat << EOF >> $CHROOT/b/init_chroot.sh
107 gclient config $SRC_URI
108 gclient sync
109 gclient runhooks
110 EOF
111 fi
112
113 chmod 755 $CHROOT/b/init_chroot_trampoline.sh
114
115 chown 1000:1000 $CHROOT/b/init_chroot.sh
116 chmod 755 $CHROOT/b/init_chroot.sh
117 chroot $CHROOT /bin/sh /b/init_chroot_trampoline.sh
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698