From c4f40e683d3ba35f8c2f603a5c0138bb7510a06d Mon Sep 17 00:00:00 2001 From: frju365 Date: Sun, 29 Jan 2017 16:36:22 +0100 Subject: [PATCH] Update restore --- scripts/restore | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/scripts/restore b/scripts/restore index 09109a9..42e816b 100644 --- a/scripts/restore +++ b/scripts/restore @@ -26,25 +26,21 @@ domain=$(sudo ynh_app_setting_set $app domain) path=$(sudo ynh_app_setting_set $app path) user=$(sudo ynh_app_setting_set $app allowed_users) is_public=$(sudo ynh_app_setting_set $app is_public) +final_path=/var/www/$app # Check domain/path availability -sudo yunohost app checkurl $domain$path -a $app -if [[ ! $? -eq 0 ]]; then - echo "There is already an app on this URL : $domain$path" | sudo tee /dev/stderr - exit 1 -fi - -final_path=/var/www/$app +sudo yunohost app checkurl "${domain}${path}" -a "$app" \ + || ynh_die "Path not available: ${domain}${path}" if [ -d $final_path ]; then echo "There is already a directory: $final_path " | sudo tee /dev/stderr - exit 1 + ynh_die fi conf=/etc/nginx/conf.d/$domain.d/$app.conf if [ -f $conf ]; then echo "There is already a nginx conf file at this path: $conf " | sudo tee /dev/stderr - exit 1 + ynh_die fi # Restore sources & data