ソースを参照

Fix bug dans .fonctions

magikcypress 8 年 前
コミット
203a62b842
2 ファイル変更26 行追加6 行削除
  1. 25 5
      scripts/.fonctions
  2. 1 1
      scripts/install

+ 25 - 5
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
 }
 
 #=================================================

+ 1 - 1
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