From 86b4a7869e7bb6d48c155527b8ca31a6526f7c20 Mon Sep 17 00:00:00 2001 From: ewilly Date: Sat, 7 Jan 2017 12:41:56 +0100 Subject: [PATCH] Solving App is broken #17 --- scripts/install | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 3697179..76cd845 100644 --- a/scripts/install +++ b/scripts/install @@ -16,6 +16,17 @@ filesize=$5 admin=$6 password=$7 + +# chech if / is present at start and not at end +if [ "${path:0:1}" != "/" ] && [ ${#path} -gt 0 ]; then + # first char is not / && path not empty => add / at start + path="/$path" +fi +if [ "${path:${#path}-1}" == "/" ] && [ ${#path} -gt 1 ]; then + # last char is / && path is gretter than / + path="${path:0:${#path}-1}" +fi + # definie useful vars parent_path=/var/www final_path="$parent_path"/"$app" @@ -93,15 +104,21 @@ sudo service nginx reload || true ynh_app_setting_set "$app" unprotected_uris "/" sudo yunohost app ssowatconf +# add alias line in hosts file +echo "127.0.0.1 $domain # $app" | sudo tee -a /etc/hosts + # fill the superadmin creation form curl_path=$([ "$path" == "/" ] || echo "$path") curl https://"$domain""$curl_path"/ > /dev/null 2>&1 -curl -X POST \ +sleep 1 && curl -kX POST \ --data-urlencode creation="1" \ --data-urlencode login="$admin" \ --data-urlencode pass="$password" \ --data-urlencode confirm="$password" \ https://"$domain""$curl_path"/index.php?p=login > /dev/null 2>&1 + +# remove alias line from hosts file +sudo sed -i "/# $app/d" /etc/hosts # if app is private, remove url to SSOWat conf from skipped_uris if [ "$is_public" = "No" ];