From 5e08c27175dff4d216f6a212fca3ed94f1799f39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Sun, 21 Oct 2018 17:55:39 +0200 Subject: [PATCH] use ynh error handler helper --- scripts/backup | 9 +++++++-- scripts/remove | 10 +++++++--- scripts/upgrade | 12 +++++++++--- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/scripts/backup b/scripts/backup index ed78b56..6853c67 100755 --- a/scripts/backup +++ b/scripts/backup @@ -1,10 +1,15 @@ #!/bin/bash -set -eu - # Source app helpers . /usr/share/yunohost/helpers +#================================================= +# MANAGE SCRIPT FAILURE +#================================================= + +# Exit if an error occurs during the execution of the script +ynh_abort_if_errors + # retrieve useful param app=$YNH_APP_INSTANCE_NAME path=/var/www/$app diff --git a/scripts/remove b/scripts/remove index aa12077..45e7e7e 100755 --- a/scripts/remove +++ b/scripts/remove @@ -1,11 +1,15 @@ #!/bin/bash -# Exit on command errors and treat unset variables as an error -set -u - # Source app helpers . /usr/share/yunohost/helpers +#================================================= +# MANAGE SCRIPT FAILURE +#================================================= + +# Exit if an error occurs during the execution of the script +ynh_abort_if_errors + app=$YNH_APP_INSTANCE_NAME db_user=$app db_name=$app diff --git a/scripts/upgrade b/scripts/upgrade index 9f0d5f6..2e860f1 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1,13 +1,19 @@ #!/bin/bash -# Exit on command errors and treat unset variables as an error -set -eu - # Load common variables and helpers . ./_common.sh # Source app helpers . /usr/share/yunohost/helpers +#================================================= +# MANAGE SCRIPT FAILURE +#================================================= + +# Exit if an error occurs during the execution of the script +ynh_abort_if_errors + + + app=$YNH_APP_INSTANCE_NAME FINAL_PATH="/var/www/$app"