From 203a62b842819da0dce20c0d05bd0ddd0c92f49a Mon Sep 17 00:00:00 2001 From: magikcypress Date: Sat, 11 Mar 2017 23:05:32 +0100 Subject: [PATCH] Fix bug dans .fonctions --- scripts/.fonctions | 30 +++++++++++++++++++++++++----- scripts/install | 2 +- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/scripts/.fonctions b/scripts/.fonctions index 9086fc9..e011d9c 100644 --- a/scripts/.fonctions +++ b/scripts/.fonctions @@ -85,11 +85,31 @@ POOL_FPM () { # Créer le fichier de configuration du pool php-fpm et le configu sudo service php5-fpm reload } -YNH_CURL () { - data_post=$1 - url_access=$2 - sleep 1 - SUPPRESS_WARNING curl -kL -H \"Host: $domain\" --resolve $domain:443:127.0.0.1 --data \"$data_post\" \"https://localhost$path_url$url_access\" +EXIT_PROPERLY () { # Causes the script to stop in the event of an error. And clean the residue. + trap '' ERR + echo -e "\e[91m \e[1m" # Shell in light red bold + echo -e "!!\n $app install's script has encountered an error. Installation was cancelled.\n!!" >&2 + + if type -t CLEAN_SETUP > /dev/null; then # Checks the existence of the function before executing it. + CLEAN_SETUP # Call the specific cleanup function of the install script. + fi + + # Compensates the ssowat bug that does not remove the app's input in case of installation error. + sudo sed -i "\@\"$domain$path/\":@d" /etc/ssowat/conf.json + + if [ "$ynh_version" = "2.2" ]; then + /bin/bash $script_dir/remove + fi + + ynh_die +} + +TRAP_ON () { # Activate signal capture + trap EXIT_PROPERLY ERR # Capturing exit signals on error +} + +TRAP_OFF () { # Ignoring signal capture until TRAP_ON + trap '' ERR # Ignoring exit signals } #================================================= diff --git a/scripts/install b/scripts/install index e90302e..2128b5d 100644 --- a/scripts/install +++ b/scripts/install @@ -18,7 +18,7 @@ source /usr/share/yunohost/helpers # MANAGE FAILURE OF THE SCRIPT #================================================= -ynh_check_error # Active trap pour arrêter le script si une erreur est détectée. +TRAP_ON # Active trap to stop the script if an error is detected. #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST