File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # nvm is not available as a distro package, installing manually from git to ~/.nvm
4
+
5
+ # install git - required dependency
6
+ if [ ! -f $( which git) ]; then
7
+ curl https://installer.to/git | bash
8
+ fi
9
+
10
+ # https://github.com/nvm-sh/nvm#git-install
11
+ cd ~
12
+ git clone https://github.com/nvm-sh/nvm.git .nvm
13
+ cd ~ /.nvm
14
+ # checkout latest github release
15
+ git checkout ` git describe --abbrev=0 --tags --match " v[0-9]*" $( git rev-list --tags --max-count=1) `
16
+
17
+ cd ~
18
+ for FILE in .bashrc .zshrc .profile
19
+ do
20
+ # if file exists and doesn't already have "NVM_DIR" inside
21
+ if [[ -f $FILE && -z $( cat $FILE | grep NVM_DIR) ]]; then
22
+ # to make nvm accessible on new terminal windows and after a reboot
23
+ echo '
24
+ export NVM_DIR="$HOME/.nvm"
25
+ [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
26
+ [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion' >> $FILE
27
+ fi
28
+ done
29
+
30
+ # to make nvm accessible right after installing
31
+ export NVM_DIR=" $HOME /.nvm"
32
+ [ -s " $NVM_DIR /nvm.sh" ] && \. " $NVM_DIR /nvm.sh" # This loads nvm
33
+ [ -s " $NVM_DIR /bash_completion" ] && \. " $NVM_DIR /bash_completion" # This loads nvm bash_completion
You can’t perform that action at this time.
0 commit comments