From d48395208781a85b95590d18013ba148b310ca5f Mon Sep 17 00:00:00 2001 From: ewilly Date: Tue, 1 May 2018 14:46:22 +0200 Subject: [PATCH] Fix root install --- scripts/_common.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 8e8d6c1..7386935 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -44,9 +44,13 @@ myynh_add_nginx_config () { cp ../conf/nginx.conf "$nginx_conf" # To avoid a break by set -u, use a void substitution ${var:-}. If the variable is not set, it's simply set with an empty variable. # Substitute in a nginx config file only if the variable is not empty - [ -n "${path_url:-}" ] && ynh_replace_string "__PATH__" "$path_url" "$nginx_conf" - if [ "${path_url:-}" != "/" ]; then - ynh_replace_string "^#sub_path_only" "" "$nginx_conf" + if test -n "${path_url:-}"; then + if [ "${path_url:-}" != "/" ]; then + ynh_replace_string "^#sub_path_only" "" "$nginx_conf" + ynh_replace_string "__PATH__" "$path_url" "$nginx_conf" + else + ynh_replace_string "__PATH__/" "$path_url" "$nginx_conf" + fi fi [ -n "${final_path:-}" ] && ynh_replace_string "__FINALPATH__" "$final_path" "$nginx_conf" [ -n "${app:-}" ] && ynh_replace_string "__NAME__" "$app" "$nginx_conf"