From 7011b1c879f7290a0f07d73205a13c991046ad5a Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 27 May 2024 16:35:38 +0200 Subject: [PATCH] YNH_APP_HELPERS_DIR -> YNH_HELPERS_DIR --- helpers/helpers | 17 +++++++---------- helpers/helpers.v1.d/nodejs | 2 +- helpers/helpers.v1.d/utils | 2 +- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/helpers/helpers b/helpers/helpers index 1a5e269de..a0d0fb3a9 100644 --- a/helpers/helpers +++ b/helpers/helpers @@ -2,32 +2,29 @@ # Entrypoint for the helpers scripts SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) - if [[ -n "${1:-}" ]]; then # helpers version can be passed as first when sourcing. - YNH_APP_HELPERS_VERSION="$1" -elif [[ -n "${YNH_APP_HELPERS_VERSION:-}" ]]; then - # ...or as environment variable set from manifest - : + YNH_HELPERS_VERSION="$1" else + # ...or as environment variable set from manifest # ...or default to 1 - YNH_APP_HELPERS_VERSION=1 + YNH_HELPERS_VERSION=${YNH_HELPERS_VERSION:-1} fi # This is a trick to later only restore set -x if it was set when calling this script readonly XTRACE_ENABLE=$(set +o | grep xtrace) set +x -YNH_APP_HELPERS_DIR="$SCRIPT_DIR/helpers.v${YNH_APP_HELPERS_VERSION}.d" -case "$YNH_APP_HELPERS_VERSION" in +YNH_HELPERS_DIR="$SCRIPT_DIR/helpers.v${YNH_HELPERS_VERSION}.d" +case "$YNH_HELPERS_VERSION" in 1) - readarray -t HELPERS < <(find "$YNH_APP_HELPERS_DIR" -mindepth 1 -maxdepth 1 -type f) + readarray -t HELPERS < <(find "$YNH_HELPERS_DIR" -mindepth 1 -maxdepth 1 -type f) for helper in "${HELPERS[@]}"; do [ -r "$helper" ] && source "$helper" done ;; *) - echo "Helpers are not available in version '$YNH_APP_HELPERS_VERSION'." >&2 + echo "Helpers are not available in version '$YNH_HELPERS_VERSION'." >&2 exit 1 esac diff --git a/helpers/helpers.v1.d/nodejs b/helpers/helpers.v1.d/nodejs index bb879853b..779f077d0 100644 --- a/helpers/helpers.v1.d/nodejs +++ b/helpers/helpers.v1.d/nodejs @@ -115,7 +115,7 @@ ynh_install_nodejs() { # Install (or update if YunoHost vendor/ folder updated since last install) n mkdir -p $n_install_dir/bin/ - cp "$YNH_APP_HELPERS_DIR/vendor/n/n" $n_install_dir/bin/n + cp "$YNH_HELPERS_DIR/vendor/n/n" $n_install_dir/bin/n # Tweak for n to understand it's installed in $N_PREFIX ynh_replace_string --match_string="^N_PREFIX=\${N_PREFIX-.*}$" --replace_string="N_PREFIX=\${N_PREFIX-$N_PREFIX}" --target_file="$n_install_dir/bin/n" diff --git a/helpers/helpers.v1.d/utils b/helpers/helpers.v1.d/utils index bec3d4972..631e154e2 100644 --- a/helpers/helpers.v1.d/utils +++ b/helpers/helpers.v1.d/utils @@ -318,7 +318,7 @@ ynh_setup_source() { mv $src_filename $dest_dir/$src_rename fi elif [[ "$src_format" == "docker" ]]; then - "$YNH_APP_HELPERS_DIR/vendor/docker-image-extract/docker-image-extract" -p $src_platform -o $dest_dir $src_url 2>&1 + "$YNH_HELPERS_DIR/vendor/docker-image-extract/docker-image-extract" -p $src_platform -o $dest_dir $src_url 2>&1 elif [[ "$src_format" == "zip" ]]; then # Zip format # Using of a temp directory, because unzip doesn't manage --strip-components