abenkbp commited on
Commit
fa6b21f
·
1 Parent(s): 2006d3b
Files changed (2) hide show
  1. data/.env +1 -0
  2. data/setup.sh +463 -0
data/.env CHANGED
@@ -0,0 +1 @@
 
 
1
+ HOME=/home/user/data
data/setup.sh ADDED
@@ -0,0 +1,463 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+
3
+ { # this ensures the entire script is downloaded #
4
+
5
+ nvm_has() {
6
+ type "$1" > /dev/null 2>&1
7
+ }
8
+
9
+ nvm_echo() {
10
+ command printf %s\\n "$*" 2>/dev/null
11
+ }
12
+
13
+ nvm_grep() {
14
+ GREP_OPTIONS='' command grep "$@"
15
+ }
16
+
17
+ nvm_default_install_dir() {
18
+ [ -z "${XDG_CONFIG_HOME-}" ] && printf %s "/home/user/data/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm"
19
+ }
20
+
21
+ nvm_install_dir() {
22
+ if [ -n "$NVM_DIR" ]; then
23
+ printf %s "${NVM_DIR}"
24
+ else
25
+ nvm_default_install_dir
26
+ fi
27
+ }
28
+
29
+ nvm_latest_version() {
30
+ nvm_echo "v0.39.1"
31
+ }
32
+
33
+ nvm_profile_is_bash_or_zsh() {
34
+ local TEST_PROFILE
35
+ TEST_PROFILE="${1-}"
36
+ case "${TEST_PROFILE-}" in
37
+ *"/.bashrc" | *"/.bash_profile" | *"/.zshrc")
38
+ return
39
+ ;;
40
+ *)
41
+ return 1
42
+ ;;
43
+ esac
44
+ }
45
+
46
+ #
47
+ # Outputs the location to NVM depending on:
48
+ # * The availability of $NVM_SOURCE
49
+ # * The method used ("script" or "git" in the script, defaults to "git")
50
+ # NVM_SOURCE always takes precedence unless the method is "script-nvm-exec"
51
+ #
52
+ nvm_source() {
53
+ local NVM_GITHUB_REPO
54
+ NVM_GITHUB_REPO="${NVM_INSTALL_GITHUB_REPO:-nvm-sh/nvm}"
55
+ local NVM_VERSION
56
+ NVM_VERSION="${NVM_INSTALL_VERSION:-$(nvm_latest_version)}"
57
+ local NVM_METHOD
58
+ NVM_METHOD="$1"
59
+ local NVM_SOURCE_URL
60
+ NVM_SOURCE_URL="$NVM_SOURCE"
61
+ if [ "_$NVM_METHOD" = "_script-nvm-exec" ]; then
62
+ NVM_SOURCE_URL="https://raw.githubusercontent.com/${NVM_GITHUB_REPO}/${NVM_VERSION}/nvm-exec"
63
+ elif [ "_$NVM_METHOD" = "_script-nvm-bash-completion" ]; then
64
+ NVM_SOURCE_URL="https://raw.githubusercontent.com/${NVM_GITHUB_REPO}/${NVM_VERSION}/bash_completion"
65
+ elif [ -z "$NVM_SOURCE_URL" ]; then
66
+ if [ "_$NVM_METHOD" = "_script" ]; then
67
+ NVM_SOURCE_URL="https://raw.githubusercontent.com/${NVM_GITHUB_REPO}/${NVM_VERSION}/nvm.sh"
68
+ elif [ "_$NVM_METHOD" = "_git" ] || [ -z "$NVM_METHOD" ]; then
69
+ NVM_SOURCE_URL="https://github.com/${NVM_GITHUB_REPO}.git"
70
+ else
71
+ nvm_echo >&2 "Unexpected value \"$NVM_METHOD\" for \$NVM_METHOD"
72
+ return 1
73
+ fi
74
+ fi
75
+ nvm_echo "$NVM_SOURCE_URL"
76
+ }
77
+
78
+ #
79
+ # Node.js version to install
80
+ #
81
+ nvm_node_version() {
82
+ nvm_echo "$NODE_VERSION"
83
+ }
84
+
85
+ nvm_download() {
86
+ if nvm_has "curl"; then
87
+ curl --fail --compressed -q "$@"
88
+ elif nvm_has "wget"; then
89
+ # Emulate curl with wget
90
+ ARGS=$(nvm_echo "$@" | command sed -e 's/--progress-bar /--progress=bar /' \
91
+ -e 's/--compressed //' \
92
+ -e 's/--fail //' \
93
+ -e 's/-L //' \
94
+ -e 's/-I /--server-response /' \
95
+ -e 's/-s /-q /' \
96
+ -e 's/-sS /-nv /' \
97
+ -e 's/-o /-O /' \
98
+ -e 's/-C - /-c /')
99
+ # shellcheck disable=SC2086
100
+ eval wget $ARGS
101
+ fi
102
+ }
103
+
104
+ install_nvm_from_git() {
105
+ local INSTALL_DIR
106
+ INSTALL_DIR="$(nvm_install_dir)"
107
+ local NVM_VERSION
108
+ NVM_VERSION="${NVM_INSTALL_VERSION:-$(nvm_latest_version)}"
109
+ if [ -n "${NVM_INSTALL_VERSION:-}" ]; then
110
+ # Check if version is an existing ref
111
+ if command git ls-remote "$(nvm_source "git")" "$NVM_VERSION" | nvm_grep -q "$NVM_VERSION" ; then
112
+ :
113
+ # Check if version is an existing changeset
114
+ elif ! nvm_download -o /dev/null "$(nvm_source "script-nvm-exec")"; then
115
+ nvm_echo >&2 "Failed to find '$NVM_VERSION' version."
116
+ exit 1
117
+ fi
118
+ fi
119
+
120
+ local fetch_error
121
+ if [ -d "$INSTALL_DIR/.git" ]; then
122
+ # Updating repo
123
+ nvm_echo "=> nvm is already installed in $INSTALL_DIR, trying to update using git"
124
+ command printf '\r=> '
125
+ fetch_error="Failed to update nvm with $NVM_VERSION, run 'git fetch' in $INSTALL_DIR yourself."
126
+ else
127
+ fetch_error="Failed to fetch origin with $NVM_VERSION. Please report this!"
128
+ nvm_echo "=> Downloading nvm from git to '$INSTALL_DIR'"
129
+ command printf '\r=> '
130
+ mkdir -p "${INSTALL_DIR}"
131
+ if [ "$(ls -A "${INSTALL_DIR}")" ]; then
132
+ # Initializing repo
133
+ command git init "${INSTALL_DIR}" || {
134
+ nvm_echo >&2 'Failed to initialize nvm repo. Please report this!'
135
+ exit 2
136
+ }
137
+ command git --git-dir="${INSTALL_DIR}/.git" remote add origin "$(nvm_source)" 2> /dev/null \
138
+ || command git --git-dir="${INSTALL_DIR}/.git" remote set-url origin "$(nvm_source)" || {
139
+ nvm_echo >&2 'Failed to add remote "origin" (or set the URL). Please report this!'
140
+ exit 2
141
+ }
142
+ else
143
+ # Cloning repo
144
+ command git clone "$(nvm_source)" --depth=1 "${INSTALL_DIR}" || {
145
+ nvm_echo >&2 'Failed to clone nvm repo. Please report this!'
146
+ exit 2
147
+ }
148
+ fi
149
+ fi
150
+ # Try to fetch tag
151
+ if command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" fetch origin tag "$NVM_VERSION" --depth=1 2>/dev/null; then
152
+ :
153
+ # Fetch given version
154
+ elif ! command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" fetch origin "$NVM_VERSION" --depth=1; then
155
+ nvm_echo >&2 "$fetch_error"
156
+ exit 1
157
+ fi
158
+ command git -c advice.detachedHead=false --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" checkout -f --quiet FETCH_HEAD || {
159
+ nvm_echo >&2 "Failed to checkout the given version $NVM_VERSION. Please report this!"
160
+ exit 2
161
+ }
162
+ if [ -n "$(command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" show-ref refs/heads/master)" ]; then
163
+ if command git --no-pager --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" branch --quiet 2>/dev/null; then
164
+ command git --no-pager --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" branch --quiet -D master >/dev/null 2>&1
165
+ else
166
+ nvm_echo >&2 "Your version of git is out of date. Please update it!"
167
+ command git --no-pager --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" branch -D master >/dev/null 2>&1
168
+ fi
169
+ fi
170
+
171
+ nvm_echo "=> Compressing and cleaning up git repository"
172
+ if ! command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" reflog expire --expire=now --all; then
173
+ nvm_echo >&2 "Your version of git is out of date. Please update it!"
174
+ fi
175
+ if ! command git --git-dir="$INSTALL_DIR"/.git --work-tree="$INSTALL_DIR" gc --auto --aggressive --prune=now ; then
176
+ nvm_echo >&2 "Your version of git is out of date. Please update it!"
177
+ fi
178
+ return
179
+ }
180
+
181
+ #
182
+ # Automatically install Node.js
183
+ #
184
+ nvm_install_node() {
185
+ local NODE_VERSION_LOCAL
186
+ NODE_VERSION_LOCAL="$(nvm_node_version)"
187
+
188
+ if [ -z "$NODE_VERSION_LOCAL" ]; then
189
+ return 0
190
+ fi
191
+
192
+ nvm_echo "=> Installing Node.js version $NODE_VERSION_LOCAL"
193
+ nvm install "$NODE_VERSION_LOCAL"
194
+ local CURRENT_NVM_NODE
195
+
196
+ CURRENT_NVM_NODE="$(nvm_version current)"
197
+ if [ "$(nvm_version "$NODE_VERSION_LOCAL")" == "$CURRENT_NVM_NODE" ]; then
198
+ nvm_echo "=> Node.js version $NODE_VERSION_LOCAL has been successfully installed"
199
+ else
200
+ nvm_echo >&2 "Failed to install Node.js $NODE_VERSION_LOCAL"
201
+ fi
202
+ }
203
+
204
+ install_nvm_as_script() {
205
+ local INSTALL_DIR
206
+ INSTALL_DIR="$(nvm_install_dir)"
207
+ local NVM_SOURCE_LOCAL
208
+ NVM_SOURCE_LOCAL="$(nvm_source script)"
209
+ local NVM_EXEC_SOURCE
210
+ NVM_EXEC_SOURCE="$(nvm_source script-nvm-exec)"
211
+ local NVM_BASH_COMPLETION_SOURCE
212
+ NVM_BASH_COMPLETION_SOURCE="$(nvm_source script-nvm-bash-completion)"
213
+
214
+ # Downloading to $INSTALL_DIR
215
+ mkdir -p "$INSTALL_DIR"
216
+ if [ -f "$INSTALL_DIR/nvm.sh" ]; then
217
+ nvm_echo "=> nvm is already installed in $INSTALL_DIR, trying to update the script"
218
+ else
219
+ nvm_echo "=> Downloading nvm as script to '$INSTALL_DIR'"
220
+ fi
221
+ nvm_download -s "$NVM_SOURCE_LOCAL" -o "$INSTALL_DIR/nvm.sh" || {
222
+ nvm_echo >&2 "Failed to download '$NVM_SOURCE_LOCAL'"
223
+ return 1
224
+ } &
225
+ nvm_download -s "$NVM_EXEC_SOURCE" -o "$INSTALL_DIR/nvm-exec" || {
226
+ nvm_echo >&2 "Failed to download '$NVM_EXEC_SOURCE'"
227
+ return 2
228
+ } &
229
+ nvm_download -s "$NVM_BASH_COMPLETION_SOURCE" -o "$INSTALL_DIR/bash_completion" || {
230
+ nvm_echo >&2 "Failed to download '$NVM_BASH_COMPLETION_SOURCE'"
231
+ return 2
232
+ } &
233
+ for job in $(jobs -p | command sort)
234
+ do
235
+ wait "$job" || return $?
236
+ done
237
+ chmod a+x "$INSTALL_DIR/nvm-exec" || {
238
+ nvm_echo >&2 "Failed to mark '$INSTALL_DIR/nvm-exec' as executable"
239
+ return 3
240
+ }
241
+ }
242
+
243
+ nvm_try_profile() {
244
+ if [ -z "${1-}" ] || [ ! -f "${1}" ]; then
245
+ return 1
246
+ fi
247
+ nvm_echo "${1}"
248
+ }
249
+
250
+ #
251
+ # Detect profile file if not specified as environment variable
252
+ # (eg: PROFILE=~/.myprofile)
253
+ # The echo'ed path is guaranteed to be an existing file
254
+ # Otherwise, an empty string is returned
255
+ #
256
+ nvm_detect_profile() {
257
+ if [ "${PROFILE-}" = '/dev/null' ]; then
258
+ # the user has specifically requested NOT to have nvm touch their profile
259
+ return
260
+ fi
261
+
262
+ if [ -n "${PROFILE}" ] && [ -f "${PROFILE}" ]; then
263
+ nvm_echo "${PROFILE}"
264
+ return
265
+ fi
266
+
267
+ local DETECTED_PROFILE
268
+ DETECTED_PROFILE=''
269
+
270
+ if [ "${SHELL#*bash}" != "$SHELL" ]; then
271
+ if [ -f "/home/user/data/.bashrc" ]; then
272
+ DETECTED_PROFILE="/home/user/data/.bashrc"
273
+ elif [ -f "/home/user/data/.bash_profile" ]; then
274
+ DETECTED_PROFILE="/home/user/data/.bash_profile"
275
+ fi
276
+ elif [ "${SHELL#*zsh}" != "$SHELL" ]; then
277
+ if [ -f "/home/user/data/.zshrc" ]; then
278
+ DETECTED_PROFILE="/home/user/data/.zshrc"
279
+ fi
280
+ fi
281
+
282
+ if [ -z "$DETECTED_PROFILE" ]; then
283
+ for EACH_PROFILE in ".profile" ".bashrc" ".bash_profile" ".zshrc"
284
+ do
285
+ if DETECTED_PROFILE="$(nvm_try_profile "/home/user/data/${EACH_PROFILE}")"; then
286
+ break
287
+ fi
288
+ done
289
+ fi
290
+
291
+ if [ -n "$DETECTED_PROFILE" ]; then
292
+ nvm_echo "$DETECTED_PROFILE"
293
+ fi
294
+ }
295
+
296
+ #
297
+ # Check whether the user has any globally-installed npm modules in their system
298
+ # Node, and warn them if so.
299
+ #
300
+ nvm_check_global_modules() {
301
+ local NPM_COMMAND
302
+ NPM_COMMAND="$(command -v npm 2>/dev/null)" || return 0
303
+ [ -n "${NVM_DIR}" ] && [ -z "${NPM_COMMAND%%"$NVM_DIR"/*}" ] && return 0
304
+
305
+ local NPM_VERSION
306
+ NPM_VERSION="$(npm --version)"
307
+ NPM_VERSION="${NPM_VERSION:--1}"
308
+ [ "${NPM_VERSION%%[!-0-9]*}" -gt 0 ] || return 0
309
+
310
+ local NPM_GLOBAL_MODULES
311
+ NPM_GLOBAL_MODULES="$(
312
+ npm list -g --depth=0 |
313
+ command sed -e '/ npm@/d' -e '/ (empty)$/d'
314
+ )"
315
+
316
+ local MODULE_COUNT
317
+ MODULE_COUNT="$(
318
+ command printf %s\\n "$NPM_GLOBAL_MODULES" |
319
+ command sed -ne '1!p' | # Remove the first line
320
+ wc -l | command tr -d ' ' # Count entries
321
+ )"
322
+
323
+ if [ "${MODULE_COUNT}" != '0' ]; then
324
+ # shellcheck disable=SC2016
325
+ nvm_echo '=> You currently have modules installed globally with `npm`. These will no'
326
+ # shellcheck disable=SC2016
327
+ nvm_echo '=> longer be linked to the active version of Node when you install a new node'
328
+ # shellcheck disable=SC2016
329
+ nvm_echo '=> with `nvm`; and they may (depending on how you construct your `$PATH`)'
330
+ # shellcheck disable=SC2016
331
+ nvm_echo '=> override the binaries of modules installed with `nvm`:'
332
+ nvm_echo
333
+
334
+ command printf %s\\n "$NPM_GLOBAL_MODULES"
335
+ nvm_echo '=> If you wish to uninstall them at a later point (or re-install them under your'
336
+ # shellcheck disable=SC2016
337
+ nvm_echo '=> `nvm` Nodes), you can remove them from the system Node as follows:'
338
+ nvm_echo
339
+ nvm_echo ' $ nvm use system'
340
+ nvm_echo ' $ npm uninstall -g a_module'
341
+ nvm_echo
342
+ fi
343
+ }
344
+
345
+ nvm_do_install() {
346
+ if [ -n "${NVM_DIR-}" ] && ! [ -d "${NVM_DIR}" ]; then
347
+ if [ -e "${NVM_DIR}" ]; then
348
+ nvm_echo >&2 "File \"${NVM_DIR}\" has the same name as installation directory."
349
+ exit 1
350
+ fi
351
+
352
+ if [ "${NVM_DIR}" = "$(nvm_default_install_dir)" ]; then
353
+ mkdir "${NVM_DIR}"
354
+ else
355
+ nvm_echo >&2 "You have \$NVM_DIR set to \"${NVM_DIR}\", but that directory does not exist. Check your profile files and environment."
356
+ exit 1
357
+ fi
358
+ fi
359
+ if [ -z "${METHOD}" ]; then
360
+ # Autodetect install method
361
+ if nvm_has git; then
362
+ install_nvm_from_git
363
+ elif nvm_has curl || nvm_has wget; then
364
+ install_nvm_as_script
365
+ else
366
+ nvm_echo >&2 'You need git, curl, or wget to install nvm'
367
+ exit 1
368
+ fi
369
+ elif [ "${METHOD}" = 'git' ]; then
370
+ if ! nvm_has git; then
371
+ nvm_echo >&2 "You need git to install nvm"
372
+ exit 1
373
+ fi
374
+ install_nvm_from_git
375
+ elif [ "${METHOD}" = 'script' ]; then
376
+ if ! nvm_has curl && ! nvm_has wget; then
377
+ nvm_echo >&2 "You need curl or wget to install nvm"
378
+ exit 1
379
+ fi
380
+ install_nvm_as_script
381
+ else
382
+ nvm_echo >&2 "The environment variable \$METHOD is set to \"${METHOD}\", which is not recognized as a valid installation method."
383
+ exit 1
384
+ fi
385
+
386
+ nvm_echo
387
+
388
+ local NVM_PROFILE
389
+ NVM_PROFILE="$(nvm_detect_profile)"
390
+ local PROFILE_INSTALL_DIR
391
+ PROFILE_INSTALL_DIR="$(nvm_install_dir | command sed "s:^/home/user/data:\/home/user/data:")"
392
+
393
+ SOURCE_STR="\\nexport NVM_DIR=\"${PROFILE_INSTALL_DIR}\"\\n[ -s \"\$NVM_DIR/nvm.sh\" ] && \\. \"\$NVM_DIR/nvm.sh\" # This loads nvm\\n"
394
+
395
+ # shellcheck disable=SC2016
396
+ COMPLETION_STR='[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion\n'
397
+ BASH_OR_ZSH=false
398
+
399
+ if [ -z "${NVM_PROFILE-}" ] ; then
400
+ local TRIED_PROFILE
401
+ if [ -n "${PROFILE}" ]; then
402
+ TRIED_PROFILE="${NVM_PROFILE} (as defined in \$PROFILE), "
403
+ fi
404
+ nvm_echo "=> Profile not found. Tried ${TRIED_PROFILE-}~/.bashrc, ~/.bash_profile, ~/.zshrc, and ~/.profile."
405
+ nvm_echo "=> Create one of them and run this script again"
406
+ nvm_echo " OR"
407
+ nvm_echo "=> Append the following lines to the correct file yourself:"
408
+ command printf "${SOURCE_STR}"
409
+ nvm_echo
410
+ else
411
+ if nvm_profile_is_bash_or_zsh "${NVM_PROFILE-}"; then
412
+ BASH_OR_ZSH=true
413
+ fi
414
+ if ! command grep -qc '/nvm.sh' "$NVM_PROFILE"; then
415
+ nvm_echo "=> Appending nvm source string to $NVM_PROFILE"
416
+ command printf "${SOURCE_STR}" >> "$NVM_PROFILE"
417
+ else
418
+ nvm_echo "=> nvm source string already in ${NVM_PROFILE}"
419
+ fi
420
+ # shellcheck disable=SC2016
421
+ if ${BASH_OR_ZSH} && ! command grep -qc '$NVM_DIR/bash_completion' "$NVM_PROFILE"; then
422
+ nvm_echo "=> Appending bash_completion source string to $NVM_PROFILE"
423
+ command printf "$COMPLETION_STR" >> "$NVM_PROFILE"
424
+ else
425
+ nvm_echo "=> bash_completion source string already in ${NVM_PROFILE}"
426
+ fi
427
+ fi
428
+ if ${BASH_OR_ZSH} && [ -z "${NVM_PROFILE-}" ] ; then
429
+ nvm_echo "=> Please also append the following lines to the if you are using bash/zsh shell:"
430
+ command printf "${COMPLETION_STR}"
431
+ fi
432
+
433
+ # Source nvm
434
+ # shellcheck source=/dev/null
435
+ \. "$(nvm_install_dir)/nvm.sh"
436
+
437
+ nvm_check_global_modules
438
+
439
+ nvm_install_node
440
+
441
+ nvm_reset
442
+
443
+ nvm_echo "=> Close and reopen your terminal to start using nvm or run the following to use it now:"
444
+ command printf "${SOURCE_STR}"
445
+ if ${BASH_OR_ZSH} ; then
446
+ command printf "${COMPLETION_STR}"
447
+ fi
448
+ }
449
+
450
+ #
451
+ # Unsets the various functions defined
452
+ # during the execution of the install script
453
+ #
454
+ nvm_reset() {
455
+ unset -f nvm_has nvm_install_dir nvm_latest_version nvm_profile_is_bash_or_zsh \
456
+ nvm_source nvm_node_version nvm_download install_nvm_from_git nvm_install_node \
457
+ install_nvm_as_script nvm_try_profile nvm_detect_profile nvm_check_global_modules \
458
+ nvm_do_install nvm_reset nvm_default_install_dir nvm_grep
459
+ }
460
+
461
+ [ "_$NVM_ENV" = "_testing" ] || nvm_do_install
462
+
463
+ } # this ensures the entire script is downloaded #