From 7342f894e5e2087e97ba0a9c2595ccb103e6e6ce Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 22 Feb 2019 14:28:08 +0100 Subject: [PATCH 1/4] add the arch argument to ynh_install_nodejs CF https://github.com/YunoHost/issues/issues/1311#issuecomment-466379366 --- data/helpers.d/nodejs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/data/helpers.d/nodejs b/data/helpers.d/nodejs index c4332b60c..9b16f5729 100644 --- a/data/helpers.d/nodejs +++ b/data/helpers.d/nodejs @@ -64,8 +64,9 @@ ynh_install_nodejs () { # Declare an array to define the options of this helper. local legacy_args=n - declare -Ar args_array=( [n]=nodejs_version= ) + declare -Ar args_array=( [n]=nodejs_version= [a]=arch=) local nodejs_version + local arch # Manage arguments with getopts ynh_handle_getopts_args "$@" @@ -98,7 +99,12 @@ ynh_install_nodejs () { test -x /usr/bin/npm_n && mv /usr/bin/npm_n /usr/bin/npm # Install the requested version of nodejs - n $nodejs_version + if [ -z "$arch" ] + then + n $nodejs_version + else + n $nodejs_version --arch=$arch + fi # Find the last "real" version for this major version of node. real_nodejs_version=$(find $node_version_path/$nodejs_version* -maxdepth 0 | sort --version-sort | tail --lines=1) From 0a84e2f2261ba67d4cc9dc71b430576f80ec726d Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Fri, 22 Feb 2019 15:38:04 +0100 Subject: [PATCH 2/4] Default value for $arch --- data/helpers.d/nodejs | 1 + 1 file changed, 1 insertion(+) diff --git a/data/helpers.d/nodejs b/data/helpers.d/nodejs index 9b16f5729..f48685ece 100644 --- a/data/helpers.d/nodejs +++ b/data/helpers.d/nodejs @@ -69,6 +69,7 @@ ynh_install_nodejs () { local arch # Manage arguments with getopts ynh_handle_getopts_args "$@" + arch=${arch:-} # Create $n_install_dir mkdir -p "$n_install_dir" From 81178e0841d81cf07da56826bda4c16403269a1c Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 22 Feb 2019 17:55:42 +0100 Subject: [PATCH 3/4] remove arguments and let ynh_install_nodejs manage the issue --- data/helpers.d/nodejs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/data/helpers.d/nodejs b/data/helpers.d/nodejs index f48685ece..f277eeef0 100644 --- a/data/helpers.d/nodejs +++ b/data/helpers.d/nodejs @@ -64,12 +64,10 @@ ynh_install_nodejs () { # Declare an array to define the options of this helper. local legacy_args=n - declare -Ar args_array=( [n]=nodejs_version= [a]=arch=) + declare -Ar args_array=( [n]=nodejs_version= ) local nodejs_version - local arch # Manage arguments with getopts ynh_handle_getopts_args "$@" - arch=${arch:-} # Create $n_install_dir mkdir -p "$n_install_dir" @@ -100,11 +98,11 @@ ynh_install_nodejs () { test -x /usr/bin/npm_n && mv /usr/bin/npm_n /usr/bin/npm # Install the requested version of nodejs - if [ -z "$arch" ] + if [[ $uname =~ aarch64 || $uname =~ arm64]] then - n $nodejs_version + n $nodejs_version --arch=arm64 else - n $nodejs_version --arch=$arch + n $nodejs_version fi # Find the last "real" version for this major version of node. From dd287173087e772d45482c47644479c6a336e40d Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 23 Feb 2019 01:23:02 +0100 Subject: [PATCH 4/4] Fix $uname --- data/helpers.d/nodejs | 1 + 1 file changed, 1 insertion(+) diff --git a/data/helpers.d/nodejs b/data/helpers.d/nodejs index f277eeef0..61a1414ef 100644 --- a/data/helpers.d/nodejs +++ b/data/helpers.d/nodejs @@ -98,6 +98,7 @@ ynh_install_nodejs () { test -x /usr/bin/npm_n && mv /usr/bin/npm_n /usr/bin/npm # Install the requested version of nodejs + uname=$(uname -m) if [[ $uname =~ aarch64 || $uname =~ arm64]] then n $nodejs_version --arch=arm64