add the arch argument to ynh_install_nodejs

CF https://github.com/YunoHost/issues/issues/1311#issuecomment-466379366
This commit is contained in:
yalh76 2019-02-22 14:28:08 +01:00 committed by GitHub
parent bca2af3391
commit 7342f894e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)