@@ -17,6 +17,28 @@ set -u
17
17
18
18
RUSTUP_UPDATE_ROOT=" https://static.rust-lang.org/rustup/dist"
19
19
20
+ # XXX: If you change anything here, please make the same changes in setup_mode.rs
21
+ usage () {
22
+ cat 1>&2 << EOF
23
+ rustup-init 1.0.0 (408ed84 2017-02-11)
24
+ The installer for rustup
25
+
26
+ USAGE:
27
+ rustup-init [FLAGS] [OPTIONS]
28
+
29
+ FLAGS:
30
+ -v, --verbose Enable verbose output
31
+ -y Disable confirmation prompt.
32
+ --no-modify-path Don't configure the PATH environment variable
33
+ -h, --help Prints help information
34
+ -V, --version Prints version information
35
+
36
+ OPTIONS:
37
+ --default-host <default-host> Choose a default host triple
38
+ --default-toolchain <default-toolchain> Choose a default toolchain to install
39
+ EOF
40
+ }
41
+
20
42
main () {
21
43
need_cmd uname
22
44
need_cmd curl
@@ -53,6 +75,23 @@ main() {
53
75
fi
54
76
fi
55
77
78
+ # check if we have to use /dev/tty to prompt the user
79
+ local need_tty=yes
80
+ for arg in " $@ " ; do
81
+ case " $arg " in
82
+ -h|--help)
83
+ usage
84
+ exit 0
85
+ ;;
86
+ -y)
87
+ # user wants to skip the prompt -- we don't need /dev/tty
88
+ need_tty=no
89
+ ;;
90
+ * )
91
+ ;;
92
+ esac
93
+ done
94
+
56
95
if $_ansi_escapes_are_valid ; then
57
96
printf " \33[1minfo:\33[0m downloading installer\n" 1>&2
58
97
else
@@ -68,18 +107,6 @@ main() {
68
107
exit 1
69
108
fi
70
109
71
- # check if we have to use /dev/tty to prompt the user
72
- local need_tty=yes
73
- for arg in " $@ " ; do
74
- case " $arg " in
75
- -y)
76
- # user wants to skip the prompt -- we don't need /dev/tty
77
- need_tty=no
78
- ;;
79
- * )
80
- ;;
81
- esac
82
- done
83
110
84
111
85
112
if [ " $need_tty " = " yes" ]; then
@@ -146,8 +173,10 @@ get_architecture() {
146
173
local _ostype=" $( uname -s) "
147
174
local _cputype=" $( uname -m) "
148
175
149
- if [ " $( uname -o) " = Android ]; then
150
- local _ostype=Android
176
+ if [ " $_ostype " = Linux ]; then
177
+ if [ " $( uname -o) " = Android ]; then
178
+ local _ostype=Android
179
+ fi
151
180
fi
152
181
153
182
if [ " $_ostype " = Darwin -a " $_cputype " = i386 ]; then
0 commit comments