Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/bin/bash | |
| 2 # Copyright 2016 The Chromium Authors. All rights reserved. | |
| 3 # Use of this source code is governed by a BSD-style license that can be | |
| 4 # found in the LICENSE file. | |
| 5 | |
| 6 set -e | |
| 7 | |
| 8 mkdir cr-infra-go-area | |
| 9 cd cr-infra-go-area | |
| 10 | |
| 11 # Download depot_tools | |
| 12 echo "Getting Chromium depot_tools.." | |
| 13 git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git depot _tools | |
| 14 echo | |
| 15 | |
| 16 echo "Fetching the infra build..." | |
| 17 "$PWD/depot_tools/fetch" infra | |
|
tandrii(chromium)
2016/06/17 09:37:26
I've just tried it with existing and dirty checkou
mithro
2016/06/18 07:13:18
Done.
| |
| 18 | |
| 19 echo "Creating enter script..." | |
| 20 # Create a bashrc include file | |
| 21 ENTER_SCRIPT=$PWD/enter-env.sh | |
| 22 cat > $ENTER_SCRIPT <<EOF | |
| 23 #!/bin/bash | |
| 24 [[ "\${BASH_SOURCE[0]}" != "\${0}" ]] && SOURCED=1 || SOURCED=0 | |
| 25 if [ \$SOURCED = 0 ]; then | |
| 26 exec bash --init-file $ENTER_SCRIPT | |
| 27 fi | |
| 28 | |
| 29 if [ -f ~/.bashrc ]; then . ~/.bashrc; fi | |
| 30 | |
| 31 export DEPOT_TOOLS="$PWD/depot_tools" | |
| 32 export PATH="\$DEPOT_TOOLS:\$PATH" | |
| 33 export PS1="[cr-infra-go-area] \$PS1" | |
|
tandrii(chromium)
2016/06/17 09:37:26
very nice!
Vadim Sh.
2016/06/17 17:38:46
we should add it to go/env.py instead, probably,
mithro
2016/06/18 07:13:17
Acknowledged.
mithro
2016/06/18 07:13:18
I'm unsure the correct way to add this to go/env.p
| |
| 34 | |
| 35 cd $PWD/infra/go | |
| 36 eval \$($PWD/infra/go/env.py) | |
| 37 | |
| 38 echo "Entered cr-infra-go-area setup at '$PWD'" | |
| 39 cd "$PWD" | |
| 40 EOF | |
| 41 chmod a+x $ENTER_SCRIPT | |
| 42 | |
| 43 # Running the env setup for the first time | |
| 44 source $ENTER_SCRIPT | |
| 45 | |
| 46 # Output usage instructions | |
|
tandrii(chromium)
2016/06/17 09:37:26
add extra echo here, so that instruction of what t
mithro
2016/06/18 07:13:18
Done.
| |
| 47 if [ -d ~/bin ]; then | |
| 48 ln -sf $ENTER_SCRIPT ~/bin/cr-infra-go-area-enter | |
|
tandrii(chromium)
2016/06/17 09:37:25
can we bail instead of overwriting existing file i
Eric Burnett
2016/06/17 17:23:31
Up until here the created environment was self-con
Vadim Sh.
2016/06/17 17:38:46
+1
mithro
2016/06/18 07:13:17
Acknowledged.
mithro
2016/06/18 07:13:18
Acknowledged.
mithro
2016/06/18 07:13:18
I've added a "DO NOT MODIFY" header and changed it
| |
| 49 if which cr-infra-go-area-enter; then | |
| 50 echo "Enter the environment by running 'cr-infra-go-area-enter'" | |
| 51 exit 0 | |
| 52 fi | |
| 53 fi | |
| 54 echo "Enter the environment by running '$PWD/enter-env.sh'" | |
|
Eric Burnett
2016/06/17 17:23:31
Reference $ENTER_SCRIPT here for consistency?
mithro
2016/06/18 07:13:18
Done.
| |
| OLD | NEW |