From ead2c1aebce292f65ee973c19eb8e3f2b6a1b0b4 Mon Sep 17 00:00:00 2001 From: Steffen Bollmann Date: Mon, 24 Jun 2024 13:30:55 +0200 Subject: [PATCH] fix nvm assumption --- recipes/build.sh | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/recipes/build.sh b/recipes/build.sh index 3bcf9fa..2b27292 100644 --- a/recipes/build.sh +++ b/recipes/build.sh @@ -1,7 +1,14 @@ #!/bin/bash set -e + + # check and install dependencies +if ! command -v pip3 &> /dev/null; then + sudo apt update + sudo apt install -y python3-pip +fi + if ! pip3 show jsonschema &> /dev/null; then pip3 install jsonschema fi @@ -15,16 +22,20 @@ if ! command -v 7z &> /dev/null; then fi if ! command -v mdpdf &> /dev/null; then - export NVM_DIR="$HOME/.nvm" - [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm - if ! command -v mdpdf &> /dev/null; then - curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash - source ~/.bashrc - nvm list-remote - nvm install v22.3.0 - nvm list - npm install mdpdf -g + # check if directory $HOME/.nvm exists: + if [ ! -d "$HOME/.nvm" ]; then + if ! command -v mdpdf &> /dev/null; then + curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash + source ~/.bashrc + nvm list-remote + nvm install v22.3.0 + nvm list + npm install mdpdf -g + fi + else + export NVM_DIR="$HOME/.nvm" + [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm fi fi