From ee80d1f64cf92263d92e98c3fbb63ffca3cfa8db Mon Sep 17 00:00:00 2001 From: Florian Gareis Date: Tue, 19 Mar 2024 21:09:47 +0100 Subject: [PATCH] Fix `nodejs`: Create directory before executing script (#183) --- nodejs/main.tf | 4 ++-- nodejs/run.sh | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/nodejs/main.tf b/nodejs/main.tf index a4533e4..9c9c5c7 100644 --- a/nodejs/main.tf +++ b/nodejs/main.tf @@ -22,8 +22,8 @@ variable "nvm_version" { variable "nvm_install_prefix" { type = string - description = "The prefix to install nvm to." - default = "$HOME/.nvm" + description = "The prefix to install nvm to (relative to $HOME)." + default = ".nvm" } variable "node_versions" { diff --git a/nodejs/run.sh b/nodejs/run.sh index dd2b49a..78e940a 100755 --- a/nodejs/run.sh +++ b/nodejs/run.sh @@ -10,7 +10,8 @@ RESET='\033[0m' printf "$${BOLD}Installing nvm!$${RESET}\n" -export NVM_DIR="$${INSTALL_PREFIX}/nvm" +export NVM_DIR="$HOME/$${INSTALL_PREFIX}/nvm" +mkdir -p "$NVM_DIR" script="$(curl -sS -o- "https://raw.githubusercontent.com/nvm-sh/nvm/$${NVM_VERSION}/install.sh" 2>&1)" if [ $? -ne 0 ]; then