From 46f5bc2cd322ae7154328ca2f94d0c6645b09e2f Mon Sep 17 00:00:00 2001 From: Olivier BILHAUT Date: Fri, 2 Feb 2018 16:58:08 +0100 Subject: [PATCH] Modified backup script to be compliant with generic script --- manifest.json | 4 ++-- scripts/backup | 41 +++++++++++++++++++++++++++++------------ 2 files changed, 31 insertions(+), 14 deletions(-) diff --git a/manifest.json b/manifest.json index 4e5e4ac..f77523d 100644 --- a/manifest.json +++ b/manifest.json @@ -55,8 +55,8 @@ "name": "member", "type": "boolean", "ask": { - "en": "Should YunoHost users also be added as members awaiting approval in Dolibarr?", - "fr": "Les utilisateurs YunoHost doivent-ils aussi être ajoutés comme adhérents en attente de validation dans Dolibarr ?" + "en": "Should YunoHost users also be added as members awaiting approval in Dolibarr? (0=No, 1=Yes)", + "fr": "Les utilisateurs YunoHost doivent-ils aussi être ajoutés comme adhérents en attente de validation dans Dolibarr ? (0=Non, 1=Oui)" }, "default": false } diff --git a/scripts/backup b/scripts/backup index 893454a..1d1ad83 100755 --- a/scripts/backup +++ b/scripts/backup @@ -1,25 +1,42 @@ #!/bin/bash -# Exit on command errors and treat unset variables as an error -set -eu +#================================================= +# GENERIC START +#================================================= +# IMPORT GENERIC HELPERS +#================================================= + +if [ ! -e _common.sh ]; then + # Get the _common.sh file if it's not in the current directory + cp ../settings/scripts/_common.sh ./_common.sh + chmod a+rx _common.sh +fi +source _common.sh +source /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 -# Source YunoHost helpers - source /usr/share/yunohost/helpers # Backup sources & data - ynh_backup "/var/www/${app}" "sources" +ynh_backup "/var/www/${app}" "sources" # MySQL - dbname=$app - dbuser=$app - dbpass=$(ynh_app_setting_get "$app" mysqlpwd) - mysqldump -u "$dbuser" -p"$dbpass" --no-create-db "$dbname" > ./dump.sql +dbname=$app +dbuser=$app +dbpass=$(ynh_app_setting_get "$app" mysqlpwd) +mysqldump -u "$dbuser" -p"$dbpass" --no-create-db "$dbname" > ./dump.sql # Copy NGINX configuration - domain=$(ynh_app_setting_get "$app" domain) - ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" "nginx.conf" +domain=$(ynh_app_setting_get "$app" domain) +ynh_backup "/etc/nginx/conf.d/${domain}.d/${app}.conf" "nginx.conf" # PHP - ynh_backup "/etc/php5/fpm/pool.d/${app}.conf" "php-fpm.conf" +ynh_backup "/etc/php5/fpm/pool.d/${app}.conf" "php-fpm.conf"