diff --git a/images/linux/scripts/installers/nvm.sh b/images/linux/scripts/installers/nvm.sh new file mode 100644 index 000000000000..cbfab1a89dd4 --- /dev/null +++ b/images/linux/scripts/installers/nvm.sh @@ -0,0 +1,22 @@ +#!/bin/bash +################################################################################ +## File: nvm.sh +## Desc: Installs Nvm +################################################################################ + +# Source the helpers for use with the script +source $HELPER_SCRIPTS/document.sh + +export NVM_DIR="/etc/skel/.nvm" +mkdir $NVM_DIR +curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash +echo 'export NVM_DIR=$HOME/.nvm' | tee -a /etc/skel/.bash_profile +echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm' | tee -a /etc/skel/.bash_profile +[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" + +if ! command -v nvm; then + echo "nvm was not installed" + exit 1 +fi + +DocumentInstalledItem "nvm ($(nvm --version))" \ No newline at end of file diff --git a/images/linux/ubuntu1604.json b/images/linux/ubuntu1604.json index 78a0d804124f..b1d49703c7ea 100644 --- a/images/linux/ubuntu1604.json +++ b/images/linux/ubuntu1604.json @@ -143,6 +143,7 @@ "{{template_dir}}/scripts/installers/1604/basic.sh", "{{template_dir}}/scripts/installers/aws.sh", "{{template_dir}}/scripts/installers/build-essential.sh", + "{{template_dir}}/scripts/installers/nvm.sh", "{{template_dir}}/scripts/installers/clang.sh", "{{template_dir}}/scripts/installers/swift.sh", "{{template_dir}}/scripts/installers/cmake.sh", diff --git a/images/linux/ubuntu1804.json b/images/linux/ubuntu1804.json index 70ab724ab698..53922a241ab6 100644 --- a/images/linux/ubuntu1804.json +++ b/images/linux/ubuntu1804.json @@ -171,6 +171,7 @@ "{{template_dir}}/scripts/installers/miniconda.sh", "{{template_dir}}/scripts/installers/mono.sh", "{{template_dir}}/scripts/installers/mysql.sh", + "{{template_dir}}/scripts/installers/nvm.sh", "{{template_dir}}/scripts/installers/nodejs.sh", "{{template_dir}}/scripts/installers/bazel.sh", "{{template_dir}}/scripts/installers/phantomjs.sh",