From 41f07c5eabf8dfefbf723d1668964ad654fbb7b8 Mon Sep 17 00:00:00 2001 From: mbugeia Date: Wed, 26 Oct 2016 00:39:24 +0200 Subject: [PATCH] Check dir and conf only during restore --- scripts/_common.sh | 11 ----------- scripts/restore | 11 +++++++++++ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index e501557..170617c 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -35,17 +35,6 @@ pre_inst_haste() { local TMPDIR=$(mktemp -d) local HASTE_SOURCE=$1 - # Check destination directory - [[ -d $DESTDIR ]] && ynh_die \ - "The destination directory '$DESTDIR' already exists.\ - You should safely delete it before restoring this app." - - # Check configuration files - nginx_conf="/etc/nginx/conf.d/${domain}.d/${app}.conf" - [[ -f $nginx_conf ]] && ynh_die \ - "The NGINX configuration already exists at '${nginx_conf}'. - You should safely delete it before restoring this app." - haste_tarball="/tmp/haste.zip" rm -f "$haste_tarball" if [ "$HASTE_SOURCE" = "backup" ] diff --git a/scripts/restore b/scripts/restore index 2b4fada..633d74b 100755 --- a/scripts/restore +++ b/scripts/restore @@ -15,6 +15,17 @@ is_public=$(ynh_app_setting_get "$app" is_public) sudo yunohost app checkurl "${domain}${path}" -a "$app" \ || ynh_die "Path not available: ${domain}${path}" +# Check destination directory +[[ -d $DESTDIR ]] && ynh_die \ +"The destination directory '$DESTDIR' already exists.\ + You should safely delete it before restoring this app." + + # Check configuration files + nginx_conf="/etc/nginx/conf.d/${domain}.d/${app}.conf" + [[ -f $nginx_conf ]] && ynh_die \ + "The NGINX configuration already exists at '${nginx_conf}'. + You should safely delete it before restoring this app." + pre_inst_haste backup # Restore NGINX configuration