From 63e9bff3ff97a1fa294ebd21906ee5de7a53cea8 Mon Sep 17 00:00:00 2001 From: Josue Date: Sat, 28 Jan 2017 18:51:23 +0100 Subject: [PATCH] https://dev.yunohost.org/issues/621 --- scripts/backup | 39 +++++++++++++++++++++++++++++++++++---- scripts/restore | 30 ++++++++++++++++++++++++++++-- 2 files changed, 63 insertions(+), 6 deletions(-) diff --git a/scripts/backup b/scripts/backup index 1519bbc..cd0dc9b 100644 --- a/scripts/backup +++ b/scripts/backup @@ -3,11 +3,42 @@ # Exit on command errors and treat unset variables as an error set -eu -# Source YunoHost helpers -source /usr/share/yunohost/helpers +######## Actually we cant use common script in backup / restore script see this issue for more informations : https://dev.yunohost.org/issues/621 +# # Import common cmd +# source ./_common.sh +# -# Import common cmd -source ./_common.sh +######## We implement manually this fonctions + +init_script() { + # Exit on command errors and treat unset variables as an error + set -eu + + # Source YunoHost helpers + source /usr/share/yunohost/helpers + + # Retrieve arguments + app=$YNH_APP_INSTANCE_NAME +} + +set_configuration() { + if [[ -e /var/www/$app ]] + then + final_path=/var/www/$app + seafile_user=www-data + elif [[ -e /opt/yunohost/$app ]] + then + final_path=/opt/yunohost/$app + seafile_user=seafile + else + ynh_die "Error : can't find seafile path" + fi +} + +######## End of common fonctions + +# Init script +init_script # Retrieve arguments app=$YNH_APP_INSTANCE_NAME diff --git a/scripts/restore b/scripts/restore index bd6478b..063e819 100644 --- a/scripts/restore +++ b/scripts/restore @@ -1,7 +1,33 @@ #!/bin/bash -# Import common cmd -source ./_common.sh +######## Actually we cant use common script in backup / restore script see this issue for more informations : https://dev.yunohost.org/issues/621 +# # Import common cmd +# source ./_common.sh +# + +######## We implement manually this fonctions + +init_script() { + # Exit on command errors and treat unset variables as an error + set -eu + + # Source YunoHost helpers + source /usr/share/yunohost/helpers + + # Retrieve arguments + app=$YNH_APP_INSTANCE_NAME +} + +correct_path() { + if [ "${path:0:1}" != "/" ] && [ ${#path} -gt 0 ]; then + path="/$path" + fi + if [ "${path:${#path}-1}" == "/" ] && [ ${#path} -gt 1 ]; then + path="${path:0:${#path}-1}" + fi +} + +######## End of common fonctions # Init script init_script