From 3b4ee50084036ef1567dc89c4cf70550ed6ff064 Mon Sep 17 00:00:00 2001 From: fsoppelsa Date: Fri, 5 Jul 2013 14:56:49 +0200 Subject: [PATCH 1/5] Root --- install.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index 1da5a5f..42be28e 100755 --- a/install.sh +++ b/install.sh @@ -1,6 +1,10 @@ #!/bin/bash -NVM_DIR="$HOME/.nvm" +if [ `whoami` == 'root' ]; then + NVM_DIR="/usr/local/nvm" +else + NVM_DIR="$HOME/.nvm" +fi if [ -d "$NVM_DIR" ]; then echo "=> NVM is already installed in $NVM_DIR, trying to update" @@ -15,7 +19,9 @@ git clone https://github.com/creationix/nvm.git $NVM_DIR echo # Detect profile file, .bash_profile has precedence over .profile -if [ ! -z "$1" ]; then +if [ `whoami` == 'root' ]; then + PROFILE="/etc/bash.bashrc +elsif [ ! -z "$1" ]; then PROFILE="$1" else if [ -f "$HOME/.bash_profile" ]; then From ac5cc0e1a27e59930f22f2c09cdf19a69a5a1868 Mon Sep 17 00:00:00 2001 From: fsoppelsa Date: Fri, 5 Jul 2013 14:59:47 +0200 Subject: [PATCH 2/5] typo --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 42be28e..609f044 100755 --- a/install.sh +++ b/install.sh @@ -21,7 +21,7 @@ echo # Detect profile file, .bash_profile has precedence over .profile if [ `whoami` == 'root' ]; then PROFILE="/etc/bash.bashrc -elsif [ ! -z "$1" ]; then +elif [ ! -z "$1" ]; then PROFILE="$1" else if [ -f "$HOME/.bash_profile" ]; then From 1239acfb0c4e2056c7291d280be239cd00e830f0 Mon Sep 17 00:00:00 2001 From: fsoppelsa Date: Fri, 5 Jul 2013 15:01:22 +0200 Subject: [PATCH 3/5] typo profile --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 609f044..535d56a 100755 --- a/install.sh +++ b/install.sh @@ -20,7 +20,7 @@ echo # Detect profile file, .bash_profile has precedence over .profile if [ `whoami` == 'root' ]; then - PROFILE="/etc/bash.bashrc + PROFILE="/etc/bash.bashrc" elif [ ! -z "$1" ]; then PROFILE="$1" else From d90a40476143e945aad4561a2d0733c06be7a5b1 Mon Sep 17 00:00:00 2001 From: fsoppelsa Date: Fri, 5 Jul 2013 15:13:20 +0200 Subject: [PATCH 4/5] Permissions --- install.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/install.sh b/install.sh index 535d56a..1b72e2b 100755 --- a/install.sh +++ b/install.sh @@ -31,6 +31,11 @@ else fi fi +# Set permissions for multi user environment +if [ `whoami` == 'root' ]; then + chmod -R u+rwX,g+rwX,o+rX $NVM_DIR +fi + SOURCE_STR="[[ -s "$NVM_DIR/nvm.sh" ]] && . "$NVM_DIR/nvm.sh" # This loads NVM" if [ -z "$PROFILE" ] || [ ! -f "$PROFILE" ] ; then From 8a6dd889f0e757a18f63af47161f8bfd9a9cc270 Mon Sep 17 00:00:00 2001 From: fsoppelsa Date: Fri, 5 Jul 2013 15:14:45 +0200 Subject: [PATCH 5/5] Alias --- install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/install.sh b/install.sh index 1b72e2b..bfddbe3 100755 --- a/install.sh +++ b/install.sh @@ -33,6 +33,7 @@ fi # Set permissions for multi user environment if [ `whoami` == 'root' ]; then + mkdir -p $NVM_DIR/alias chmod -R u+rwX,g+rwX,o+rX $NVM_DIR fi