From cface758709d675e0f1e8ec84cb9879f491d3e56 Mon Sep 17 00:00:00 2001 From: ewilly Date: Mon, 18 Nov 2019 10:23:03 +0100 Subject: [PATCH] Update --- manifest.json | 2 +- scripts/_common.sh | 38 +++++++++++++++++++++++++++++++++----- scripts/install | 10 ++-------- 3 files changed, 36 insertions(+), 14 deletions(-) diff --git a/manifest.json b/manifest.json index cdb0ce6..2af79c1 100644 --- a/manifest.json +++ b/manifest.json @@ -19,7 +19,7 @@ "multi_instance": false, "services": [ "nginx", - "php7-fpm" + "php7.0-fpm" ], "arguments": { "install" : [ diff --git a/scripts/_common.sh b/scripts/_common.sh index 6db1738..e20e803 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -3,11 +3,7 @@ # # Package dependencies -if [ "$(lsb_release --codename --short)" != "jessie" ]; then - PKG_DEPENDENCIES="php-zip php-curl php-gd" -else - PKG_DEPENDENCIES="php5-curl php5-gd" -fi +PKG_DEPENDENCIES="php-zip php-curl php-gd" # Check if directory/file already exists (path in argument) myynh_check_path () { @@ -49,3 +45,35 @@ myynh_set_permissions () { chown -R "$app": "$data_path" chown root: "$data_path" } + +#Change --data to --data-urlencode +myynh_local_curl () { + # Define url of page to curl + local local_page=$(ynh_normalize_url_path $1) + local full_path=$path_url$local_page + + if [ "${path_url}" == "/" ]; then + full_path=$local_page + fi + + local full_page_url=https://localhost$full_path + + # Concatenate all other arguments with '&' to prepare POST data + local POST_data="" + local arg="" + for arg in "${@:2}" + do + POST_data="${POST_data}${arg}&" + done + if [ -n "$POST_data" ] + then + # Add --data-urlencode arg and remove the last character, which is an unecessary '&' + POST_data="--data-urlencode ${POST_data::-1}" + fi + + # Wait untils nginx has fully reloaded (avoid curl fail with http2) + sleep 2 + + # Curl the URL + curl --silent --show-error -kL -H "Host: $domain" --resolve $domain:443:127.0.0.1 $POST_data "$full_page_url" +} diff --git a/scripts/install b/scripts/install index 3fb999f..f2bff93 100644 --- a/scripts/install +++ b/scripts/install @@ -74,14 +74,8 @@ ynh_app_setting_set "$app" unprotected_uris "/" yunohost app ssowatconf # fill the superadmin creation form (helper ynh_local_curl doesn't work due to --data vs --data-urlencode ?) -curl --silent --show-error -kL -H "Host: $domain" --resolve $domain:443:127.0.0.1 https://localhost"$path_url"/ > /dev/null 2>&1 -sleep 1 -curl --silent --show-error -kL -H "Host: $domain" --resolve $domain:443:127.0.0.1 -X POST \ - --data-urlencode creation="1" \ - --data-urlencode login="$admin" \ - --data-urlencode pass="$password" \ - --data-urlencode confirm="$password" \ - https://localhost"$path_url"/index.php?p=login > /dev/null 2>&1 +admin_url="/index.php?p=login" +myynh_local_curl $admin_url "creation=1" "login=$admin" "pass=$password" "confirm=$password" # if app is private, remove url to SSOWat conf from skipped_uris if [ $is_public -eq 0 ]