From e9e4b7ac2213829705cd19ea7237fd929ce5c19f Mon Sep 17 00:00:00 2001 From: Olivier BILHAUT Date: Fri, 26 Jan 2018 17:39:11 +0100 Subject: [PATCH] New helpers path_url --- scripts/install | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/scripts/install b/scripts/install index 5e5b1e9..ae59a94 100644 --- a/scripts/install +++ b/scripts/install @@ -35,20 +35,36 @@ ynh_abort_if_errors admin=$YNH_APP_ARG_ADMIN member=$YNH_APP_ARG_MEMBER +#================================================= +# 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" + +# Normalize the url path syntax +path_url=$(ynh_normalize_url_path $path_url) + +# Check web path availability +ynh_webpath_available $domain $path_url +# Register (book) web path +ynh_webpath_register $app $domain $path_url + + # Correct path: puts a / at the start and nothing at the end - if [ "${path:0:1}" != "/" ]; then - path="/$path" - fi - if [ "${path:${#path}-1}" == "/" ] && [ ${#path} -gt 1 ]; then - path="${path:0:${#path}-1}" - fi +# if [ "${path:0:1}" != "/" ]; then +# path="/$path" +# fi +# if [ "${path:${#path}-1}" == "/" ] && [ ${#path} -gt 1 ]; then +# path="${path:0:${#path}-1}" +# fi # Check domain/path availability # sudo yunohost app checkurl "${domain}${path}" -a "$app" \ # || ynh_die "path not available: ${domain}${path}" - ynh_webpath_register $app $domain $path \ - || ynh_die "path not available and may be already used : ${domain}${path}" +# ynh_webpath_register $app $domain $path \ +# || ynh_die "path not available and may be already used : ${domain}${path}" # Check user parameter ynh_user_exists "$admin" \