forked from dodola/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap
executable file
·44 lines (34 loc) · 1.26 KB
/
bootstrap
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
# Copyright 2017 The Fuchsia 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
function usage {
cat <<END
usage: bootstrap [zircon|garnet|peridot|topaz]
Bootstrap a Fuchsia development environment for the given layer. Defaults to
boostraping at the topaz layer. For more information about the Fuchsia layer
cake, see <https://fuchsia.googlesource.com/docs/+/master/development/source_code/layers.md>.
END
}
if [[ $# -gt 1 ]]; then
usage
exit 1
fi
layer=${1:-topaz}
if [[ "${layer}" != "zircon" ]] &&
[[ "${layer}" != "garnet" ]] &&
[[ "${layer}" != "peridot" ]] &&
[[ "${layer}" != "topaz" ]]; then
usage
exit 1
fi
# The fetched script will
# - create "fuchsia" directory if it does not exist,
# - download "jiri" command to "fuchsia/.jiri_root/bin"
curl -s "https://fuchsia.googlesource.com/jiri/+/master/scripts/bootstrap_jiri?format=TEXT" | base64 --decode | bash -s fuchsia
cd fuchsia
.jiri_root/bin/jiri import -name="${layer}" "manifest/${layer}" "https://fuchsia.googlesource.com/${layer}"
.jiri_root/bin/jiri update
echo "Done creating ${layer} development environment at \"$(pwd)\"."
echo "Recommended: export PATH=\"$(pwd)/.jiri_root/bin:\$PATH\""