1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/baikal_ynh.git synced 2024-09-03 18:16:11 +02:00

trying to fix ci

This commit is contained in:
Kay0u 2020-03-11 11:35:25 +01:00
parent 1cf3eba70e
commit 8ab06e7bd0
No known key found for this signature in database
GPG key ID: 7FF262C033518333
4 changed files with 8 additions and 6 deletions

View file

@ -15,14 +15,16 @@ pkg_dependencies="php-xml php-mbstring php-mysql"
# usage: is_url_handled URL # usage: is_url_handled URL
is_url_handled() { is_url_handled() {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
declare -Ar args_array=( [u]=url= ) local legacy_args=dp
local url declare -Ar args_array=( [d]=domain= [p]=path= )
local domain
local path
# Manage arguments with getopts # Manage arguments with getopts
ynh_handle_getopts_args "$@" ynh_handle_getopts_args "$@"
# Try to get the url with curl, and keep the http code and an eventual redirection url. # Try to get the url with curl, and keep the http code and an eventual redirection url.
local curl_output="$(curl --insecure --silent --output /dev/null \ local curl_output="$(curl --insecure --silent --output /dev/null \
--write-out '%{http_code};%{redirect_url}' "$url")" --write-out '%{http_code};%{redirect_url}' https://127.0.0.1$path --header "Host: $domain")"
# Cut the output and keep only the first part to keep the http code # Cut the output and keep only the first part to keep the http code
local http_code="${curl_output%%;*}" local http_code="${curl_output%%;*}"

View file

@ -52,7 +52,7 @@ fi
if [ $change_domain -eq 1 ] if [ $change_domain -eq 1 ]
then then
# Check if .well-known is available for the new domain. # Check if .well-known is available for the new domain.
if is_url_handled "https://$new_domain/.well-known/caldav" || is_url_handled "https://$new_domain/.well-known/carddav" if is_url_handled "$new_domain" "/.well-known/caldav" || is_url_handled "$new_domain" "/.well-known/carddav"
then then
ynh_die --message="Another app already uses the domain $new_domain to serve a caldav/carddav feature. Please use another domain." ynh_die --message="Another app already uses the domain $new_domain to serve a caldav/carddav feature. Please use another domain."
fi fi

View file

@ -38,7 +38,7 @@ test ! -e "$final_path" || ynh_die "This path already contains a folder"
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
# Check if .well-known is available for this domain. # Check if .well-known is available for this domain.
if is_url_handled "https://$domain/.well-known/caldav" || is_url_handled "https://$domain/.well-known/carddav" if is_url_handled "$domain" "/.well-known/caldav" || is_url_handled "$domain" "/.well-known/carddav"
then then
ynh_die --message="Another app already uses the domain $domain to serve a caldav/carddav feature. Please use another domain." ynh_die --message="Another app already uses the domain $domain to serve a caldav/carddav feature. Please use another domain."
fi fi

View file

@ -39,7 +39,7 @@ test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path " || ynh_die --message="There is already a directory: $final_path "
# Check if .well-known is available for this domain. # Check if .well-known is available for this domain.
if is_url_handled "https://$domain/.well-known/caldav" || is_url_handled "https://$domain/.well-known/carddav" if is_url_handled "$domain" "/.well-known/caldav" || is_url_handled "$domain" "/.well-known/carddav"
then then
ynh_die --message="Another app already uses the domain $domain to serve a caldav/carddav feature. Please use another domain." ynh_die --message="Another app already uses the domain $domain to serve a caldav/carddav feature. Please use another domain."
fi fi