-
-
Notifications
You must be signed in to change notification settings - Fork 1k
/
notes
executable file
·371 lines (330 loc) · 9.41 KB
/
notes
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
#!/usr/bin/env bash
: rvm_scripts_path:${rvm_scripts_path:="$rvm_path/scripts"}
: rvm_user_path:${rvm_user_path:="$rvm_path/user"}
source "$rvm_scripts_path/initialize"
source "$rvm_scripts_path/functions/logging"
source "$rvm_scripts_path/functions/support"
source "$rvm_scripts_path/functions/utility"
rvm_warn "\
In case of problems: ${rvm_notify_clr:-}http://rvm.io/help ${rvm_warn_clr:-}and ${rvm_notify_clr:-}https://twitter.com/rvm_io"
__today_s="$( date +%s 2>/dev/null )"
if
[[ ${__today_s:-1384383600} -lt 1389654000 ]]
then
rvm_warn "\
Help RVM 2.0: ${rvm_notify_clr:-}https://www.bountysource.com/fundraisers/489-rvm-2-0"
fi
unset __today_s
if [[ "$1" == "initial" ]]
then
notes_type=Upgrade
PAGER="\command \cat"
new_notes()
{
\typeset file
file="$rvm_path/config/displayed-notes.txt"
\command \rm -f "${file}"
tee "${file}" > /dev/null
}
important_message()
{
rvm_error "$@"
}
important_redirect()
{
\command \cat - >&2
}
elif [[ "$1" == "upgrade" ]]
then
notes_type=Upgrade
PAGER="\command \cat"
new_notes()
{
\typeset file
file="$rvm_path/config/displayed-notes.txt"
touch "${file}"
tee "${file}.new" | (
diff - "${file}" &&
printf " * No new notes to display.\n" >&2 ||
true
) | __rvm_sed -e '/^[^<]/ d' -e 's/^< //'
printf "\n" >&2
\command \mv -f "${file}.new" "${file}"
}
important_message()
{
rvm_error "$@"
}
important_redirect()
{
\command \cat - >&2
}
else
notes_type=Installation
new_notes()
{
\command \cat
}
important_message()
{
rvm_warn "$@"
}
important_redirect()
{
\command \cat -
}
fi
if [[ "$1" == "upgrade" ]]
then
printf "%b" "
$notes_type Notes:
"
fi
# duplication marker kdfkjkjfdkfjdjkdfkjfdkj
load_custom_flags()
{
if
[[ -s "${rvm_path:-}/user/custom_flags" ]]
then
\typeset __key __value
while IFS== read __key __value
do
eval "export ${__key}=\"\${__value}\""
done < "${rvm_path:-}/user/custom_flags"
fi
}
load_custom_flags
# this block groups generated and static notes,
# to add generated msgs put them below in code
# for general messages put them in docs/upgrade-notes.md
{
if [[ -z "$1" ]]
then
printf "%b" "
$notes_type Notes:
"
fi
if [[ "$rvm_path" == "/usr/local/rvm" ]] || (( UID == 0 ))
then
printf "%b" "
* Please do NOT forget to add your users to the 'rvm' group.
The installer no longer auto-adds root or users to the rvm group. Admins must do this.
Also, please note that group memberships are ONLY evaluated at login time.
This means that users must log out then back in before group membership takes effect!
"
fi
: \
rvm_scripts_path:${rvm_scripts_path:-$rvm_path/scripts}:
\command \cat "$rvm_path/docs/upgrade-notes.md" | __rvm_sed \
-e "s#\${SHELL}#${SHELL}#g" \
-e "s#\${rvm_scripts_path}#${rvm_scripts_path}#g"
printf "\n"
if
[[ ${rvm_ignore_dotfiles_flag:-0} == 0 ]] &&
[[ -f /etc/profile.d/rvm.sh ]] &&
! __rvm_grep rvm_stored_umask /etc/profile.d/rvm.sh >/dev/null
then
important_message "
* WARNING: your RVM loading script \`/etc/profile.d/rvm.sh\` is deprecated
and causes you to have \`umask g+w\` set in your shell,
run \`rvm get head --auto-dotfiles\` again to fix your scripts.
"
fi
if
[[ ! -e /dev/fd ]]
then
important_message "
* WARNING: you are missing '/dev/fd' it is important for shell scripting used by RVM,
You can fix it on most linux systems with:
ln -sf /proc/self/fd /dev/fd
"
fi
if [[ "$rvm_path" == "/usr/share/ruby-rvm" ]]
then
important_message "
* WARNING: You are using apt-get broken RVM, you should now:
sudo apt-get --purge remove ruby-rvm
sudo \command \rm -rf /usr/share/ruby-rvm /etc/rvmrc /etc/profile.d/rvm.sh
open new terminal and validate environment is clean from old rvm settings:
env | __rvm_grep rvm
install RVM:
curl -L https://get.rvm.io | bash -s stable --autolibs=enable
for details check:
http://stackoverflow.com/a/9056395/497756
"
fi
for __var in RUBYOPT RUBYLIB
do
if eval "[[ -n \"\${${__var}:-}\" ]]"
then
important_message "
* WARNING: You have ${__var} set in your current environment.
This may cause rubies to not work as you expect them to as it is not supported
by all of them If errors show up, please try unsetting ${__var} first.
"
fi
done
if
[[ ${rvm_ignore_dotfiles_flag:-0} == 0 ]] &&
[[ -f "$HOME/.profile" ]] && ! [[ "$rvm_path" == "/usr/local/rvm" || $UID == 0 ]]
then
for __var in "$HOME/.bash_profile" "$HOME/.bash_login"
do
if
[[ -f "${__var}" ]]
then
__rvm_grep 'source.*profile' "${__var}" >/dev/null 2>&1 ||
{
important_message "
* WARNING: You have '~/.profile' file, you might want to load it,
to do that add the following line to '${__var}':
source ~/.profile
"
}
break
fi
done
fi
\typeset __user_shell __zsh_version
if
__user_shell="$(__rvm_get_user_shell)" &&
[[ -n "${__user_shell:-}" ]] &&
__zsh_version="$(${__user_shell} -c 'echo $ZSH_VERSION' 2>/dev/null)" &&
[[ -n "${__zsh_version:-}" ]] &&
__rvm_version_compare "${__zsh_version}" -ne 4.3.12 &&
__rvm_version_compare "${__zsh_version}" -lt 5.0.0
then
important_message "
* WARNING: ${__user_shell} version ${__zsh_version} detected - Zsh 4.3.12 / 5.0.0+ is recommended,
with current one errors to be expected - bugs in shell code interpretation.
"
fi
if
[[ -n "${__zsh_version:-}" ]] &&
__rvm_version_compare "${__zsh_version}" -eq 5.0.3
then
important_message "
* WARNING: ${__user_shell} version 5.0.3 detected it is BROKEN, either downgrade or upgrade it,
for details see => https://github.com/rvm/rvm/pull/2431
"
fi
\typeset -a __files
__files=()
for __file in ~/.zlogin ~/.zshrc ~/.bash_profile ~/.bashrc
do
if [[ -f "${__file}" ]]
then __files+=( "${__file}" )
fi
done
if
[[ ${rvm_ignore_dotfiles_flag:-0} == 0 ]] &&
(( ${#__files[@]} )) &&
__rvm_grep -rn '^[^#]*PATH=' "${__files[@]}" |
__rvm_grep -vE '[[:alnum:]_]PATH=|PATH=.*PATH'
then
# account for __rvm_grep not showing file name for just one file checked
if (( ${#__files[*]} == 1 ))
then __file="Your '${__files[*]}'"
else __file="Above files"
fi
important_message "
* WARNING: ${__file} contains \`PATH=\` with no \`\$PATH\` inside, this can break RVM,
for details check https://github.com/rvm/rvm/issues/1351#issuecomment-10939525
to avoid this warning append #PATH.
"
fi | important_redirect
if [[ -n "${GEM_HOME:-}" ]] && ! [[ "${GEM_HOME}" == "$rvm_path/"* ]]
then
important_message "
* WARNING: you have GEM_HOME=\"${GEM_HOME}\" this is conflicting with RVM, make sure to:
unset GEM_HOME
"
fi
if
[[ -f /etc/rvmrc && -s /etc/rvmrc ]] &&
__rvm_grep 'rvm_configure_env=.*/opt/sm' /etc/rvmrc >/dev/null 2>&1
then
important_message "
* WARNING: you have 'rvm_configure_env' in /etc/rvmrc, run the following to fix:
sudo sed -i'' -e \"/rvm_configure_env=.*\/opt\/sm/d\" /etc/rvmrc
rvm autolibs smf
"
fi
if
[[ -z "${rvm_ignore_gemrc_issues:-}" ]]
then
\typeset _check _gemrc _found
_found=0
for _gemrc in "/etc/gemrc" "${HOME}/.gemrc"
do
if
[[ -r "${_gemrc}" ]]
then
for _check in " -n" --user-install gemhome gempath
do
if
__rvm_grep -E -- '^'"${_check}"'|^[^#]*'"${_check}" "${_gemrc}" >/dev/null
then
(( _found++ ))
important_message " * WARNING: Found ${_check} in ${_gemrc}, please remove it, as it will break rubygems in RVM."
fi
done
fi
done
if
(( _found ))
then
important_message " If it is intended or a mistake 'export rvm_ignore_gemrc_issues=1' to avoid this warning.
"
fi
fi
if
[[ -x /usr/local/bin/rvm ]]
then
important_message "
* WARNING: you have '/usr/local/bin/rvm', it's most likely a bug of old installation, in most cases it's safe to remove it:
rm /usr/local/bin/rvm
"
fi
\typeset __found __search_path_gems __search_path_rubies gemset_name __need_a_cleanup=0
for __found in "$rvm_path"/environments/* "$rvm_path"/wrappers/*
do
gemset_name="${__found##*/}"
__search_path_gems="$rvm_path/gems/${gemset_name}"
__search_path_rubies="$rvm_path/rubies/${gemset_name}"
if
[[ -e "$__found" &&
"$gemset_name" != default &&
! -e "$__search_path_gems" &&
! -e "$__search_path_rubies"
]]
then
rvm_debug " found: $__found missing gems: $__search_path_gems or rubies: $__search_path_rubies"
__need_a_cleanup=1
(( ${rvm_debug_flag:-0} == 1 )) || break
fi
done
(( __need_a_cleanup )) ||
for __found in "$rvm_path"/gems/*
do
gemset_name="${__found##*/}"
gemset_name="${gemset_name%@*}"
__search_path_rubies="$rvm_path/rubies/${gemset_name}"
if
[[ -e "$__found" &&
"$gemset_name" != cache &&
! -e "$__search_path_rubies"
]]
then
rvm_debug " found: $__found - missing rubies: $__search_path_rubies"
__need_a_cleanup=1
(( ${rvm_debug_flag:-0} == 1 )) || break
fi
done
if
(( __need_a_cleanup ))
then
important_message " * It looks like some old stuff is laying around RVM, you can cleanup with: rvm cleanup all
"
fi
} | new_notes | eval "${PAGER:-\command \cat}"