Skip to content
This repository was archived by the owner on Nov 30, 2023. It is now read-only.

Commit f4776f4

Browse files
committed
Make nvm available to root
1 parent ec95fdb commit f4776f4

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

script-library/node-debian.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,16 @@ mkdir -p ${NVM_DIR}
6060

6161
# Set up non-root user if applicable
6262
if [ "${USERNAME}" != "root" ] && id -u $USERNAME > /dev/null 2>&1; then
63-
# Add NVM init to non-root user
6463
tee -a /home/${USERNAME}/.bashrc /home/${USERNAME}/.zshrc >> /root/.zshrc \
6564
<< EOF
66-
export NVM_DIR="${NVM_DIR}"
67-
[ -s "\$NVM_DIR/nvm.sh" ] && . "\$NVM_DIR/nvm.sh"
68-
[ -s "\$NVM_DIR/bash_completion" ] && . "\$NVM_DIR/bash_completion"
6965
EOF
7066

71-
# Add code to update NVM ownership if UID/GID changes
67+
# Add NVM init and add code to update NVM ownership if UID/GID changes
7268
tee -a /root/.bashrc /root/.zshrc /home/${USERNAME}/.bashrc >> /home/${USERNAME}/.zshrc \
7369
<<EOF
70+
export NVM_DIR="${NVM_DIR}"
71+
[ -s "\$NVM_DIR/nvm.sh" ] && . "\$NVM_DIR/nvm.sh"
72+
[ -s "\$NVM_DIR/bash_completion" ] && . "\$NVM_DIR/bash_completion"
7473
if [ "\$(stat -c '%U' \$NVM_DIR)" != "${USERNAME}" ]; then
7574
sudo chown -R ${USERNAME}:root \$NVM_DIR
7675
fi

0 commit comments

Comments
 (0)