diff --git a/scripts/_common.sh b/scripts/_common.sh index aa74003..ffe8244 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -49,15 +49,6 @@ CHECK_SIZE () { # Check if enough disk space available on backup storage fi } -CHECK_DOMAINPATH () { # Check domain/path availability - yunohost app checkurl $domain$path_url -a $app -} - -CHECK_FINALPATH () { # Check if destination directory already exists - final_path="/var/www/$app" - test ! -e "$final_path" || ynh_die "This path already contains a folder" -} - # ============= FUTURE YUNOHOST HELPER ============= # Delete a file checksum from the app settings diff --git a/scripts/install b/scripts/install index 83069e9..93fc374 100644 --- a/scripts/install +++ b/scripts/install @@ -31,9 +31,15 @@ admin=$YNH_APP_ARG_ADMIN # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= +final_path=/var/www/$app +test ! -e "$final_path" || ynh_die "This path already contains a folder" + path_url=$(ynh_normalize_url_path $path_url) # Check and normalize path -CHECK_DOMAINPATH # Check domain and path availability -CHECK_FINALPATH # Check if destination directory is not already in use + +# Check web path availability +ynh_webpath_available $domain $path_url +# Register (book) web path +ynh_webpath_register $app $domain $path_url #================================================= # STORE SETTINGS FROM MANIFEST diff --git a/scripts/restore b/scripts/restore index 8058237..87b6412 100644 --- a/scripts/restore +++ b/scripts/restore @@ -31,8 +31,10 @@ db_name=$(ynh_app_setting_get $app db_name) # CHECK IF THE APP CAN BE RESTORED #================================================= -CHECK_DOMAINPATH # Check domain and path availability -CHECK_FINALPATH # Check if destination directory is not already in use +ynh_webpath_available $domain $path_url \ + || ynh_die "Path not available: ${domain}${path_url}" +test ! -d $final_path \ + || ynh_die "There is already a directory: $final_path " #================================================= # INSTALL DEPENDENCIES