From 031b11a4c6b003f133f3b4358185eb5835bca024 Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Mon, 15 Apr 2019 20:56:05 +0200 Subject: [PATCH 1/3] Move from ci-apps-dev to ci-apps-hq --- pull_request_template.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pull_request_template.md b/pull_request_template.md index ad0eb69..314c271 100644 --- a/pull_request_template.md +++ b/pull_request_template.md @@ -19,6 +19,6 @@ - [ ] **Approval (LGTM)** : - [ ] **Approval (LGTM)** : - **CI succeeded** : -[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/etherpad_mypads_ynh%20PR-NUM-/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/etherpad_mypads_ynh%20PR-NUM-/) -*Please replace '-NUM-' in this link by the PR number.* +[![Build Status](https://ci-apps-hq.yunohost.org/jenkins/job/etherpad_mypads_ynh%20PR-NUM-/badge/icon)](https://ci-apps-hq.yunohost.org/jenkins/job/etherpad_mypads_ynh%20PR-NUM-/) +*Please replace '-NUM-' in this link by the PR number.* When the PR is marked as ready to merge, you have to wait for 3 days before really merging it. From d299b77dd865e9fff306c121235450e27ab9372a Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Mon, 6 May 2019 19:06:22 +0200 Subject: [PATCH 2/3] Normalization from example_ynh --- README.md | 9 +- README_fr.md | 9 +- check_process | 10 - conf/app.src | 4 +- conf/nginx.conf | 3 + manifest.json | 10 +- scripts/_common.sh | 441 +++++++++------------------------------------ scripts/backup | 36 ++-- scripts/change_url | 40 ++-- scripts/install | 132 +++++++------- scripts/remove | 56 +++--- scripts/restore | 75 ++++---- scripts/upgrade | 151 ++++++++-------- 13 files changed, 342 insertions(+), 634 deletions(-) diff --git a/README.md b/README.md index c2810cf..ad5d437 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to Etherpad is a highly customizable Open Source online editor providing collaborative editing in really real-time. This package will install the same plugins than [Framapad](https://framapad.org/). -**Shipped version:** 1.7.0 +**Shipped version:** 1.7.5 ## Screenshots @@ -40,9 +40,9 @@ Supported, with LDAP. #### Supported architectures -* x86-64b - [![](https://ci-apps.yunohost.org/ci/logs/etherpad_mypads%20%28Official%29.svg)](https://ci-apps.yunohost.org/ci/apps/etherpad_mypads/) -* ARMv8-A - [![](https://ci-apps-arm.yunohost.org/ci/logs/etherpad_mypads%20%28Official%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/etherpad_mypads/) -* Jessie x86-64b - [![](https://ci-stretch.nohost.me/ci/logs/etherpad_mypads%20%28Official%29.svg)](https://ci-stretch.nohost.me/ci/apps/etherpad_mypads/) +* x86-64b - [![](https://ci-apps.yunohost.org/ci/logs/etherpad_mypads%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/etherpad_mypads/) +* ARMv8-A - [![](https://ci-apps-arm.yunohost.org/ci/logs/etherpad_mypads%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/etherpad_mypads/) +* Jessie x86-64b - [![](https://ci-stretch.nohost.me/ci/logs/etherpad_mypads%20%28Apps%29.svg)](https://ci-stretch.nohost.me/ci/apps/etherpad_mypads/) ## Limitations @@ -71,6 +71,7 @@ Supported, with LDAP. * Report a bug: https://github.com/YunoHost-Apps/etherpad_mypads_ynh/issues * Etherpad website: http://etherpad.org/ * Mypads plugin website: https://git.framasoft.org/framasoft/ep_mypads + * Upstream app repository: https://github.com/ether/etherpad-lite * YunoHost website: https://yunohost.org/ --- diff --git a/README_fr.md b/README_fr.md index 85595ca..303b6ef 100644 --- a/README_fr.md +++ b/README_fr.md @@ -12,7 +12,7 @@ Si vous n'avez pas YunoHost, merci de regarder [ici](https://yunohost.org/#/inst Etherpad est un éditeur en ligne Open Source hautement personnalisable qui permet l'édition collaborative en temps réel. Ce paquet installera les mêmes plugins que [Framapad](https://framapad.org/). -**Version embarquée:** 1.7.0 +**Version embarquée:** 1.7.5 ## Captures d'écran @@ -40,9 +40,9 @@ Supportée, avec LDAP. #### Architectures supportées. -* x86-64b - [![](https://ci-apps.yunohost.org/ci/logs/etherpad_mypads%20%28Official%29.svg)](https://ci-apps.yunohost.org/ci/apps/etherpad_mypads/) -* ARMv8-A - [![](https://ci-apps-arm.yunohost.org/ci/logs/etherpad_mypads%20%28Official%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/etherpad_mypads/) -* Jessie x86-64b - [![](https://ci-stretch.nohost.me/ci/logs/etherpad_mypads%20%28Official%29.svg)](https://ci-stretch.nohost.me/ci/apps/etherpad_mypads/) +* x86-64b - [![](https://ci-apps.yunohost.org/ci/logs/etherpad_mypads%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/etherpad_mypads/) +* ARMv8-A - [![](https://ci-apps-arm.yunohost.org/ci/logs/etherpad_mypads%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/etherpad_mypads/) +* Jessie x86-64b - [![](https://ci-stretch.nohost.me/ci/logs/etherpad_mypads%20%28Apps%29.svg)](https://ci-stretch.nohost.me/ci/apps/etherpad_mypads/) ## Limitations @@ -71,6 +71,7 @@ Supportée, avec LDAP. * Reporter un bug: https://github.com/YunoHost-Apps/etherpad_mypads_ynh/issues * Site de etherpad: http://etherpad.org/ * Site du plugin mypads: https://git.framasoft.org/framasoft/ep_mypads + * Dépôt git de l'app: https://github.com/ether/etherpad-lite * Site de YunoHost: https://yunohost.org/ --- diff --git a/check_process b/check_process index c160fa4..ab44e27 100644 --- a/check_process +++ b/check_process @@ -66,17 +66,7 @@ ; Checks setup_root=1 ;;; Levels - Level 1=auto - Level 2=auto - Level 3=auto -# Level 4: https://github.com/YunoHost-Apps/etherpad_mypads_ynh/blob/51ddcd64d68398018e3af6637339e2c20c4dc9a7/conf/settings.json#L90-L113 - Level 4=1 Level 5=auto - Level 6=auto - Level 7=auto - Level 8=0 - Level 9=0 - Level 10=0 ;;; Options Email= Notification=down diff --git a/conf/app.src b/conf/app.src index 9ccb9c8..2ed7470 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/ether/etherpad-lite/archive/1.7.0.tar.gz -SOURCE_SUM=71fe286cf3e8dc45b0b5963de54f2ff6 +SOURCE_URL=https://github.com/ether/etherpad-lite/archive/1.7.5.tar.gz +SOURCE_SUM=01971447ff7b4d0d2af52faf02edb032 SOURCE_SUM_PRG=md5sum ARCH_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/conf/nginx.conf b/conf/nginx.conf index e949b1c..a6901b6 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,7 +1,10 @@ location __PATH__/ { + + # Force usage of https if ($scheme = http) { rewrite ^ https://$server_name$request_uri? permanent; } + #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; #sub_path_only rewrite ^__PATH__/admin$ __PATH__/admin/ permanent; proxy_pass http://127.0.0.1:__PORT__/; diff --git a/manifest.json b/manifest.json index 16005e4..e00b25b 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Framapad clone, a online editor providing collaborative editing in real-time.", "fr": "Clone de Framapad, un éditeur en ligne fournissant l'édition collaborative en temps réel." }, - "version": "1.7.0~ynh2", + "version": "1.7.5~ynh2", "url": "https://framapad.org", "license": "Apache-2.0", "maintainer": { @@ -14,7 +14,7 @@ "email": "maniackc_dev@crudelis.fr" }, "requirements": { - "yunohost": ">= 3.4" + "yunohost": ">= 3.5" }, "multi_instance": true, "services": [ @@ -62,6 +62,7 @@ }, { "name": "language", + "type": "string", "ask": { "en": "Choose your language", "fr": "Choisissez la langue" @@ -76,10 +77,15 @@ "en": "Is it a public website?", "fr": "Est-ce un site public ?" }, + "help": { + "en": "If your etherpad instance is public, everyone will be able to create a pad or see an existing one.", + "fr": "Si votre instance etherpad est publique, tout le monde pourra créer un pad ou voir un existant." + } "default": true }, { "name": "export", + "type": "string", "ask": { "en": "Use abiword (~260Mo) or libreoffice (~400Mo) (more stable) to expand export possibilities (pdf, doc) ?", "fr": "Utiliser abiword (~260Mo) ou libre office (~400Mo) (plus stable) pour étendre les possibilités d'export (pdf, doc) ?" diff --git a/scripts/_common.sh b/scripts/_common.sh index fc2de39..59a1855 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -26,378 +26,35 @@ CHECK_SIZE () { # Vérifie avant chaque backup que l'espace est suffisant # FUTUR OFFICIAL HELPERS #================================================= -# Create a dedicated fail2ban config (jail and filter conf files) -# -# usage: ynh_add_fail2ban_config log_file filter [max_retry [ports]] -# | arg: -l, --logpath= - Log file to be checked by fail2ban -# | arg: -r, --failregex= - Failregex to be looked for by fail2ban -# | arg: -m, --max_retry= - Maximum number of retries allowed before banning IP address - default: 3 -# | arg: -p, --ports= - Ports blocked for a banned IP address - default: http,https -ynh_add_fail2ban_config () { - # Declare an array to define the options of this helper. - declare -Ar args_array=( [l]=logpath= [r]=failregex= [m]=max_retry= [p]=ports= ) - local logpath - local failregex - local max_retry - local ports - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - max_retry=${max_retry:-3} - ports=${ports:-http,https} - - test -n "$logpath" || ynh_die "ynh_add_fail2ban_config expects a logfile path as first argument and received nothing." - test -n "$failregex" || ynh_die "ynh_add_fail2ban_config expects a failure regex as second argument and received nothing." - - finalfail2banjailconf="/etc/fail2ban/jail.d/$app.conf" - finalfail2banfilterconf="/etc/fail2ban/filter.d/$app.conf" - ynh_backup_if_checksum_is_different "$finalfail2banjailconf" 1 - ynh_backup_if_checksum_is_different "$finalfail2banfilterconf" 1 - - tee $finalfail2banjailconf <&2 - echo "WARNING${fail2ban_error#*WARNING}" >&2 - fi -} - -# Remove the dedicated fail2ban config (jail and filter conf files) -# -# usage: ynh_remove_fail2ban_config -ynh_remove_fail2ban_config () { - ynh_secure_remove "/etc/fail2ban/jail.d/$app.conf" - ynh_secure_remove "/etc/fail2ban/filter.d/$app.conf" - if [ "$(lsb_release --codename --short)" != "jessie" ]; then - systemctl reload fail2ban - else - systemctl restart fail2ban - fi -} - -#================================================= - -# Read the value of a key in a ynh manifest file -# -# usage: ynh_read_manifest manifest key -# | arg: -m, --manifest= - Path of the manifest to read -# | arg: -k, --key= - Name of the key to find -ynh_read_manifest () { - # Declare an array to define the options of this helper. - declare -Ar args_array=( [m]=manifest= [k]=manifest_key= ) - local manifest - local manifest_key - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - - python3 -c "import sys, json;print(json.load(open('$manifest', encoding='utf-8'))['$manifest_key'])" -} - -# Read the upstream version from the manifest -# The version number in the manifest is defined by ~ynh -# For example : 4.3-2~ynh3 -# This include the number before ~ynh -# In the last example it return 4.3-2 -# -# usage: ynh_app_upstream_version [-m manifest] -# | arg: -m, --manifest= - Path of the manifest to read -ynh_app_upstream_version () { - declare -Ar args_array=( [m]=manifest= ) - local manifest - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - - manifest="${manifest:-../manifest.json}" - if [ ! -e "$manifest" ]; then - manifest="../settings/manifest.json" # Into the restore script, the manifest is not at the same place - fi - version_key=$(ynh_read_manifest --manifest="$manifest" --manifest_key="version") - echo "${version_key/~ynh*/}" -} - -# Read package version from the manifest -# The version number in the manifest is defined by ~ynh -# For example : 4.3-2~ynh3 -# This include the number after ~ynh -# In the last example it return 3 -# -# usage: ynh_app_package_version [-m manifest] -# | arg: -m, --manifest= - Path of the manifest to read -ynh_app_package_version () { - declare -Ar args_array=( [m]=manifest= ) - local manifest - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - - manifest="${manifest:-../manifest.json}" - if [ ! -e "$manifest" ]; then - manifest="../settings/manifest.json" # Into the restore script, the manifest is not at the same place - fi - version_key=$(ynh_read_manifest --manifest="$manifest" --manifest_key="version") - echo "${version_key/*~ynh/}" -} - -# Checks the app version to upgrade with the existing app version and returns: -# - UPGRADE_APP if the upstream app version has changed -# - UPGRADE_PACKAGE if only the YunoHost package has changed -# -## It stops the current script without error if the package is up-to-date -# -# This helper should be used to avoid an upgrade of an app, or the upstream part -# of it, when it's not needed -# -# To force an upgrade, even if the package is up to date, -# you have to set the variable YNH_FORCE_UPGRADE before. -# example: sudo YNH_FORCE_UPGRADE=1 yunohost app upgrade MyApp -# -# usage: ynh_check_app_version_changed -ynh_check_app_version_changed () { - local force_upgrade=${YNH_FORCE_UPGRADE:-0} - local package_check=${PACKAGE_CHECK_EXEC:-0} - - # By default, upstream app version has changed - local return_value="UPGRADE_APP" - - local current_version=$(ynh_read_manifest --manifest="/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" --manifest_key="version" || echo 1.0) - local current_upstream_version="$(ynh_app_upstream_version --manifest="/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json")" - local update_version=$(ynh_read_manifest --manifest="../manifest.json" --manifest_key="version" || echo 1.0) - local update_upstream_version="$(ynh_app_upstream_version)" - - if [ "$current_version" == "$update_version" ] ; then - # Complete versions are the same - if [ "$force_upgrade" != "0" ] - then - echo "Upgrade forced by YNH_FORCE_UPGRADE." >&2 - unset YNH_FORCE_UPGRADE - elif [ "$package_check" != "0" ] - then - echo "Upgrade forced for package check." >&2 - else - ynh_die "Up-to-date, nothing to do" 0 - fi - elif [ "$current_upstream_version" == "$update_upstream_version" ] ; then - # Upstream versions are the same, only YunoHost package versions differ - return_value="UPGRADE_PACKAGE" - fi - echo $return_value -} - -# Start (or other actions) a service, print a log in case of failure and optionnaly wait until the service is completely started -# -# usage: ynh_systemd_action [-n service_name] [-a action] [ [-l "line to match"] [-p log_path] [-t timeout] [-e length] ] -# | arg: -n, --service_name= - Name of the service to reload. Default : $app -# | arg: -a, --action= - Action to perform with systemctl. Default: start -# | arg: -l, --line_match= - Line to match - The line to find in the log to attest the service have finished to boot. -# If not defined it don't wait until the service is completely started. -# | arg: -p, --log_path= - Log file - Path to the log file. Default : /var/log/$app/$app.log -# | arg: -t, --timeout= - Timeout - The maximum time to wait before ending the watching. Default : 300 seconds. -# | arg: -e, --length= - Length of the error log : Default : 20 -ynh_systemd_action() { - # Declare an array to define the options of this helper. - declare -Ar args_array=( [n]=service_name= [a]=action= [l]=line_match= [p]=log_path= [t]=timeout= [e]=length= ) - local service_name - local action - local line_match - local length - local log_path - local timeout - - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - - local service_name="${service_name:-$app}" - local action=${action:-start} - local log_path="${log_path:-/var/log/$service_name/$service_name.log}" - local length=${length:-20} - local timeout=${timeout:-300} - - # Start to read the log - if [[ -n "${line_match:-}" ]] - then - local templog="$(mktemp)" - # Following the starting of the app in its log - if [ "$log_path" == "systemd" ] ; then - # Read the systemd journal - journalctl -u $service_name -f --since=-45 > "$templog" & - else - # Read the specified log file - tail -F -n0 "$log_path" > "$templog" & - fi - # Get the PID of the tail command - local pid_tail=$! - fi - - echo "${action^} the service $service_name" >&2 - systemctl $action $service_name \ - || ( journalctl --lines=$length -u $service_name >&2 \ - ; test -n "$log_path" && echo "--" && tail --lines=$length "$log_path" >&2 \ - ; false ) - - # Start the timeout and try to find line_match - if [[ -n "${line_match:-}" ]] - then - local i=0 - for i in $(seq 1 $timeout) - do - # Read the log until the sentence is found, that means the app finished to start. Or run until the timeout - if grep --quiet "$line_match" "$templog" - then - echo "The service $service_name has correctly started." >&2 - break - fi - echo -n "." >&2 - sleep 1 - done - if [ $i -eq $timeout ] - then - echo "The service $service_name didn't fully started before the timeout." >&2 - echo "Please find here an extract of the end of the log of the service $service_name:" - journalctl --lines=$length -u $service_name >&2 - test -n "$log_path" && echo "--" && tail --lines=$length "$log_path" >&2 - fi - - echo "" - ynh_clean_check_starting - fi -} - -# Clean temporary process and file used by ynh_check_starting -# (usually used in ynh_clean_setup scripts) -# -# usage: ynh_clean_check_starting -ynh_clean_check_starting () { - # Stop the execution of tail. - kill -s 15 $pid_tail 2>&1 - ynh_secure_remove "$templog" 2>&1 -} - -#================================================= - -# Print a message as INFO and show progression during an app script -# -# usage: ynh_script_progression --message=message [--weight=weight] [--time] -# | arg: -m, --message= - The text to print -# | arg: -w, --weight= - The weight for this progression. This value is 1 by default. Use a bigger value for a longer part of the script. -# | arg: -t, --time= - Print the execution time since the last call to this helper. Especially usefull to define weights. -# | arg: -l, --last= - Use for the last call of the helper, to fill te progression bar. -increment_progression=0 -previous_weight=0 -# Define base_time when the file is sourced -base_time=$(date +%s) -ynh_script_progression () { - # Declare an array to define the options of this helper. - declare -Ar args_array=( [m]=message= [w]=weight= [t]=time [l]=last ) - local message - local weight - local time - local last - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - weight=${weight:-1} - time=${time:-0} - last=${last:-0} - - # Get execution time since the last $base_time - local exec_time=$(( $(date +%s) - $base_time )) - base_time=$(date +%s) - - # Get the number of occurrences of 'ynh_script_progression' in the script. Except those are commented. - local helper_calls="$(grep --count "^[^#]*ynh_script_progression" $0)" - # Get the number of call with a weight value - local weight_calls=$(grep --perl-regexp --count "^[^#]*ynh_script_progression.*(--weight|-w )" $0) - - # Get the weight of each occurrences of 'ynh_script_progression' in the script using --weight - local weight_valuesA="$(grep --perl-regexp "^[^#]*ynh_script_progression.*--weight" $0 | sed 's/.*--weight[= ]\([[:digit:]].*\)/\1/g')" - # Get the weight of each occurrences of 'ynh_script_progression' in the script using -w - local weight_valuesB="$(grep --perl-regexp "^[^#]*ynh_script_progression.*-w " $0 | sed 's/.*-w[= ]\([[:digit:]].*\)/\1/g')" - # Each value will be on a different line. - # Remove each 'end of line' and replace it by a '+' to sum the values. - local weight_values=$(( $(echo "$weight_valuesA" | tr '\n' '+') + $(echo "$weight_valuesB" | tr '\n' '+') 0 )) - - # max_progression is a total number of calls to this helper. - # Less the number of calls with a weight value. - # Plus the total of weight values - local max_progression=$(( $helper_calls - $weight_calls + $weight_values )) - - # Increment each execution of ynh_script_progression in this script by the weight of the previous call. - increment_progression=$(( $increment_progression + $previous_weight )) - # Store the weight of the current call in $previous_weight for next call - previous_weight=$weight - - # Set the scale of the progression bar - local scale=20 - # progress_string(1,2) should have the size of the scale. - local progress_string1="####################" - local progress_string0="...................." - - # Reduce $increment_progression to the size of the scale - if [ $last -eq 0 ] - then - local effective_progression=$(( $increment_progression * $scale / $max_progression )) - # If last is specified, fill immediately the progression_bar - else - local effective_progression=$scale - fi - - # Build $progression_bar from progress_string(1,2) according to $effective_progression - local progression_bar="${progress_string1:0:$effective_progression}${progress_string0:0:$(( $scale - $effective_progression ))}" - - local print_exec_time="" - if [ $time -eq 1 ] - then - print_exec_time=" [$(date +%Hh%Mm,%Ss --date="0 + $exec_time sec")]" - fi - - ynh_print_info "[$progression_bar] > ${message}${print_exec_time}" -} - #================================================= # EXPERIMENTAL HELPERS #================================================= -#================================================= - # Send an email to inform the administrator # -# usage: ynh_send_readme_to_admin app_message [recipients] -# | arg: -m --app_message= - The message to send to the administrator. +# usage: ynh_send_readme_to_admin --app_message=app_message [--recipients=recipients] [--type=type] +# | arg: -m --app_message= - The file with the content to send to the administrator. # | arg: -r, --recipients= - The recipients of this email. Use spaces to separate multiples recipients. - default: root # example: "root admin@domain" # If you give the name of a YunoHost user, ynh_send_readme_to_admin will find its email adress for you # example: "root admin@domain user1 user2" +# | arg: -t, --type= - Type of mail, could be 'backup', 'change_url', 'install', 'remove', 'restore', 'upgrade' ynh_send_readme_to_admin() { # Declare an array to define the options of this helper. - declare -Ar args_array=( [m]=app_message= [r]=recipients= ) + declare -Ar args_array=( [m]=app_message= [r]=recipients= [t]=type= ) local app_message local recipients + local type # Manage arguments with getopts + ynh_handle_getopts_args "$@" - local app_message="${app_message:-...No specific information...}" - local recipients="${recipients:-root}" + app_message="${app_message:-}" + recipients="${recipients:-root}" + type="${type:-install}" + + # Get the value of admin_mail_html + admin_mail_html=$(ynh_app_setting_get $app admin_mail_html) + admin_mail_html="${admin_mail_html:-0}" # Retrieve the email of users find_mails () { @@ -423,18 +80,75 @@ ynh_send_readme_to_admin() { } recipients=$(find_mails "$recipients") - local mail_subject="☁️🆈🅽🅷☁️: \`$app\` was just installed!" + # Subject base + local mail_subject="☁️🆈🅽🅷☁️: \`$app\`" + + # Adapt the subject according to the type of mail required. + if [ "$type" = "backup" ]; then + mail_subject="$mail_subject has just been backup." + elif [ "$type" = "change_url" ]; then + mail_subject="$mail_subject has just been moved to a new URL!" + elif [ "$type" = "remove" ]; then + mail_subject="$mail_subject has just been removed!" + elif [ "$type" = "restore" ]; then + mail_subject="$mail_subject has just been restored!" + elif [ "$type" = "upgrade" ]; then + mail_subject="$mail_subject has just been upgraded!" + else # install + mail_subject="$mail_subject has just been installed!" + fi local mail_message="This is an automated message from your beloved YunoHost server. Specific information for the application $app. -$app_message +$(if [ -n "$app_message" ] +then + cat "$app_message" +else + echo "...No specific information..." +fi) --- Automatic diagnosis data from YunoHost -$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')" +__PRE_TAG1__$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')__PRE_TAG2__" + + # Store the message into a file for further modifications. + echo "$mail_message" > mail_to_send + + # If a html email is required. Apply html tags to the message. + if [ "$admin_mail_html" -eq 1 ] + then + # Insert 'br' tags at each ending of lines. + ynh_replace_string "$" "
" mail_to_send + + # Insert starting HTML tags + sed --in-place '1s@^@\n\n\n\n@' mail_to_send + + # Keep tabulations + ynh_replace_string " " "\ \ " mail_to_send + ynh_replace_string "\t" "\ \ " mail_to_send + + # Insert url links tags + ynh_replace_string "__URL_TAG1__\(.*\)__URL_TAG2__\(.*\)__URL_TAG3__" "\1" mail_to_send + + # Insert pre tags + ynh_replace_string "__PRE_TAG1__" "
" mail_to_send
+		ynh_replace_string "__PRE_TAG2__" "<\pre>" mail_to_send
+
+		# Insert finishing HTML tags
+		echo -e "\n\n" >> mail_to_send
+
+	# Otherwise, remove tags to keep a plain text.
+	else
+		# Remove URL tags
+		ynh_replace_string "__URL_TAG[1,3]__" "" mail_to_send
+		ynh_replace_string "__URL_TAG2__" ": " mail_to_send
+
+		# Remove PRE tags
+		ynh_replace_string "__PRE_TAG[1-2]__" "" mail_to_send
+	fi
 
 	# Define binary to use for mail command
 	if [ -e /usr/bin/bsd-mailx ]
@@ -444,8 +158,15 @@ $(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')"
 		local mail_bin=/usr/bin/mail.mailutils
 	fi
 
+	if [ "$admin_mail_html" -eq 1 ]
+	then
+		content_type="text/html"
+	else
+		content_type="text/plain"
+	fi
+
 	# Send the email to the recipients
-	echo "$mail_message" | $mail_bin -a "Content-Type: text/plain; charset=UTF-8" -s "$mail_subject" "$recipients"
+	cat mail_to_send | $mail_bin -a "Content-Type: $content_type; charset=UTF-8" -s "$mail_subject" "$recipients"
 }
 
 #=================================================
diff --git a/scripts/backup b/scripts/backup
index 3f9056f..71a7b00 100644
--- a/scripts/backup
+++ b/scripts/backup
@@ -19,37 +19,37 @@ ynh_abort_if_errors
 #=================================================
 # LOAD SETTINGS
 #=================================================
-ynh_script_progression --message="Load settings" --weight=2
+ynh_script_progression --message="Loading installation settings..." --weight=2
 
 app=$YNH_APP_INSTANCE_NAME
 
-final_path=$(ynh_app_setting_get $app final_path)
-domain=$(ynh_app_setting_get $app domain)
-db_name=$(ynh_app_setting_get $app db_name)
+final_path=$(ynh_app_setting_get --app=$app --key=final_path)
+domain=$(ynh_app_setting_get --app=$app --key=domain)
+db_name=$(ynh_app_setting_get --app=$app --key=db_name)
 
 #=================================================
 # STANDARD BACKUP STEPS
 #=================================================
 # BACKUP THE APP MAIN DIR
 #=================================================
-ynh_script_progression --message="Backup the app main dir" --weight=2
+ynh_script_progression --message="Backing up the main app directory..." --weight=2
 
 CHECK_SIZE "$final_path"
-ynh_backup "$final_path"
+ynh_backup --src_path="$final_path"
 
 #=================================================
 # BACKUP NGINX CONFIGURATION
 #=================================================
-ynh_script_progression --message="Backup nginx configuration"
+ynh_script_progression --message="Backing up nginx web server configuration..."
 
-ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
+ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
 
 #=================================================
 # BACKUP THE MYSQL DATABASE
 #=================================================
-ynh_script_progression --message="Backup the mysql database" --weight=3
+ynh_script_progression --message="Backing up the MySQL database..." --weight=3
 
-ynh_mysql_dump_db "$db_name" > db.sql
+ynh_mysql_dump_db --database="$db_name" > db.sql
 CHECK_SIZE "db.sql"
 
 #=================================================
@@ -57,27 +57,27 @@ CHECK_SIZE "db.sql"
 #=================================================
 # BACKUP LOGROTATE
 #=================================================
-ynh_script_progression --message="Backup logrotate configuration"
+ynh_script_progression --message="Backing up logrotate configuration..."
 
-ynh_backup "/etc/logrotate.d/$app"
+ynh_backup --src_path="/etc/logrotate.d/$app"
 
 #=================================================
 # BACKUP SYSTEMD
 #=================================================
-ynh_script_progression --message="Backup systemd configuration"
+ynh_script_progression --message="Backing up systemd configuration..."
 
-ynh_backup "/etc/systemd/system/$app.service"
+ynh_backup --src_path="/etc/systemd/system/$app.service"
 
 #=================================================
 # BACKUP FAIL2BAN CONFIGURATION
 #=================================================
-ynh_script_progression --message="Backup fail2ban configuration"
+ynh_script_progression --message="Backing up fail2ban configuration..."
 
-ynh_backup "/etc/fail2ban/jail.d/$app.conf"
-ynh_backup "/etc/fail2ban/filter.d/$app.conf"
+ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf"
+ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
 
 #=================================================
 # END OF SCRIPT
 #=================================================
 
-ynh_script_progression --message="Backup completed" --last
+ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last
diff --git a/scripts/change_url b/scripts/change_url
index f466805..131102c 100644
--- a/scripts/change_url
+++ b/scripts/change_url
@@ -12,7 +12,6 @@ source /usr/share/yunohost/helpers
 #=================================================
 # RETRIEVE ARGUMENTS
 #=================================================
-ynh_script_progression --message="Retrieve arguments from the manifest"
 
 old_domain=$YNH_APP_OLD_DOMAIN
 old_path=$YNH_APP_OLD_PATH
@@ -25,26 +24,16 @@ app=$YNH_APP_INSTANCE_NAME
 #=================================================
 # LOAD SETTINGS
 #=================================================
-ynh_script_progression --message="Load settings" --weight=5
+ynh_script_progression --message="Loading installation settings..." --weight=5
 
-final_path=$(ynh_app_setting_get $app final_path)
-mypads=$(ynh_app_setting_get $app mypads)
-port=$(ynh_app_setting_get $app port)
-
-#=================================================
-# CHECK THE SYNTAX OF THE PATHS
-#=================================================
-ynh_script_progression --message="Check the syntax of the paths"
-
-test -n "$old_path" || old_path="/"
-test -n "$new_path" || new_path="/"
-new_path=$(ynh_normalize_url_path $new_path)
-old_path=$(ynh_normalize_url_path $old_path)
+final_path=$(ynh_app_setting_get --app=$app --key=final_path)
+mypads=$(ynh_app_setting_get --app=$app --key=mypads)
+port=$(ynh_app_setting_get --app=$app --key=port)
 
 #=================================================
 # ACTIVATE MAINTENANCE MODE
 #=================================================
-ynh_script_progression --message="Activate maintenance mode" --weight=2
+ynh_script_progression --message="Activating maintenance mode..." --weight=2
 
 path_url=$old_path
 domain=$old_domain
@@ -82,7 +71,7 @@ ynh_abort_if_errors
 #=================================================
 # MODIFY URL IN NGINX CONF
 #=================================================
-ynh_script_progression --message="Modify url in nginx configuration" --weight=3
+ynh_script_progression --message="Updating nginx web server configuration..." --weight=3
 
 nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
 
@@ -90,15 +79,12 @@ nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
 if [ $change_path -eq 1 ]
 then
 	# Make a backup of the original nginx config file if modified
-	ynh_backup_if_checksum_is_different "$nginx_conf_path"
+	ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
 
 	# Set global variables for nginx helper
 	domain="$old_domain"
 	path_url="$new_path"
 
-	# Store path_url setting
-	ynh_app_setting_set $app path "$path_url"
-
 	# Create a dedicated nginx config
 	ynh_add_nginx_config
 fi
@@ -107,24 +93,24 @@ fi
 if [ $change_domain -eq 1 ]
 then
 	# Delete file checksum for the old conf file location
-	ynh_delete_file_checksum "$nginx_conf_path"
+	ynh_delete_file_checksum --file="$nginx_conf_path"
 	mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
 
 	# Store file checksum for the new config file location
-	ynh_store_file_checksum "/etc/nginx/conf.d/$new_domain.d/$app.conf"
+	ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
 fi
 
 #=================================================
 # RELOAD NGINX
 #=================================================
-ynh_script_progression --message="Reload nginx"
+ynh_script_progression --message="Reloading nginx web server..."
 
 ynh_systemd_action --action=reload --service_name=nginx
 
 #=================================================
 # CHECK ETHERPAD STARTING
 #=================================================
-ynh_script_progression --message="Restart Etherpad" --weight=10
+ynh_script_progression --message="Restarting Etherpad..." --weight=10
 
 # Wait for etherpad to be fully started
 ynh_systemd_action --action=restart --line_match="You can access your Etherpad instance at" --log_path="/var/log/$app/etherpad.log" --timeout="120"
@@ -132,7 +118,7 @@ ynh_systemd_action --action=restart --line_match="You can access your Etherpad i
 #=================================================
 # DEACTIVE MAINTENANCE MODE
 #=================================================
-ynh_script_progression --message="Disable maintenance mode" --weight=5
+ynh_script_progression --message="Disabling the maintenance mode..." --weight=5
 
 path_url=$old_path
 domain=$old_domain
@@ -142,4 +128,4 @@ ynh_maintenance_mode_OFF
 # END OF SCRIPT
 #=================================================
 
-ynh_script_progression --message="Change of url completed" --last
+ynh_script_progression --message="Change of URL completed for $app" --last
diff --git a/scripts/install b/scripts/install
index 1b0fd1d..340c7ca 100644
--- a/scripts/install
+++ b/scripts/install
@@ -25,7 +25,6 @@ ynh_abort_if_errors
 #=================================================
 # RETRIEVE ARGUMENTS FROM THE MANIFEST
 #=================================================
-ynh_script_progression --message="Retrieve arguments from the manifest"
 
 domain=$YNH_APP_ARG_DOMAIN
 path_url=$YNH_APP_ARG_PATH
@@ -42,54 +41,51 @@ app=$YNH_APP_INSTANCE_NAME
 #=================================================
 # CHECK IF THE APP CAN BE INSTALLED WITH THIS ARGS
 #=================================================
-ynh_script_progression --message="Check if the app can be installed"
+ynh_script_progression --message="Validating installation parameters..."
 
 ynh_print_OFF
 if [ "${#password}" -lt 8 ] || [ "${#password}" -gt 30 ]
 then
-	ynh_die "The password must be between 8 and 30 characters."
+	ynh_die --message="The password must be between 8 and 30 characters."
 fi
 ynh_print_ON
 
 final_path=/var/www/$app
 test ! -e "$final_path" || ynh_die "This path already contains a folder"
 
-# Normalize the url path syntax
-path_url=$(ynh_normalize_url_path $path_url)
-
 # Register (book) web path
-ynh_webpath_register $app $domain $path_url
+ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
 
 #=================================================
 # STORE SETTINGS FROM MANIFEST
 #=================================================
-ynh_script_progression --message="Store settings from manifest" --weight=3
+ynh_script_progression --message="Storing installation settings..." --weight=3
 
-ynh_app_setting_set $app domain $domain
-ynh_app_setting_set $app path $path_url
-ynh_app_setting_set $app admin $admin
-ynh_app_setting_set $app is_public $is_public
-ynh_print_OFF; ynh_app_setting_set $app password $password; ynh_print_ON
-ynh_app_setting_set $app language $language
-ynh_app_setting_set $app export $export
-ynh_app_setting_set $app mypads $mypads
-ynh_app_setting_set $app useldap $useldap
+ynh_app_setting_set --app=$app --key=domain --value=$domain
+ynh_app_setting_set --app=$app --key=path --value=$path_url
+ynh_app_setting_set --app=$app --key=admin --value=$admin
+ynh_app_setting_set --app=$app --key=is_public --value=$is_public
+ynh_print_OFF; ynh_app_setting_set --app=$app --key=password --value=$password; ynh_print_ON
+ynh_app_setting_set --app=$app --key=language --value=$language
+ynh_app_setting_set --app=$app --key=export --value=$export
+ynh_app_setting_set --app=$app --key=mypads --value=$mypads
+ynh_app_setting_set --app=$app --key=useldap --value=$useldap
 
 #=================================================
 # STANDARD MODIFICATIONS
 #=================================================
 # FIND AND OPEN A PORT
 #=================================================
-ynh_script_progression --message="Find a free port" --weight=2
+ynh_script_progression --message="Configuring firewall..." --weight=2
 
 # Find a free port
-port=$(ynh_find_port 9001)
-ynh_app_setting_set $app port $port
+port=$(ynh_find_port --port=9001)
+ynh_app_setting_set --app=$app --key=port --value=$port
 
 #=================================================
 # INSTALL DEPENDENCIES
 #=================================================
-ynh_script_progression --message="Install dependencies" --weight=120
+ynh_script_progression --message="Installing dependencies..." --weight=120
 
 if [ "$export" = "abiword" ]; then
 	ynh_install_app_dependencies $abiword_app_depencencies
@@ -100,32 +96,32 @@ fi
 #=================================================
 # INSTALL NODEJS
 #=================================================
-ynh_script_progression --message="Install NodeJS" --weight=12
+ynh_script_progression --message="Installing NodeJS..." --weight=12
 
-ynh_install_nodejs $nodejs_version
+ynh_install_nodejs --nodejs_version=$nodejs_version
 
 #=================================================
 # CREATE A MYSQL DATABASE
 #=================================================
-ynh_script_progression --message="Create a mysql database"
+ynh_script_progression --message="Creating a MySQL database..."
 
-db_name=$(ynh_sanitize_dbid $app)
-ynh_app_setting_set $app db_name $db_name
-ynh_mysql_setup_db $db_name $db_name
+db_name=$(ynh_sanitize_dbid --db_name=$app)
+ynh_app_setting_set --app=$app --key=db_name --value=$db_name
+ynh_mysql_setup_db --db_user=$db_name --db_name=$db_name
 
 #=================================================
 # DOWNLOAD, CHECK AND UNPACK SOURCE
 #=================================================
-ynh_script_progression --message="Download, check and unpack source" --weight=4
+ynh_script_progression --message="Setting up source files..." --weight=4
 
-ynh_app_setting_set $app final_path $final_path
-# Download, check integrity and uncompress the source from app.src
-ynh_setup_source "$final_path"
+ynh_app_setting_set --app=$app --key=final_path --value=$final_path
+# Download, check integrity, uncompress and patch the source from app.src
+ynh_setup_source --dest_dir="$final_path"
 
 #=================================================
 # NGINX CONFIGURATION
 #=================================================
-ynh_script_progression --message="Configure nginx" --weight=2
+ynh_script_progression --message="Configuring nginx web server..." --weight=2
 
 # Create a dedicated nginx config
 ynh_add_nginx_config
@@ -133,17 +129,17 @@ ynh_add_nginx_config
 #=================================================
 # CREATE DEDICATED USER
 #=================================================
-ynh_script_progression --message="Create a dedicated user" --weight=3
+ynh_script_progression --message="Configuring system user..." --weight=3
 
 # Create a dedicated system user
-ynh_system_user_create $app $final_path
+ynh_system_user_create --username=$app --home_dir=$final_path
 
 #=================================================
 # SPECIFIC SETUP
 #=================================================
 # HANDLE LOG FILES AND LOGROTATE
 #=================================================
-ynh_script_progression --message="Configure logrotate"
+ynh_script_progression --message="Configuring log rotation..."
 
 # Create log directory
 mkdir -p /var/log/$app
@@ -158,50 +154,50 @@ ynh_use_logrotate
 #=================================================
 # INSTALL ETHERPAD
 #=================================================
-ynh_script_progression --message="Install Etherpad" --weight=90
+ynh_script_progression --message="Installing Etherpad..." --weight=90
 
 # Install dependencies and proceed to the installation
 ynh_use_nodejs
-"$final_path/bin/installDeps.sh" > $install_log 2>&1
-npm install forever -g >> $install_log 2>&1
+"$final_path/bin/installDeps.sh" > $install_log 2>&1 || ( ynh_exec_err cat "$install_log"; false )
+npm install forever -g >> $install_log 2>&1 || ( ynh_exec_err cat "$install_log"; false )
 
 #=================================================
 # CONFIGURE ETHERPAD
 #=================================================
-ynh_script_progression --message="Configure Etherpad" --weight=6
+ynh_script_progression --message="Configuring Etherpad..." --weight=6
 
 cp ../conf/settings.json "$final_path/settings.json"
 cp ../conf/credentials.json "$final_path/credentials.json"
-ynh_replace_string "__PORT__" "$port" "$final_path/settings.json"
-ynh_replace_string "__DB_USER__" "$db_name" "$final_path/credentials.json"
-ynh_replace_string "__DB_PWD__" "$db_pwd" "$final_path/credentials.json"
-ynh_replace_string "__ADMIN__" "$admin" "$final_path/credentials.json"
-ynh_print_OFF; ynh_replace_special_string "__PASSWD__" "$password" "$final_path/credentials.json"; ynh_print_ON
+ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/settings.json"
+ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_name" --target_file="$final_path/credentials.json"
+ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$final_path/credentials.json"
+ynh_replace_string --match_string="__ADMIN__" --replace_string="$admin" --target_file="$final_path/credentials.json"
+ynh_print_OFF; ynh_replace_special_string --match_string="__PASSWD__" --replace_string="$password" --target_file="$final_path/credentials.json"; ynh_print_ON
 if [ "$export" = "abiword" ]
 then
 	# Get abiword binary path
 	abiword_path=`which abiword`
 	# Set the path of abiword into etherpad config
-	ynh_replace_string "\"abiword\" : null" "\"abiword\" : \"$abiword_path\"" "$final_path/settings.json"
+	ynh_replace_string --match_string="\"abiword\" : null" --replace_string="\"abiword\" : \"$abiword_path\"" --target_file="$final_path/settings.json"
 elif [ "$export" = "libreoffice" ]
 then
 	# Get soffice binary path
 	soffice_path=`which soffice`
 	# Set the path of soffice into etherpad config
-	ynh_replace_string "\"soffice\" : null" "\"soffice\" : \"$soffice_path\"" "$final_path/settings.json"
+	ynh_replace_string --match_string="\"soffice\" : null" --replace_string="\"soffice\" : \"$soffice_path\"" --target_file="$final_path/settings.json"
 fi
-ynh_replace_string "__LANGUAGE__" "$language" "$final_path/settings.json"
+ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" --target_file="$final_path/settings.json"
 
 # Use ldap for mypads
 if [ $mypads -eq 1 ] && [ $useldap -eq 1 ]
 then
-	ynh_replace_string "//noldap" "" "$final_path/settings.json"
+	ynh_replace_string --match_string="//noldap" --replace_string="" --target_file="$final_path/settings.json"
 fi
 
 # Calculate and store the config file checksum into the app settings
-ynh_store_file_checksum "$final_path/settings.json"
+ynh_store_file_checksum --file="$final_path/settings.json"
 # Calculate and store the config file checksum into the app settings
-ynh_store_file_checksum "$final_path/credentials.json"
+ynh_store_file_checksum --file="$final_path/credentials.json"
 
 #=================================================
 # SECURING FILES AND DIRECTORIES
@@ -215,9 +211,9 @@ chmod 600 $final_path/credentials.json
 #=================================================
 # SETUP SYSTEMD
 #=================================================
-ynh_script_progression --message="Configure systemd" --weight=4
+ynh_script_progression --message="Configuring a systemd service..." --weight=4
 
-ynh_replace_string "__ENV_PATH__" "$PATH" "../conf/systemd.service"
+ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service"
 # Create a dedicated systemd config
 ynh_add_systemd_config
 
@@ -230,7 +226,7 @@ yunohost service add $app --log "/var/log/$app/etherpad.log"
 #=================================================
 # INSTALL FRAMAPAD'S PLUGINS
 #=================================================
-ynh_script_progression --message="Install Etherpad plugins" --weight=90
+ynh_script_progression --message="Installing Etherpad plugins..." --weight=90
 
 pushd "$final_path"
 # Add Left/Center/Right/Justify to lines of text in a pad
@@ -275,11 +271,11 @@ chown -R $app: $final_path/node_modules
 if [ $mypads -eq 1 ]
 then
 	# Add a link to etherpad to allow anonymous pads creation from Mypads.
-	ynh_replace_string "^ *\"DESCRIPTION\": .*" "&Pads anonymes" $final_path/node_modules/ep_mypads/static/l10n/fr.json
-	ynh_replace_string "^ *\"DESCRIPTION\": .*" "&Anonymous pads" $final_path/node_modules/ep_mypads/static/l10n/en.json
+	ynh_replace_string --match_string="^ *\"DESCRIPTION\": .*" --replace_string="&Pads anonymes" --target_file=$final_path/node_modules/ep_mypads/static/l10n/fr.json
+	ynh_replace_string --match_string="^ *\"DESCRIPTION\": .*" --replace_string="&Anonymous pads" --target_file=$final_path/node_modules/ep_mypads/static/l10n/en.json
 	# And a link to etherpad admin from Mypads.
-	ynh_replace_string "^ *\"FOOTER\": .*2.0" "& | Etherpad admin" $final_path/node_modules/ep_mypads/static/l10n/en.json
-	ynh_replace_string "^ *\"FOOTER\": .*2.0" "& | Etherpad admin" $final_path/node_modules/ep_mypads/static/l10n/fr.json
+	ynh_replace_string --match_string="^ *\"FOOTER\": .*2.0" --replace_string="& | Etherpad admin" --target_file=$final_path/node_modules/ep_mypads/static/l10n/en.json
+	ynh_replace_string --match_string="^ *\"FOOTER\": .*2.0" --replace_string="& | Etherpad admin" --target_file=$final_path/node_modules/ep_mypads/static/l10n/fr.json
 
 	# Find the /div just after the field to open a pad
 	mod_line=$(grep -nA5 "index.createOpenPad" $final_path/src/templates/index.html | grep "" | cut -d '-' -f 1)
@@ -290,7 +286,7 @@ fi
 #=================================================
 # SETUP FAIL2BAN
 #=================================================
-ynh_script_progression --message="Configure fail2ban" --weight=13
+ynh_script_progression --message="Configuring fail2ban..." --weight=13
 
 # Create a dedicated fail2ban config
 ynh_add_fail2ban_config --logpath="/var/log/nginx/$domain-access.log" --failregex=" .* .POST /mypads/api/auth/login HTTP/1.1. 400" --max_retry=5
@@ -298,33 +294,33 @@ ynh_add_fail2ban_config --logpath="/var/log/nginx/$domain-access.log" --failrege
 #=================================================
 # SETUP SSOWAT
 #=================================================
-ynh_script_progression --message="Setup SSOwat"
+ynh_script_progression --message="Configuring SSOwat..."
 
 if [ $is_public -eq 1 ]; then
-	ynh_app_setting_set $app skipped_uris "/"
+	ynh_app_setting_set --app=$app --key=skipped_uris --value="/"
 else
 	# etherpad admin page doesn't support SSO...
-	ynh_app_setting_set $app skipped_uris "/admin"
+	ynh_app_setting_set --app=$app --key=skipped_uris --value="/admin"
 fi
 
 #=================================================
 # RELOAD NGINX
 #=================================================
-ynh_script_progression --message="Reload nginx"
+ynh_script_progression --message="Reloading nginx web server..."
 
 ynh_systemd_action --action=reload --service_name=nginx
 
 #=================================================
 # CHECK ETHERPAD STARTING
 #=================================================
-ynh_script_progression --message="Restart Etherpad" --weight=20
+ynh_script_progression --message="Restarting Etherpad..." --weight=20
 
 # Wait for etherpad to be fully started
 ynh_systemd_action --action=restart --line_match="You can access your Etherpad instance at" --log_path="/var/log/$app/etherpad.log" --timeout="120"
 
 if [ $mypads -eq 1 ]
 then
-	ynh_replace_string "__LANGUAGE__" "$language" "../conf/lang_mypads.sql"
+	ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" --target_file="../conf/lang_mypads.sql"
 	mysql -u $db_name -p$db_pwd $db_name < "../conf/lang_mypads.sql"
 
 	# Wait for etherpad to be fully started
@@ -343,20 +339,20 @@ else
 fi
 
 ynh_print_OFF
-message="$Informations
+echo "$Informations
 Or, you can find a config file for etherpad at this path /var/www/etherpad_mypads/settings.json.
 
 Your credentials for the admin panel are:
 - login		: $admin
 - password	: $password
 
-If you are facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/etherpad_mypads_ynh"
+If you are facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/etherpad_mypads_ynh" > mail_to_send
 
-ynh_send_readme_to_admin "$message" "$admin"
+ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="$admin" --type=install
 ynh_print_ON
 
 #=================================================
 # END OF SCRIPT
 #=================================================
 
-ynh_script_progression --message="Installation completed" --last
+ynh_script_progression --message="Installation of $app completed" --last
diff --git a/scripts/remove b/scripts/remove
index ac31a9c..1087332 100755
--- a/scripts/remove
+++ b/scripts/remove
@@ -12,43 +12,43 @@ source /usr/share/yunohost/helpers
 #=================================================
 # LOAD SETTINGS
 #=================================================
-ynh_script_progression --message="Load settings" --weight=3
+ynh_script_progression --message="Loading installation settings..." --weight=3
 
 app=$YNH_APP_INSTANCE_NAME
 
-domain=$(ynh_app_setting_get $app domain)
-port=$(ynh_app_setting_get $app port)
-db_name=$(ynh_app_setting_get $app db_name)
-export=$(ynh_app_setting_get $app export)
+domain=$(ynh_app_setting_get --app=$app --key=domain)
+port=$(ynh_app_setting_get --app=$app --key=port)
+db_name=$(ynh_app_setting_get --app=$app --key=db_name)
+export=$(ynh_app_setting_get --app=$app --key=export)
 
 #=================================================
 # STANDARD REMOVE
-#=================================================
-# STOP AND REMOVE SERVICE
-#=================================================
-ynh_script_progression --message="Stop and remove the service" --weight=2
-
-# Remove the dedicated systemd config
-ynh_remove_systemd_config
-
 #=================================================
 # REMOVE SERVICE FROM ADMIN PANEL
 #=================================================
 
-# Check if the service is declared in YunoHost
-if yunohost service status | grep -q $app
+# Remove a service from the admin panel, added by `yunohost service add`
+if yunohost service status $app >/dev/null 2>&1
 then
-	ynh_print_info "Remove $app service"
+	ynh_script_progression --message="Removing $app service..."
 	yunohost service remove $app
 fi
 
+#=================================================
+# STOP AND REMOVE SERVICE
+#=================================================
+ynh_script_progression --message="Stopping and removing the systemd service..." --weight=2
+
+# Remove the dedicated systemd config
+ynh_remove_systemd_config
+
 #=================================================
 # REMOVE DEPENDENCIES
 #=================================================
 
 if [ "$export" != "none" ]
 then
-	ynh_script_progression --message="Remove dependencies" --weight=60
+	ynh_script_progression --message="Removing dependencies..." --weight=60
 	# Remove metapackage and its dependencies
 	ynh_remove_app_dependencies
 fi
@@ -56,30 +56,30 @@ fi
 #=================================================
 # REMOVE NODEJS
 #=================================================
-ynh_script_progression --message="Remove NodeJS version for Etherpad" --weight=3
+ynh_script_progression --message="Removing NodeJS version for Etherpad..." --weight=3
 
 ynh_remove_nodejs
 
 #=================================================
 # REMOVE THE MYSQL DATABASE
 #=================================================
-ynh_script_progression --message="Remove the mysql database" --weight=2
+ynh_script_progression --message="Removing the MySQL database..." --weight=2
 
 # Remove a database if it exists, along with the associated user
-ynh_mysql_remove_db $db_name $db_name
+ynh_mysql_remove_db --db_user=$db_name --db_name=$db_name
 
 #=================================================
 # REMOVE APP MAIN DIR
 #=================================================
-ynh_script_progression --message="Remove app main directory"
+ynh_script_progression --message="Removing app main directory..."
 
 # Remove the app directory securely
-ynh_secure_remove "/var/www/$app"
+ynh_secure_remove --file="/var/www/$app"
 
 #=================================================
 # REMOVE NGINX CONFIGURATION
 #=================================================
-ynh_script_progression --message="Remove nginx configuration" --weight=2
+ynh_script_progression --message="Removing nginx web server configuration..." --weight=2
 
 # Remove the dedicated nginx config
 ynh_remove_nginx_config
@@ -87,7 +87,7 @@ ynh_remove_nginx_config
 #=================================================
 # REMOVE LOGROTATE CONFIGURATION
 #=================================================
-ynh_script_progression --message="Remove logrotate configuration"
+ynh_script_progression --message="Removing logrotate configuration..."
 
 # Remove the app-specific logrotate config
 ynh_remove_logrotate
@@ -95,7 +95,7 @@ ynh_remove_logrotate
 #=================================================
 # REMOVE FAIL2BAN CONFIGURATION
 #=================================================
-ynh_script_progression --message="Remove fail2ban configuration" --weight=7
+ynh_script_progression --message="Removing fail2ban configuration..." --weight=7
 
 # Remove the dedicated fail2ban config
 ynh_remove_fail2ban_config
@@ -105,13 +105,13 @@ ynh_remove_fail2ban_config
 #=================================================
 # REMOVE DEDICATED USER
 #=================================================
-ynh_script_progression --message="Remove the dedicated user" --weight=2
+ynh_script_progression --message="Removing the dedicated system user..." --weight=2
 
 # Delete dedicated system user
-ynh_system_user_delete $app
+ynh_system_user_delete --username=$app
 
 #=================================================
 # END OF SCRIPT
 #=================================================
 
-ynh_script_progression --message="Deletion completed" --last
+ynh_script_progression --message="Removal of $app completed" --last
diff --git a/scripts/restore b/scripts/restore
index 2bf11f4..1948604 100644
--- a/scripts/restore
+++ b/scripts/restore
@@ -25,32 +25,33 @@ ynh_abort_if_errors
 #=================================================
 # LOAD SETTINGS
 #=================================================
-ynh_script_progression --message="Load settings" --weight=4
+ynh_script_progression --message="Loading settings.." --weight=3
 
 app=$YNH_APP_INSTANCE_NAME
 
-domain=$(ynh_app_setting_get $app domain)
-path_url=$(ynh_app_setting_get $app path)
-final_path=$(ynh_app_setting_get $app final_path)
-db_name=$(ynh_app_setting_get $app db_name)
-export=$(ynh_app_setting_get $app export)
-mypads=$(ynh_app_setting_get $app mypads)
-admin=$(ynh_app_setting_get $app admin)
-ynh_print_OFF; password=$(ynh_app_setting_get $app password); ynh_print_ON
+domain=$(ynh_app_setting_get --app=$app --key=domain)
+path_url=$(ynh_app_setting_get --app=$app --key=path)
+final_path=$(ynh_app_setting_get --app=$app --key=final_path)
+db_name=$(ynh_app_setting_get --app=$app --key=db_name)
+export=$(ynh_app_setting_get --app=$app --key=export)
+mypads=$(ynh_app_setting_get --app=$app --key=mypads)
+admin=$(ynh_app_setting_get --app=$app --key=admin)
+ynh_print_OFF; password=$(ynh_app_setting_get --app=$app --key=password); ynh_print_ON
 
 #=================================================
 # CHECK IF THE APP CAN BE RESTORED
 #=================================================
+ynh_script_progression --message="Validating restoration parameters..."
 
-ynh_webpath_available $domain $path_url \
-	|| ynh_die "Path not available: ${domain}${path_url}"
+ynh_webpath_available --domain=$domain --path_url=$path_url \
+	|| ynh_die --message="Path not available: ${domain}${path_url}"
 test ! -d $final_path \
-	|| ynh_die "There is already a directory: $final_path "
+	|| ynh_die --message="There is already a directory: $final_path "
 
 #=================================================
 # ACTIVATE MAINTENANCE MODE
 #=================================================
-ynh_script_progression --message="Activate maintenance mode" --weight=2
+ynh_script_progression --message="Activating maintenance mode..." --weight=2
 
 ynh_maintenance_mode_ON
 
@@ -60,31 +61,31 @@ ynh_maintenance_mode_ON
 # RESTORE THE NGINX CONFIGURATION
 #=================================================
 
-ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
+ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
 
 #=================================================
 # RESTORE THE APP MAIN DIR
 #=================================================
-ynh_script_progression --message="Restore the app main directory"
+ynh_script_progression --message="Restoring the app main directory..."
 
-ynh_restore_file "$final_path"
+ynh_restore_file --origin_path="$final_path"
 
 #=================================================
 # RESTORE THE MYSQL DATABASE
 #=================================================
-ynh_script_progression --message="Restore the mysql database"
+ynh_script_progression --message="Restoring the MySQL database..."
 
-db_pwd=$(ynh_app_setting_get $app mysqlpwd)
-ynh_mysql_setup_db $db_name $db_name $db_pwd
-ynh_mysql_connect_as $db_name $db_pwd $db_name < ./db.sql
+db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
+ynh_mysql_setup_db --db_user=$db_name --db_name=$db_name --db_pwd=$db_pwd
+ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ./db.sql
 
 #=================================================
 # RECREATE THE DEDICATED USER
 #=================================================
-ynh_script_progression --message="Recreate the dedicated user" --weight=2
+ynh_script_progression --message="Recreating the dedicated system user..." --weight=2
 
 # Create the dedicated user (if not existing)
-ynh_system_user_create $app $final_path
+ynh_system_user_create --username=$app --home_dir=$final_path
 
 #=================================================
 # SPECIFIC RESTORE
@@ -100,12 +101,12 @@ chown $app -R /var/log/$app
 chown admin -R $install_log
 
 # Restore logrotate configuration
-ynh_restore_file "/etc/logrotate.d/$app"
+ynh_restore_file --origin_path="/etc/logrotate.d/$app"
 
 #=================================================
 # INSTALL DEPENDENCIES
 #=================================================
-ynh_script_progression --message="Reinstall dependencies" --weight=60
+ynh_script_progression --message="Reinstalling dependencies..." --weight=60
 
 if [ "$export" = "abiword" ]; then
 	ynh_install_app_dependencies $abiword_app_depencencies
@@ -116,14 +117,14 @@ fi
 #=================================================
 # INSTALL NODEJS
 #=================================================
-ynh_script_progression --message="Reinstall NodeJS" --weight=7
+ynh_script_progression --message="Reinstalling NodeJS..." --weight=7
 
-ynh_install_nodejs $nodejs_version
+ynh_install_nodejs --nodejs_version=$nodejs_version
 
 #=================================================
 # INSTALL ETHERPAD DEPENDENCIES
 #=================================================
-ynh_script_progression --message="Reinstall Etherpad node dependencies" --weight=17
+ynh_script_progression --message="Reinstalling Etherpad node dependencies..." --weight=17
 
 ynh_use_nodejs
 npm cache clean
@@ -145,15 +146,15 @@ yunohost service add $app --log "/var/log/$app/etherpad.log"
 #=================================================
 # RESTORE SYSTEMD
 #=================================================
-ynh_script_progression --message="Restore the systemd configuration"
+ynh_script_progression --message="Restoring the systemd configuration..."
 
-ynh_restore_file "/etc/systemd/system/$app.service"
+ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
 systemctl enable $app.service
 
 #=================================================
 # RESTORE FAIL2BAN CONFIGURATION
 #=================================================
-ynh_script_progression --message="Restore the fail2ban configuration" --weight=6
+ynh_script_progression --message="Restoring the fail2ban configuration..." --weight=6
 
 ynh_restore_file "/etc/fail2ban/jail.d/$app.conf"
 ynh_restore_file "/etc/fail2ban/filter.d/$app.conf"
@@ -162,14 +163,14 @@ ynh_systemd_action --action=restart --service_name=fail2ban
 #=================================================
 # RELOAD NGINX
 #=================================================
-ynh_script_progression --message="Reload nginx"
+ynh_script_progression --message="Reloading nginx web server..."
 
 ynh_systemd_action --action=reload --service_name=nginx
 
 #=================================================
 # CHECK ETHERPAD STARTING
 #=================================================
-ynh_script_progression --message="Restart Etherpad" --weight=8
+ynh_script_progression --message="Restarting Etherpad..." --weight=8
 
 # Wait for etherpad to be fully started
 ynh_systemd_action --action=restart --line_match="You can access your Etherpad instance at" --log_path="/var/log/$app/etherpad.log" --timeout="120"
@@ -177,7 +178,7 @@ ynh_systemd_action --action=restart --line_match="You can access your Etherpad i
 #=================================================
 # DEACTIVE MAINTENANCE MODE
 #=================================================
-ynh_script_progression --message="Disable maintenance mode" --weight=7
+ynh_script_progression --message="Disabling maintenance mode..." --weight=7
 
 ynh_maintenance_mode_OFF
 
@@ -193,20 +194,20 @@ else
 fi
 
 ynh_print_OFF
-message="$Informations
+echo "$Informations
 Or, you can find a config file for etherpad at this path /var/www/etherpad_mypads/settings.json.
 
 Your credentials for the admin panel are:
 - login		: $admin
 - password	: $password
 
-If you are facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/etherpad_mypads_ynh"
+If you are facing an issue or want to improve this app, please open a new issue in this project: https://github.com/YunoHost-Apps/etherpad_mypads_ynh" > mail_to_send
 
-ynh_send_readme_to_admin "$message" "$admin"
+ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="$admin" --type=restore
 ynh_print_ON
 
 #=================================================
 # END OF SCRIPT
 #=================================================
 
-ynh_script_progression --message="Restoration completed" --last
+ynh_script_progression --message="Restoration completed for $app" --last
diff --git a/scripts/upgrade b/scripts/upgrade
index 5344955..a7a3162 100644
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -14,21 +14,21 @@ source _variables
 #=================================================
 # LOAD SETTINGS
 #=================================================
-ynh_script_progression --message="Load settings" --weight=20
+ynh_script_progression --message="Loading installation settings..." --weight=20
 
 app=$YNH_APP_INSTANCE_NAME
 
-domain=$(ynh_app_setting_get $app domain)
-path_url=$(ynh_app_setting_get $app path)
-admin=$(ynh_app_setting_get $app admin)
-language=$(ynh_app_setting_get $app language)
-is_public=$(ynh_app_setting_get $app is_public)
-final_path=$(ynh_app_setting_get $app final_path)
-port=$(ynh_app_setting_get $app port)
-export=$(ynh_app_setting_get $app export)
-db_name=$(ynh_app_setting_get $app db_name)
-mypads=$(ynh_app_setting_get $app mypads)
-useldap=$(ynh_app_setting_get $app useldap)
+domain=$(ynh_app_setting_get --app=$app --key=domain)
+path_url=$(ynh_app_setting_get --app=$app --key=path)
+admin=$(ynh_app_setting_get --app=$app --key=admin)
+language=$(ynh_app_setting_get --app=$app --key=language)
+is_public=$(ynh_app_setting_get --app=$app --key=is_public)
+final_path=$(ynh_app_setting_get --app=$app --key=final_path)
+port=$(ynh_app_setting_get --app=$app --key=port)
+export=$(ynh_app_setting_get --app=$app --key=export)
+db_name=$(ynh_app_setting_get --app=$app --key=db_name)
+mypads=$(ynh_app_setting_get --app=$app --key=mypads)
+useldap=$(ynh_app_setting_get --app=$app --key=useldap)
 
 #=================================================
 # CHECK VERSION
@@ -42,66 +42,66 @@ upgrade_type=$(ynh_check_app_version_changed)
 #=================================================
 # ENSURE DOWNWARD COMPATIBILITY
 #=================================================
-ynh_script_progression --message="Ensure downward compatibility" --weight=2
+ynh_script_progression --message="Ensuring downward compatibility..." --weight=2
 
-# Convert is_public as a boolean
+# Fix is_public as a boolean value
 if [ "$is_public" = "Yes" ]; then
-	ynh_app_setting_set $app is_public 1
+	ynh_app_setting_set --app=$app --key=is_public --value=1
 	is_public=1
 elif [ "$is_public" = "No" ]; then
-	ynh_app_setting_set $app is_public 0
+	ynh_app_setting_set --app=$app --key=is_public --value=0
 	is_public=0
 fi
 
-# If db_name setting doesn't exist
-if [ -z $db_name ]; then
-	db_name=$(ynh_sanitize_dbid $app)
-	ynh_app_setting_set $app db_name $db_name
+# If db_name doesn't exist, create it
+if [ -z "$db_name" ]; then
+	db_name=$(ynh_sanitize_dbid --db_name=$app)
+	ynh_app_setting_set --app=$app --key=db_name --value=$db_name
 fi
 
 # If abiword setting doesn't exist
-if [ -z $abiword ]; then
+if [ -z "$abiword" ]; then
 	abiword=0
-	ynh_app_setting_set $app abiword $abiword
+	ynh_app_setting_set --app=$app --key=abiword --value=$abiword
 fi
 
 # If abiword setting exists
-if [ -n $abiword ]; then
+if [ -n "$abiword" ]; then
 	if [ $abiword -eq 1 ]; then
 		export=abiword
 	fi
-	ynh_app_setting_set $app export $export
-	ynh_app_setting_delete $app abiword
+	ynh_app_setting_set --app=$app --key=export --value=$export
+	ynh_app_setting_delete --app=$app --key=abiword
 fi
 
 # If export setting doesn't exist
-if [ -z $export ]; then
+if [ -z "$export" ]; then
 	export=none
-	ynh_app_setting_set $app export $export
+	ynh_app_setting_set --app=$app --key=export --value=$export
 fi
 
 # If mypads setting doesn't exist
-if [ -z $mypads ]; then
+if [ -z "$mypads" ]; then
 	mypads=1
-	ynh_app_setting_set $app mypads $mypads
+	ynh_app_setting_set --app=$app --key=mypads --value=$mypads
 fi
 
 # If useldap setting doesn't exist
-if [ -z $useldap ]; then
+if [ -z "$useldap" ]; then
 	useldap=0
-	ynh_app_setting_set $app useldap $useldap
+	ynh_app_setting_set --app=$app --key=useldap --value=$useldap
 fi
 
 # If path_url setting doesn't exist
-if [ -z $path_url ]; then
+if [ -z "$path_url" ]; then
 	path_url="/"
-	ynh_app_setting_set $app path $path_url
+	ynh_app_setting_set --app=$app --key=path --value=$path_url
 fi
 
 #=================================================
 # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
 #=================================================
-ynh_script_progression --message="Backup the app before upgrading" --weight=35
+ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=35
 
 # Backup the current version of the app
 ynh_backup_before_upgrade
@@ -118,14 +118,14 @@ ynh_abort_if_errors
 #=================================================
 # ACTIVATE MAINTENANCE MODE
 #=================================================
-ynh_script_progression --message="Activate maintenance mode" --weight=2
+ynh_script_progression --message="Activating maintenance mode..." --weight=2
 
 ynh_maintenance_mode_ON
 
 #=================================================
 # STOP ETHERPAD
 #=================================================
-ynh_script_progression --message="Stop Etherpad service" --weight=3
+ynh_script_progression --message="Stopping Etherpad service..." --weight=3
 
 ynh_systemd_action --action=stop
 
@@ -137,14 +137,16 @@ ynh_systemd_action --action=stop
 
 if [ "$upgrade_type" == "UPGRADE_APP" ]
 then
+	ynh_script_progression --message="Upgrading source files..." --time --weight=1
+
 	# Download, check integrity, uncompress and patch the source from app.src
-	ynh_setup_source "$final_path"
+	ynh_setup_source --dest_dir="$final_path"
 fi
 
 #=================================================
 # UPGRADE DEPENDENCIES
 #=================================================
-ynh_script_progression --message="Download, check and unpack source" --weight=5
+ynh_script_progression --message="Upgrading dependencies..." --weight=5
 
 if [ "$export" = "abiword" ]; then
 	ynh_install_app_dependencies $abiword_app_depencencies
@@ -155,7 +157,7 @@ fi
 #=================================================
 # NGINX CONFIGURATION
 #=================================================
-ynh_script_progression --message="Reconfigure nginx"
+ynh_script_progression --message="Upgrading nginx web server configuration..."
 
 # Create a dedicated nginx config
 ynh_add_nginx_config
@@ -163,21 +165,21 @@ ynh_add_nginx_config
 #=================================================
 # UPGRADE NODEJS
 #=================================================
-ynh_script_progression --message="Upgrade NodeJS" --weight=4
+ynh_script_progression --message="Upgrading NodeJS..." --weight=4
 
 # Remove the old nvm helper.
 if [ -d /opt/nvm ]
 then
-	ynh_secure_remove "/opt/nvm"
+	ynh_secure_remove --file="/opt/nvm"
 	sed --in-place "/NVM_DIR/d" /root/.bashrc
 fi
 
-ynh_install_nodejs $nodejs_version
+ynh_install_nodejs --nodejs_version=$nodejs_version
 
 #=================================================
 # UPGRADE NPM MODULES
 #=================================================
-ynh_script_progression --message="Upgrade Etherpad npm modules" --weight=60
+ynh_script_progression --message="Upgrading Etherpad npm modules..." --weight=60
 
 # Update the main modules of etherpad
 (cd "$final_path/src"
@@ -201,59 +203,60 @@ done <<< "$(ls -1 "$final_path/node_modules" | grep "^ep_")")
 
 if [ "$upgrade_type" == "UPGRADE_APP" ]
 then
-	ynh_script_progression --message="Reconfigure Etherpad" --weight=3
+	ynh_script_progression --message="Reconfiguring Etherpad..." --weight=3
+
 	# Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
-	ynh_backup_if_checksum_is_different "$final_path/settings.json"
+	ynh_backup_if_checksum_is_different --file="$final_path/settings.json"
 	# Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
-	ynh_backup_if_checksum_is_different "$final_path/credentials.json"
+	ynh_backup_if_checksum_is_different --file="$final_path/credentials.json"
 	cp ../conf/settings.json "$final_path/settings.json"
 	cp ../conf/credentials.json "$final_path/credentials.json"
-	ynh_replace_string "__PORT__" "$port" "$final_path/settings.json"
-	ynh_replace_string "__DB_USER__" "$app" "$final_path/credentials.json"
-	db_pwd=$(ynh_app_setting_get $app mysqlpwd)
-	ynh_print_OFF; password=$(ynh_app_setting_get $app password); ynh_print_ON
-	ynh_replace_string "__DB_PWD__" "$db_pwd" "$final_path/credentials.json"
-	ynh_replace_string "__ADMIN__" "$admin" "$final_path/credentials.json"
-	ynh_print_OFF; ynh_replace_special_string "__PASSWD__" "$password" "$final_path/credentials.json"; ynh_print_ON
+	ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/settings.json"
+	ynh_replace_string --match_string="__DB_USER__" --replace_string="$app" --target_file="$final_path/credentials.json"
+	db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
+	ynh_print_OFF; password=$(ynh_app_setting_get --app=$app --key=password); ynh_print_ON
+	ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$final_path/credentials.json"
+	ynh_replace_string --match_string="__ADMIN__" --replace_string="$admin" --target_file="$final_path/credentials.json"
+	ynh_print_OFF; ynh_replace_special_string --match_string="__PASSWD__" --replace_string="$password" --target_file="$final_path/credentials.json"; ynh_print_ON
 	if [ "$export" = "abiword" ]
 	then
 		# Get abiword binary path
 		abiword_path=`which abiword`
 		# Set the path of abiword into etherpad config
-		ynh_replace_string "\"abiword\" : null" "\"abiword\" : \"$abiword_path\"" "$final_path/settings.json"
+		ynh_replace_string --match_string="\"abiword\" : null" --replace_string="\"abiword\" : \"$abiword_path\"" --target_file="$final_path/settings.json"
 	elif [ "$export" = "libreoffice" ]
 	then
 		# Get soffice binary path
 		soffice_path=`which soffice`
 		# Set the path of soffice into etherpad config
-		ynh_replace_string "\"soffice\" : null" "\"soffice\" : \"$soffice_path\"" "$final_path/settings.json"
+		ynh_replace_string --match_string="\"soffice\" : null" --replace_string="\"soffice\" : \"$soffice_path\"" --target_file="$final_path/settings.json"
 	fi
-	if test -z $language; then
+	if test -z "$language"; then
 		# If upgrading from a version which doesn't support translations, set language to English by default
 		language=en
-		ynh_app_setting_set $app language $language
+		ynh_app_setting_set --app=$app --key=language --value=$language
 	fi
-	ynh_replace_string "__LANGUAGE__" "$language" "$final_path/settings.json"
+	ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" --target_file="$final_path/settings.json"
 
 	# Use ldap for mypads
 	if [ $mypads -eq 1 ] && [ $useldap -eq 1 ]
 	then
-		ynh_replace_string "//noldap" "" "$final_path/settings.json"
+		ynh_replace_string --match_string="//noldap" --replace_string="" --target_file="$final_path/settings.json"
 	fi
 
 	# Recalculate and store the checksum of the file for the next upgrade.
-	ynh_store_file_checksum "$final_path/settings.json"
+	ynh_store_file_checksum --file="$final_path/settings.json"
 	# Recalculate and store the checksum of the file for the next upgrade.
-	ynh_store_file_checksum "$final_path/credentials.json"
+	ynh_store_file_checksum --file="$final_path/credentials.json"
 fi
 
 #=================================================
 # CREATE DEDICATED USER
 #=================================================
-ynh_script_progression --message="Create a dedicated user"
+ynh_script_progression --message="Making sure dedicated system user exists..."
 
 # Create a dedicated user (if not existing)
-ynh_system_user_create $app $final_path
+ynh_system_user_create --username=$app --home_dir=$final_path
 
 #=================================================
 # SECURING FILES AND DIRECTORIES
@@ -268,7 +271,7 @@ chown $app -R /var/log/$app/etherpad.log
 #=================================================
 # UPGRADE FAIL2BAN
 #=================================================
-ynh_script_progression --message="Reconfigure fail2ban" --weight=8
+ynh_script_progression --message="Reconfiguring fail2ban..." --weight=8
 
 # Create a dedicated fail2ban config
 ynh_add_fail2ban_config --logpath="/var/log/nginx/$domain-access.log" --failregex=" .* .POST /mypads/api/auth/login HTTP/1.1. 400" --max_retry=5
@@ -276,7 +279,7 @@ ynh_add_fail2ban_config --logpath="/var/log/nginx/$domain-access.log" --failrege
 #=================================================
 # SETUP LOGROTATE
 #=================================================
-ynh_script_progression --message="Reconfigure logrotate"
+ynh_script_progression --message="Upgrading logrotate configuration..."
 
 # Use logrotate to manage app-specific logfile(s)
 ynh_use_logrotate --non-append
@@ -284,9 +287,9 @@ ynh_use_logrotate --non-append
 #=================================================
 # SETUP SYSTEMD
 #=================================================
-ynh_script_progression --message="Reconfigure systemd" --weight=2
+ynh_script_progression --message="Upgrading systemd configuration..." --weight=2
 
-ynh_replace_string "__ENV_PATH__" "$PATH" "../conf/systemd.service"
+ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service"
 # Create a dedicated systemd config
 ynh_add_systemd_config
 
@@ -305,27 +308,27 @@ fi
 #=================================================
 # SETUP SSOWAT
 #=================================================
-ynh_script_progression --message="Reconfigure SSOwat"
+ynh_script_progression --message="Upgrading SSOwat configuration..."
 
 # Make app public if necessary
 if [ $is_public -eq 1 ]; then
-	ynh_app_setting_set $app skipped_uris "/"
+	ynh_app_setting_set --app=$app --key=skipped_uris --value="/"
 else
 	# etherpad admin page doesn't support SSO...
-	ynh_app_setting_set $app skipped_uris "/admin"
+	ynh_app_setting_set --app=$app --key=skipped_uris --value="/admin"
 fi
 
 #=================================================
 # RELOAD NGINX
 #=================================================
-ynh_script_progression --message="Reload nginx"
+ynh_script_progression --message="Reloading nginx web server..."
 
 ynh_systemd_action --action=reload --service_name=nginx
 
 #=================================================
 # CHECK ETHERPAD STARTING
 #=================================================
-ynh_script_progression --message="Restart Etherpad" --weight=9
+ynh_script_progression --message="Restarting Etherpad..." --weight=9
 
 # Wait for etherpad to be fully started
 ynh_systemd_action --action=restart --line_match="You can access your Etherpad instance at" --log_path="/var/log/$app/etherpad.log" --timeout="120"
@@ -333,7 +336,7 @@ ynh_systemd_action --action=restart --line_match="You can access your Etherpad i
 #=================================================
 # DEACTIVE MAINTENANCE MODE
 #=================================================
-ynh_script_progression --message="Disable maintenance mode" --weight=5
+ynh_script_progression --message="Disabling maintenance mode..." --weight=5
 
 ynh_maintenance_mode_OFF
 
@@ -341,4 +344,4 @@ ynh_maintenance_mode_OFF
 # END OF SCRIPT
 #=================================================
 
-ynh_script_progression --message="Upgrade completed" --last
+ynh_script_progression --message="Upgrade of $app completed" --last

From f6e287d81e51876bc43587bc10765ba17dc85acf Mon Sep 17 00:00:00 2001
From: Maniack Crudelis 
Date: Mon, 6 May 2019 23:34:08 +0200
Subject: [PATCH 3/3] Fix missing comma

---
 manifest.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/manifest.json b/manifest.json
index e00b25b..487ac1c 100644
--- a/manifest.json
+++ b/manifest.json
@@ -80,7 +80,7 @@
 				"help": {
 					"en": "If your etherpad instance is public, everyone will be able to create a pad or see an existing one.",
 					"fr": "Si votre instance etherpad est publique, tout le monde pourra créer un pad ou voir un existant."
-                }
+				},
 				"default": true
 			},
 			{