| 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 -eu |
| 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 PS1 |
| 36 export DEPOT_TOOLS="$PWD/depot_tools" |
| 37 export PATH="\$DEPOT_TOOLS:\$PATH" |
| 38 export INFRA_PROMPT_TAG="[cr-infra-go-area] " |
| 39 |
| 40 cd $PWD/infra/go |
| 41 eval \$($PWD/infra/go/env.py) |
| 42 |
| 43 echo "Entered cr-infra-go-area setup at '$PWD'" |
| 44 cd "$PWD/infra/go/src" |
| 45 EOF |
| 46 |
| 47 |
| 48 chmod a+x $ENTER_SCRIPT |
| 49 |
| 50 # Running the env setup for the first time |
| 51 source $ENTER_SCRIPT |
| 52 |
| 53 # Output usage instructions |
| 54 echo "--------------------------------------------------------------------" |
| 55 echo |
| 56 if [ -d ~/bin ]; then |
| 57 BINPATH=~/bin/cr-infra-go-area-enter |
| 58 read -p "Link the enter script to $BINPATH? (y|N) " LINKBIN |
| 59 case "$LINKBIN" in |
| 60 y|Y ) |
| 61 ln -sf $ENTER_SCRIPT $BINPATH |
| 62 echo "Enter the environment by running 'cr-infra-go-area
-enter'" |
| 63 exit 0 |
| 64 ;; |
| 65 * ) |
| 66 ;; |
| 67 esac |
| 68 fi |
| 69 echo "Enter the environment by running '$ENTER_SCRIPT'" |
| OLD | NEW |