Chromium Code Reviews| Index: go/quicksetup.sh |
| diff --git a/go/quicksetup.sh b/go/quicksetup.sh |
| new file mode 100755 |
| index 0000000000000000000000000000000000000000..aac16ce97c2efd86cb067a06c2a0ea7035bacd31 |
| --- /dev/null |
| +++ b/go/quicksetup.sh |
| @@ -0,0 +1,65 @@ |
| +#!/bin/bash |
| +# Copyright 2016 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +set -e |
|
M-A Ruel
2016/06/21 12:21:44
set -eu
mithro
2016/06/22 04:39:20
Done.
|
| + |
| +mkdir cr-infra-go-area |
| +cd cr-infra-go-area |
| + |
| +# Download depot_tools |
| +echo "Getting Chromium depot_tools.." |
| +git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git depot_tools |
| +echo |
| + |
| +echo "Fetching the infra build..." |
| +export PATH="$PWD/depot_tools:$PATH" |
| +fetch infra |
| + |
| +echo "Creating enter script..." |
| +# Create a bashrc include file |
| +ENTER_SCRIPT=$PWD/enter-env.sh |
| +cat > $ENTER_SCRIPT <<EOF |
| +#!/bin/bash |
| +# |
| +# DO NOT MODIFY, THIS IS AUTOMATICALLY GENERATED AND WILL BE OVERWRITTEN |
| +# |
| +[[ "\${BASH_SOURCE[0]}" != "\${0}" ]] && SOURCED=1 || SOURCED=0 |
| +if [ \$SOURCED = 0 ]; then |
| + exec bash --init-file $ENTER_SCRIPT |
| +fi |
| + |
| +if [ -f ~/.bashrc ]; then . ~/.bashrc; fi |
| + |
| +export DEPOT_TOOLS="$PWD/depot_tools" |
| +export PATH="\$DEPOT_TOOLS:\$PATH" |
| + |
| +cd $PWD/infra/go |
| +eval \$($PWD/infra/go/env.py) |
| + |
| +echo "Entered cr-infra-go-area setup at '$PWD'" |
| +cd "$PWD" |
| +EOF |
| +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 :)
|
| + |
| +# Running the env setup for the first time |
| +source $ENTER_SCRIPT |
| + |
| +# Output usage instructions |
| +echo "--------------------------------------------------------------------" |
| +echo |
| +if [ -d ~/bin ]; then |
| + BINPATH=~/bin/cr-infra-go-area-enter |
| + 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.
|
| + case "$LINKBIN" in |
| + y|Y ) |
| + ln -sf $ENTER_SCRIPT $BINPATH |
| + echo "Enter the environment by running 'cr-infra-go-area-enter'" |
| + exit 0 |
| + ;; |
| + * ) |
| + ;; |
| + esac |
| +fi |
| +echo "Enter the environment by running '$ENTER_SCRIPT'" |