From 7f59bfef639af42c33654459ca636d0389d20210 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 6 Apr 2022 00:03:14 +0200 Subject: [PATCH] Update ynh_install_nodejs --- scripts/ynh_install_nodejs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/ynh_install_nodejs b/scripts/ynh_install_nodejs index 9df53a4..e3a7588 100644 --- a/scripts/ynh_install_nodejs +++ b/scripts/ynh_install_nodejs @@ -50,7 +50,7 @@ export NODENV_ROOT="$nodenv_install_dir" # # usage: ynh_use_nodejs # -# Requires YunoHost version 2.7.12 or higher. +# Requires YunoHost version 3.2.2 or higher. ynh_use_nodejs () { nodejs_version=$(ynh_app_setting_get --app=$app --key=nodejs_version) @@ -73,6 +73,7 @@ ynh_use_nodejs () { fi # Create an alias to easily load the PATH ynh_node_load_PATH="PATH=$PATH" + # Same var but in lower case to be compatible with ynh_replace_vars... ynh_nodejs_load_path="PATH=$PATH" # Sets the local application-specific Node.js version @@ -96,7 +97,7 @@ ynh_use_nodejs () { # usage: ynh_install_nodejs --nodejs_version=nodejs_version # | arg: -v, --nodejs_version= - Version of Node.js to install. # -# Requires YunoHost version 2.7.12 or higher. +# Requires YunoHost version 3.2.2 or higher. ynh_install_nodejs () { # Declare an array to define the options of this helper. local legacy_args=v @@ -261,7 +262,7 @@ ynh_remove_nodejs () { ynh_cleanup_nodejs () { # List required Node.js versions - local installed_apps=$(yunohost app list | grep -oP 'id: \K.*$') + local installed_apps=$(yunohost app list --output-as json --quiet | jq -r .apps[].id) local required_nodejs_versions="" for installed_app in $installed_apps do @@ -296,6 +297,6 @@ ynh_cleanup_nodejs () { ynh_secure_remove --file="$n_install_dir" ynh_secure_remove --file="/usr/local/n" sed --in-place "/$n_install_dir/d" /root/.bashrc - rm --force /etc/cron.daily/node_update + ynh_secure_remove --file="/etc/cron.daily/node_update" fi }