From ce71f1950ae04063b14c4cadecd5062548ad8118 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Sat, 28 Jan 2017 10:58:14 +0100 Subject: [PATCH] Fix incorrect destination path --- scripts/install | 8 ++++++++ scripts/upgrade | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 2a77f77..62ecfeb 100644 --- a/scripts/install +++ b/scripts/install @@ -31,6 +31,14 @@ ynh_app_setting_set "$app" admin "$admin" ynh_app_setting_set "$app" is_public "$is_public" ynh_app_setting_set "$app" language "$language" +# Fix path if needed +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 + # Check domain/path availability sudo yunohost app checkurl "${domain}${path}" -a "$app" \ || ynh_die "Path not available: ${domain}${path}" diff --git a/scripts/upgrade b/scripts/upgrade index 326970a..a54af26 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -39,7 +39,7 @@ sudo chmod 755 -R $src_path/galleries # Modify Nginx configuration file and copy it to Nginx conf directory nginx_conf=../conf/nginx.conf -sed -i "s@YNH_WWW_PATH@$path@g" $nginx_conf +sed -i "s@YNH_WWW_PATH@${path%/}@g" $nginx_conf sed -i "s@YNH_WWW_ALIAS@$src_path/@g" $nginx_conf sudo cp $nginx_conf /etc/nginx/conf.d/$domain.d/$app.conf