diff --git a/helpers/helpers.v2.1.d/apt b/helpers/helpers.v2.1.d/apt index 03a645611..2cc1e33d1 100644 --- a/helpers/helpers.v2.1.d/apt +++ b/helpers/helpers.v2.1.d/apt @@ -1,6 +1,6 @@ #!/bin/bash -YNH_INSTALL_APT_DEPENDENCIES_REPLACE="true" +YNH_APT_INSTALL_DEPENDENCIES_REPLACE="true" # Define and install dependencies with a equivs control file # @@ -15,7 +15,7 @@ YNH_INSTALL_APT_DEPENDENCIES_REPLACE="true" # | arg: "dep1|dep2|…" - You can specify alternatives. It will require to install (dep1 or dep2, etc). # # Requires YunoHost version 2.6.4 or higher. -ynh_install_apt_dependencies() { +ynh_apt_install_dependencies() { local dependencies=$@ # Add a comma for each space between packages. But not add a comma if the space separate a version specification. (See below) dependencies="$(echo "$dependencies" | sed 's/\([^\<=\>]\)\ \([^(]\)/\1, \2/g')" @@ -86,9 +86,9 @@ ynh_install_apt_dependencies() { # upgrade script where ynh_install_app_dependencies is called with this # expected effect) Otherwise, any subsequent call will add dependencies # to those already present in the equivs control file. - if [[ $YNH_INSTALL_APT_DEPENDENCIES_REPLACE == "true" ]] + if [[ $YNH_APT_INSTALL_DEPENDENCIES_REPLACE == "true" ]] then - YNH_INSTALL_APT_DEPENDENCIES_REPLACE="false" + YNH_APT_INSTALL_DEPENDENCIES_REPLACE="false" else local current_dependencies="" if _ynh_apt_package_is_installed "${app_ynh_deps}" @@ -165,10 +165,10 @@ EOF # # Dependencies will removed only if no other package need them. # -# usage: ynh_remove_apt_dependencies +# usage: ynh_apt_remove_dependencies # # Requires YunoHost version 2.6.4 or higher. -ynh_remove_apt_dependencies() { +ynh_apt_remove_dependencies() { local app_ynh_deps="${app//_/-}-ynh-deps" # Replace all '_' by '-', and append -ynh-deps local current_dependencies="" @@ -197,13 +197,13 @@ ynh_remove_apt_dependencies() { # # [packagingv1] # -# usage: ynh_install_extra_apt_dependencies --repo="repo" --package="dep1 dep2" --key=key_url +# usage: ynh_apt_install_dependencies_from_extra_repository --repo="repo" --package="dep1 dep2" --key=key_url # | arg: -r, --repo= - Complete url of the extra repository. # | arg: -p, --package= - The packages to install from this extra repository # | arg: -k, --key= - url to get the public key. # # Requires YunoHost version 3.8.1 or higher. -ynh_install_extra_apt_dependencies() { +ynh_apt_install_dependencies_from_extra_repository() { # ============ Argument parsing ============= local -A args_array=([r]=repo= [p]=package= [k]=key=) local repo @@ -241,16 +241,16 @@ EOF # Update the list of package with the new repo NB: we use -o # Dir::Etc::sourcelist to only refresh this repo, because - # ynh_install_apt_dependencies will also call an ynh_apt update on its own + # ynh_apt_install_dependencies will also call an ynh_apt update on its own # and it's good to limit unecessary requests ... Here we mainly want to # validate that the url+key is correct before going further _ynh_apt update -o Dir::Etc::sourcelist="/etc/apt/sources.list.d/$app.list" # Install requested dependencies from this extra repository. - # NB: because of the mechanism with $YNH_INSTALL_APT_DEPENDENCIES_REPLACE, + # NB: because of the mechanism with $ynh_apt_install_DEPENDENCIES_REPLACE, # this will usually only *append* to the existing list of dependency, not # replace the existing $app-ynh-deps - ynh_install_apt_dependencies "$package" + ynh_apt_install_dependencies "$package" # Force to upgrade to the last version... # Without doing apt install, an already installed dep is not upgraded diff --git a/helpers/helpers.v2.1.d/backup b/helpers/helpers.v2.1.d/backup index 642c66e65..c0acbaa8d 100644 --- a/helpers/helpers.v2.1.d/backup +++ b/helpers/helpers.v2.1.d/backup @@ -307,12 +307,3 @@ ynh_delete_file_checksum() { local checksum_setting_name=checksum_${file//[\/ ]/_} # Replace all '/' and ' ' by '_' ynh_app_setting_delete --key=$checksum_setting_name } - -# Checks a backup archive exists -# -# [internal] -# -ynh_backup_archive_exists() { - yunohost backup list --output-as json --quiet \ - | jq -e --arg archive "$1" '.archives | index($archive)' >/dev/null -} diff --git a/helpers/helpers.v2.1.d/fail2ban b/helpers/helpers.v2.1.d/fail2ban index cfc768e13..de3636f3b 100644 --- a/helpers/helpers.v2.1.d/fail2ban +++ b/helpers/helpers.v2.1.d/fail2ban @@ -2,15 +2,15 @@ # Create a dedicated fail2ban config (jail and filter conf files) # -# usage 1: ynh_add_fail2ban_config --logpath=log_file --failregex=filter +# usage 1: ynh_config_add_fail2ban --logpath=log_file --failregex=filter # | arg: -l, --logpath= - Log file to be checked by fail2ban # | arg: -r, --failregex= - Failregex to be looked for by fail2ban # -# usage 2: ynh_add_fail2ban_config +# usage 2: ynh_config_add_fail2ban # | arg: -t, --use_template - Use this helper in template mode # # This will use a template in `../conf/f2b_jail.conf` and `../conf/f2b_filter.conf` -# See the documentation of `ynh_add_config` for a description of the template +# See the documentation of `ynh_config_add` for a description of the template # format and how placeholders are replaced with actual variables. # # Generally your template will look like that by example (for synapse): @@ -55,7 +55,7 @@ # ``` # # Requires YunoHost version 4.1.0 or higher. -ynh_add_fail2ban_config() { +ynh_config_add_fail2ban() { # ============ Argument parsing ============= local -A args_array=([l]=logpath= [r]=failregex=) local logpath @@ -65,7 +65,7 @@ ynh_add_fail2ban_config() { # If failregex is provided, Build a config file on-the-fly using $logpath and $failregex if [[ -n "${failregex:-}" ]]; then - test -n "$logpath" || ynh_die --message="ynh_add_fail2ban_config expects a logfile path as first argument and received nothing." + test -n "$logpath" || ynh_die --message="ynh_config_add_fail2ban expects a logfile path as first argument and received nothing." echo " [__APP__] @@ -85,8 +85,8 @@ ignoreregex = " >"$YNH_APP_BASEDIR/conf/f2b_filter.conf" fi - ynh_add_config --template="f2b_jail.conf" --destination="/etc/fail2ban/jail.d/$app.conf" - ynh_add_config --template="f2b_filter.conf" --destination="/etc/fail2ban/filter.d/$app.conf" + ynh_config_add --template="f2b_jail.conf" --destination="/etc/fail2ban/jail.d/$app.conf" + ynh_config_add --template="f2b_filter.conf" --destination="/etc/fail2ban/filter.d/$app.conf" # if "$logpath" doesn't exist (as if using --use_template argument), assign # "$logpath" using the one in the previously generated fail2ban conf file @@ -116,10 +116,10 @@ ignoreregex = # Remove the dedicated fail2ban config (jail and filter conf files) # -# usage: ynh_remove_fail2ban_config +# usage: ynh_config_remove_fail2ban # # Requires YunoHost version 3.5.0 or higher. -ynh_remove_fail2ban_config() { +ynh_config_remove_fail2ban() { ynh_safe_rm "/etc/fail2ban/jail.d/$app.conf" ynh_safe_rm "/etc/fail2ban/filter.d/$app.conf" ynh_systemd_action --service=fail2ban --action=reload diff --git a/helpers/helpers.v2.1.d/go b/helpers/helpers.v2.1.d/go index 12c089744..d28c396e9 100644 --- a/helpers/helpers.v2.1.d/go +++ b/helpers/helpers.v2.1.d/go @@ -48,12 +48,12 @@ _ynh_load_go_in_path_and_other_tweaks() { # When not possible (e.g. in systemd service definition), please use direct path # to goenv shims (e.g. $goenv_ROOT/shims/bundle) # -# usage: ynh_install_go +# usage: ynh_go_install # # Requires YunoHost version 3.2.2 or higher. -ynh_install_go () { +ynh_go_install () { - [[ -n "${go_version:-}" ]] || ynh_die --message="\$go_version should be defined prior to calling ynh_install_go" + [[ -n "${go_version:-}" ]] || ynh_die --message="\$go_version should be defined prior to calling ynh_go_install" # Load goenv path in PATH local CLEAR_PATH="$goenv_install_dir/bin:$PATH" @@ -118,7 +118,7 @@ ynh_install_go () { go_version=$final_go_version # Cleanup Go versions - ynh_cleanup_go + _ynh_go_cleanup # Set environment for Go users echo "#goenv @@ -137,8 +137,8 @@ eval \"\$(goenv init -)\" # # This helper will also cleanup Go versions # -# usage: ynh_remove_go -ynh_remove_go () { +# usage: ynh_go_remove +ynh_go_remove () { local go_version=$(ynh_app_setting_get --key="go_version") # Load goenv path in PATH @@ -151,7 +151,7 @@ ynh_remove_go () { ynh_app_setting_delete --key="go_version" # Cleanup Go versions - ynh_cleanup_go + _ynh_go_cleanup } # Remove no more needed versions of Go used by the app. @@ -160,8 +160,8 @@ ynh_remove_go () { # and uninstall them # If no app uses Go, goenv will be also removed. # -# usage: ynh_cleanup_go -ynh_cleanup_go () { +# usage: _ynh_go_cleanup +_ynh_go_cleanup () { # List required Go versions local installed_apps=$(yunohost app list --output-as json --quiet | jq -r .apps[].id) diff --git a/helpers/helpers.v2.1.d/logrotate b/helpers/helpers.v2.1.d/logrotate index c81e43d0c..5fce19d0b 100644 --- a/helpers/helpers.v2.1.d/logrotate +++ b/helpers/helpers.v2.1.d/logrotate @@ -4,7 +4,7 @@ FIRST_CALL_TO_LOGROTATE="true" # Add a logrotate configuration to manage log files / log directory # -# usage: ynh_add_logrotate_config [/path/to/log/file/or/folder] +# usage: ynh_config_add_logrotate [/path/to/log/file/or/folder] # # If not argument is provided, `/var/log/$app/*.log` is used as default. # @@ -12,7 +12,7 @@ FIRST_CALL_TO_LOGROTATE="true" # (ie it doesnt come from a specific app template like nginx or systemd conf) # # Requires YunoHost version 2.6.4 or higher. -ynh_add_logrotate_config() { +ynh_config_add_logrotate() { logfile="$1" @@ -70,7 +70,7 @@ EOF # usage: ynh_remove_logrotate # # Requires YunoHost version 2.6.4 or higher. -ynh_remove_logrotate_config() { +ynh_config_remove_logrotate() { if [ -e "/etc/logrotate.d/$app" ]; then rm "/etc/logrotate.d/$app" fi diff --git a/helpers/helpers.v2.1.d/nginx b/helpers/helpers.v2.1.d/nginx index 3a931fca8..b3b2836ae 100644 --- a/helpers/helpers.v2.1.d/nginx +++ b/helpers/helpers.v2.1.d/nginx @@ -2,13 +2,13 @@ # Create a dedicated nginx config # -# usage: ynh_add_nginx_config +# usage: ynh_config_add_nginx # # This will use a template in `../conf/nginx.conf` -# See the documentation of `ynh_add_config` for a description of the template +# See the documentation of `ynh_config_add` for a description of the template # format and how placeholders are replaced with actual variables. # -# Additionally, ynh_add_nginx_config will replace: +# Additionally, ynh_config_add_nginx will replace: # - `#sub_path_only` by empty string if `path` is not `'/'` # - `#root_path_only` by empty string if `path` *is* `'/'` # @@ -16,11 +16,11 @@ # location # # Requires YunoHost version 4.1.0 or higher. -ynh_add_nginx_config() { +ynh_config_add_nginx() { local finalnginxconf="/etc/nginx/conf.d/$domain.d/$app.conf" - ynh_add_config --template="nginx.conf" --destination="$finalnginxconf" + ynh_config_add --template="nginx.conf" --destination="$finalnginxconf" if [ "${path:-}" != "/" ]; then ynh_replace --match="^#sub_path_only" --replace="" --file="$finalnginxconf" @@ -35,10 +35,10 @@ ynh_add_nginx_config() { # Remove the dedicated nginx config # -# usage: ynh_remove_nginx_config +# usage: ynh_config_remove_nginx # # Requires YunoHost version 2.7.2 or higher. -ynh_remove_nginx_config() { +ynh_config_remove_nginx() { ynh_safe_rm "/etc/nginx/conf.d/$domain.d/$app.conf" ynh_systemd_action --service=nginx --action=reload } @@ -46,14 +46,14 @@ ynh_remove_nginx_config() { # Regen the nginx config in a change url context # -# usage: ynh_change_url_nginx_config +# usage: ynh_config_change_url_nginx # # Requires YunoHost version 11.1.9 or higher. -ynh_change_url_nginx_config() { +ynh_config_change_url_nginx() { # Make a backup of the original NGINX config file if manually modified # (nb: this is possibly different from the same instruction called by - # ynh_add_config inside ynh_add_nginx_config because the path may have + # ynh_config_add inside ynh_config_add_nginx because the path may have # changed if we're changing the domain too...) local old_nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf ynh_backup_if_checksum_is_different --file="$old_nginx_conf_path" @@ -61,5 +61,5 @@ ynh_change_url_nginx_config() { ynh_safe_rm "$old_nginx_conf_path" # Regen the nginx conf - ynh_add_nginx_config + ynh_config_add_nginx } diff --git a/helpers/helpers.v2.1.d/nodejs b/helpers/helpers.v2.1.d/nodejs index 0b8788409..e47ab9eb0 100644 --- a/helpers/helpers.v2.1.d/nodejs +++ b/helpers/helpers.v2.1.d/nodejs @@ -30,7 +30,7 @@ _ynh_load_nodejs_in_path_and_other_tweaks() { # # The installed version is defined by $nodejs_version which should be defined as global prior to calling this helper # -# usage: ynh_install_nodejs +# usage: ynh_nodejs_install # # `n` (Node version management) uses the `PATH` variable to store the path of the version of node it is going to use. # That's how it changes the version @@ -41,10 +41,10 @@ _ynh_load_nodejs_in_path_and_other_tweaks() { # (Environment="PATH=__PATH_WITH_NODEJS__") # # Requires YunoHost version 2.7.12 or higher. -ynh_install_nodejs() { +ynh_nodejs_install() { # Use n, https://github.com/tj/n to manage the nodejs versions - [[ -n "${nodejs_version:-}" ]] || ynh_die --message="\$nodejs_version should be defined prior to calling ynh_install_nodejs" + [[ -n "${nodejs_version:-}" ]] || ynh_die --message="\$nodejs_version should be defined prior to calling ynh_nodejs_install" # Create $n_install_dir mkdir --parents "$n_install_dir" @@ -95,23 +95,23 @@ ynh_install_nodejs() { ynh_app_setting_set --key=nodejs_version --value=$nodejs_version # Build the update script and set the cronjob - ynh_cron_upgrade_node + _ynh_cron_upgrade_node _ynh_load_nodejs_in_path_and_other_tweaks } # Remove the version of node used by the app. # -# usage: ynh_remove_nodejs +# usage: ynh_nodejs_remove # # This helper will check if another app uses the same version of node. # - If not, this version of node will be removed. # - If no other app uses node, n will be also removed. # # Requires YunoHost version 2.7.12 or higher. -ynh_remove_nodejs() { +ynh_nodejs_remove() { - [[ -n "${nodejs_version:-}" ]] || ynh_die --message="\$nodejs_version should be defined prior to calling ynh_install_nodejs" + [[ -n "${nodejs_version:-}" ]] || ynh_die --message="\$nodejs_version should be defined prior to calling ynh_nodejs_remove" # Remove the line for this app sed --in-place "/$YNH_APP_INSTANCE_NAME:$nodejs_version/d" "$n_install_dir/ynh_app_version" @@ -136,10 +136,10 @@ ynh_remove_nodejs() { # # This cron will check and update all minor node versions used by your apps. # -# usage: ynh_cron_upgrade_node +# usage: _ynh_cron_upgrade_node # # Requires YunoHost version 2.7.12 or higher. -ynh_cron_upgrade_node() { +_ynh_cron_upgrade_node() { # Build the update script cat >"$n_install_dir/node_update.sh" <>"$phpfpm_path" fi - local finalphpconf="$fpm_config_dir/pool.d/$app.conf" - ynh_add_config --template="$phpfpm_path" --destination="$finalphpconf" + ynh_config_add --template="$phpfpm_path" --destination="$fpm_config_dir/pool.d/$app.conf" # Validate that the new php conf doesn't break php-fpm entirely if ! php-fpm${php_version} --test 2>/dev/null; then php-fpm${php_version} --test || true - ynh_safe_rm "$finalphpconf" + ynh_safe_rm "$fpm_config_dir/pool.d/$app.conf" ynh_die --message="The new configuration broke php-fpm?" fi ynh_systemd_action --service=$fpm_service --action=reload @@ -145,22 +146,21 @@ pm.process_idle_timeout = 10s # Remove the dedicated PHP-FPM config # -# usage: ynh_remove_fpm_config +# usage: ynh_config_remove_phpfpm # # Requires YunoHost version 2.7.2 or higher. -ynh_remove_fpm_config() { +ynh_config_remove_phpfpm() { local fpm_config_dir=$(ynh_app_setting_get --key=fpm_config_dir) - local fpm_service=$(ynh_app_setting_get --key=fpm_service) ynh_safe_rm "$fpm_config_dir/pool.d/$app.conf" - ynh_systemd_action --service=$fpm_service --action=reload + ynh_systemd_action --service="php${php_version}-fpm" --action=reload } # Define the values to configure PHP-FPM # # [internal] # -# usage: ynh_get_scalable_phpfpm +# usage: _ynh_get_scalable_phpfpm # Footprint can be defined via the "fpm_footprint", to be set prior to calling this helper # low - Less than 20 MB of RAM by pool. # medium - Between 20 MB and 40 MB of RAM by pool. @@ -174,7 +174,7 @@ ynh_remove_fpm_config() { # medium - Low usage, few people or/and publicly accessible. # high - High usage, frequently visited website. # -ynh_get_scalable_phpfpm() { +_ynh_get_scalable_phpfpm() { # If no usage provided, default to the value existing in setting ... or to low local fpm_usage_in_setting=$(ynh_app_setting_get --key=fpm_usage) @@ -294,12 +294,12 @@ ynh_composer_exec() { # # The installed version is defined by $composer_version which should be defined as global prior to calling this helper # -# usage: ynh_install_composer [--workdir=$install_dir] [--install_args="--optimize-autoloader"] +# usage: ynh_composer_install [--workdir=$install_dir] [--install_args="--optimize-autoloader"] # | arg: -w, --workdir - The directory from where the command will be executed. Default $install_dir. # | arg: -a, --install_args - Additional arguments provided to the composer install. Argument --no-dev already include # # Requires YunoHost version 4.2 or higher. -ynh_install_composer() { +ynh_composer_install() { # ============ Argument parsing ============= local -A args_array=([w]=workdir= [a]=install_args=) local workdir @@ -309,7 +309,7 @@ ynh_install_composer() { install_args="${install_args:-}" # =========================================== - [[ -n "${composer_version}" ]] || ynh_die --message="\$composer_version should be defined before calling ynh_install_composer. (In the past, this was called \$YNH_COMPOSER_VERSION)" + [[ -n "${composer_version}" ]] || ynh_die --message="\$composer_version should be defined before calling ynh_composer_install. (In the past, this was called \$YNH_COMPOSER_VERSION)" [[ ! -e "$workdir/composer.phar" ]] || ynh_safe_rm $workdir/composer.phar diff --git a/helpers/helpers.v2.1.d/ruby b/helpers/helpers.v2.1.d/ruby index acc36ac66..780a45956 100644 --- a/helpers/helpers.v2.1.d/ruby +++ b/helpers/helpers.v2.1.d/ruby @@ -42,7 +42,7 @@ _ynh_load_ruby_in_path_and_other_tweaks() { # When not possible (e.g. in systemd service definition), please use direct path # to rbenv shims (e.g. $RBENV_ROOT/shims/bundle) # -# usage: ynh_install_ruby +# usage: ynh_ruby_install # # Adds the appropriate, specific version of ruby to the PATH variable (which # is also exported, to ease the use of ynh_exec_as_app). Also define variable @@ -50,9 +50,9 @@ _ynh_load_ruby_in_path_and_other_tweaks() { # (Environment="PATH=__PATH_WITH_RUBY__") # # Requires YunoHost version 3.2.2 or higher. -ynh_install_ruby () { +ynh_ruby_install () { - [[ -n "${ruby_version:-}" ]] || ynh_die --message="\$ruby_version should be defined prior to calling ynh_install_ruby" + [[ -n "${ruby_version:-}" ]] || ynh_die --message="\$ruby_version should be defined prior to calling ynh_ruby_install" # Load rbenv path in PATH local CLEAR_PATH="$rbenv_install_dir/bin:$PATH" @@ -171,7 +171,7 @@ ynh_install_ruby () { rbenv alias $app $final_ruby_version # Cleanup Ruby versions - ynh_cleanup_ruby + _ynh_ruby_cleanup # Set environment for Ruby users echo "#rbenv @@ -183,15 +183,15 @@ eval \"\$(rbenv init -)\" # Load the environment eval "$(rbenv init -)" - _ynh_load_ruby_in_path_and_other_variable_tweaks + _ynh_load_ruby_in_path_and_other_tweaks } # Remove the version of Ruby used by the app. # # This helper will also cleanup Ruby versions # -# usage: ynh_remove_ruby -ynh_remove_ruby () { +# usage: ynh_ruby_remove +ynh_ruby_remove () { local ruby_version=$(ynh_app_setting_get --key=ruby_version) # Load rbenv path in PATH @@ -206,7 +206,7 @@ ynh_remove_ruby () { ynh_app_setting_delete --key=ruby_version # Cleanup Ruby versions - ynh_cleanup_ruby + _ynh_ruby_cleanup } # Remove no more needed versions of Ruby used by the app. @@ -214,9 +214,7 @@ ynh_remove_ruby () { # This helper will check what Ruby version are no more required, # and uninstall them # If no app uses Ruby, rbenv will be also removed. -# -# usage: ynh_cleanup_ruby -ynh_cleanup_ruby () { +_ynh_ruby_cleanup () { # List required Ruby versions local installed_apps=$(yunohost app list | grep -oP 'id: \K.*$') diff --git a/helpers/helpers.v2.1.d/systemd b/helpers/helpers.v2.1.d/systemd index 56eb44428..a4128add3 100644 --- a/helpers/helpers.v2.1.d/systemd +++ b/helpers/helpers.v2.1.d/systemd @@ -2,17 +2,17 @@ # Create a dedicated systemd config # -# usage: ynh_add_systemd_config [--service=service] [--template=template] +# usage: ynh_config_add_systemd [--service=service] [--template=template] # | arg: -s, --service= - Service name (optionnal, `$app` by default) # | arg: -t, --template= - Name of template file (optionnal, this is 'systemd' by default, meaning `../conf/systemd.service` will be used as template) # # This will use the template `../conf/.service`. # -# See the documentation of `ynh_add_config` for a description of the template +# See the documentation of `ynh_config_add` for a description of the template # format and how placeholders are replaced with actual variables. # # Requires YunoHost version 4.1.0 or higher. -ynh_add_systemd_config() { +ynh_config_add_systemd() { # ============ Argument parsing ============= local -A args_array=([s]=service= [t]=template=) local service @@ -22,7 +22,7 @@ ynh_add_systemd_config() { template="${template:-systemd.service}" # =========================================== - ynh_add_config --template="$template" --destination="/etc/systemd/system/$service.service" + ynh_config_add --template="$template" --destination="/etc/systemd/system/$service.service" systemctl enable $service --quiet systemctl daemon-reload @@ -30,11 +30,11 @@ ynh_add_systemd_config() { # Remove the dedicated systemd config # -# usage: ynh_remove_systemd_config [--service=service] +# usage: ynh_config_remove_systemd [--service=service] # | arg: -s, --service= - Service name (optionnal, $app by default) # # Requires YunoHost version 2.7.2 or higher. -ynh_remove_systemd_config() { +ynh_config_remove_systemd() { # ============ Argument parsing ============= local -A args_array=([s]=service=) local service @@ -117,7 +117,7 @@ ynh_systemd_action() { if [ -e "$log_path" ]; then tail --lines=$length "$log_path" >&2 fi - ynh_clean_check_starting + _ynh_clean_check_starting return 1 fi @@ -166,16 +166,11 @@ ynh_systemd_action() { tail --lines=$length "$log_path" >&2 fi fi - ynh_clean_check_starting + _ynh_clean_check_starting fi } -# Clean temporary process and file used by ynh_check_starting -# -# [internal] -# -# Requires YunoHost version 3.5.0 or higher. -ynh_clean_check_starting() { +_ynh_clean_check_starting() { if [ -n "${pid_tail:-}" ]; then # Stop the execution of tail. kill -SIGTERM $pid_tail 2>&1 diff --git a/helpers/helpers.v2.1.d/templating b/helpers/helpers.v2.1.d/templating index 64f9beb53..54517b3f5 100644 --- a/helpers/helpers.v2.1.d/templating +++ b/helpers/helpers.v2.1.d/templating @@ -2,15 +2,15 @@ # Create a dedicated config file from a template # -# usage: ynh_add_config --template="template" --destination="destination" +# usage: ynh_config_add --template="template" --destination="destination" # | arg: -t, --template= - Template config file to use # | arg: -d, --destination= - Destination of the config file # | arg: -j, --jinja - Use jinja template instead of legacy __MY_VAR__ # # examples: -# ynh_add_config --template=".env" --destination="$install_dir/.env" use the template file "../conf/.env" -# ynh_add_config --jinja --template="config.j2" --destination="$install_dir/config" use the template file "../conf/config.j2" -# ynh_add_config --template="/etc/nginx/sites-available/default" --destination="etc/nginx/sites-available/mydomain.conf" +# ynh_config_add --template=".env" --destination="$install_dir/.env" use the template file "../conf/.env" +# ynh_config_add --jinja --template="config.j2" --destination="$install_dir/config" use the template file "../conf/config.j2" +# ynh_config_add --template="/etc/nginx/sites-available/default" --destination="etc/nginx/sites-available/mydomain.conf" # ## ## How it works in "legacy" mode @@ -72,7 +72,7 @@ # into the app settings when configuration is done. # # Requires YunoHost version 4.1.0 or higher. -ynh_add_config() { +ynh_config_add() { # ============ Argument parsing ============= local -A args_array=([t]=template= [d]=destination= [j]=jinja) local template diff --git a/helpers/helpers.v2.1.d/utils b/helpers/helpers.v2.1.d/utils index 72196394b..b638180e1 100644 --- a/helpers/helpers.v2.1.d/utils +++ b/helpers/helpers.v2.1.d/utils @@ -504,7 +504,7 @@ ynh_app_upgrading_from_version_before_or_equal_to() { } # Check if we should enforce sane default permissions (= disable rwx for 'others') -# on file/folders handled with ynh_setup_source and ynh_add_config +# on file/folders handled with ynh_setup_source and ynh_config_add # # [internal] #