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 | |
|
M-A Ruel
2016/06/21 12:21:44
set -eu
mithro
2016/06/22 04:39:20
Done.
| |
| 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 export PATH="$PWD/depot_tools:$PATH" | |
| 18 fetch infra | |
| 19 | |
| 20 echo "Creating enter script..." | |
| 21 # Create a bashrc include file | |
| 22 ENTER_SCRIPT=$PWD/enter-env.sh | |
| 23 cat > $ENTER_SCRIPT <<EOF | |
| 24 #!/bin/bash | |
| 25 # | |
| 26 # DO NOT MODIFY, THIS IS AUTOMATICALLY GENERATED AND WILL BE OVERWRITTEN | |
| 27 # | |
| 28 [[ "\${BASH_SOURCE[0]}" != "\${0}" ]] && SOURCED=1 || SOURCED=0 | |
| 29 if [ \$SOURCED = 0 ]; then | |
| 30 exec bash --init-file $ENTER_SCRIPT | |
| 31 fi | |
| 32 | |
| 33 if [ -f ~/.bashrc ]; then . ~/.bashrc; fi | |
| 34 | |
| 35 export DEPOT_TOOLS="$PWD/depot_tools" | |
| 36 export PATH="\$DEPOT_TOOLS:\$PATH" | |
| 37 | |
| 38 cd $PWD/infra/go | |
| 39 eval \$($PWD/infra/go/env.py) | |
| 40 | |
| 41 echo "Entered cr-infra-go-area setup at '$PWD'" | |
| 42 cd "$PWD" | |
| 43 EOF | |
| 44 chmod a+x $ENTER_SCRIPT | |
|
M-A Ruel
2016/06/21 12:21:44
add two spaces after EOF, otherwise it makes scann
mithro
2016/06/22 04:39:20
I assume you mean newlines?
Done.
M-A Ruel
2016/06/22 10:26:35
Err yes :)
| |
| 45 | |
| 46 # Running the env setup for the first time | |
| 47 source $ENTER_SCRIPT | |
| 48 | |
| 49 # Output usage instructions | |
| 50 echo "--------------------------------------------------------------------" | |
| 51 echo | |
| 52 if [ -d ~/bin ]; then | |
| 53 BINPATH=~/bin/cr-infra-go-area-enter | |
| 54 read -p "Link the enter script to $BINPATH? " LINKBIN | |
|
Eric Burnett
2016/06/20 14:32:09
the end of the prompt should have "(y|N)" I think.
mithro
2016/06/22 04:39:20
Done.
| |
| 55 case "$LINKBIN" in | |
| 56 y|Y ) | |
| 57 ln -sf $ENTER_SCRIPT $BINPATH | |
| 58 echo "Enter the environment by running 'cr-infra-go-area -enter'" | |
| 59 exit 0 | |
| 60 ;; | |
| 61 * ) | |
| 62 ;; | |
| 63 esac | |
| 64 fi | |
| 65 echo "Enter the environment by running '$ENTER_SCRIPT'" | |
| OLD | NEW |