From e8d2fb6aaea107eab3073626cc48cb4a58aca77a Mon Sep 17 00:00:00 2001 From: spekulaas Date: Wed, 5 Oct 2022 00:57:10 +0200 Subject: [PATCH] fixed nvm install, used wrong privelages --- src/importantinstalls/node.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/importantinstalls/node.sh b/src/importantinstalls/node.sh index 9e1d260..64e1d8b 100644 --- a/src/importantinstalls/node.sh +++ b/src/importantinstalls/node.sh @@ -1,15 +1,19 @@ +#!/bin/bash -i + # get nvm package wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash # export nvm to env table if [[ $(which zsh) == "/usr/bin/zsh" ]]; then - echo 'export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"' >> ~/.zshrc - echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm' >> ~/.zshrc + sudo -u $SUDO_USER echo 'export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"' >> ~/.zshrc + sudo -u $SUDO_USER echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm' >> ~/.zshrc fi # always put in bashrc aswell, so that the user can always rely on the standard shell -echo 'export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"' >> ~/.bashrc -echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm' >> ~/.bashrc +sudo -u $SUDO_USER echo 'export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"' >> ~/.bashrc +sudo -u $SUDO_USER echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm' >> ~/.bashrc + +source ~/.bashrc # install latest version of node nvm install node \ No newline at end of file