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

[WIP] attempt to fix conflit with nextcloud

This commit is contained in:
Gofannon 2018-11-02 20:43:56 +01:00
parent bb004f5b9d
commit 7d2d0cdbb1
3 changed files with 32 additions and 7 deletions

View file

@ -13,6 +13,18 @@ is_url_handled() {
[[ ! ${output[0]} =~ \/yunohost\/sso\/ && ${output[1]} != 404 ]] [[ ! ${output[0]} =~ \/yunohost\/sso\/ && ${output[1]} != 404 ]]
} }
is_url_handled_custom() {
local output=($(curl -k -s -o /dev/null \
-w 'x%{redirect_url} %{http_code}' "$1"))
echo "¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤"
echo "contenu variable 'output' : $output"
echo "¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤"
# It's handled if it does not redirect to the SSO nor return 404
[[ ! ${output[0]} =~ \/yunohost\/sso\/ && ${output[1]} != 404 ]]
#[[ ! ${output[0]} =~ \/yunohost\/sso\/ ]] && [[ ${output[1]} != 404 ]]
#[[ ! ${output[0]} =~ \/yunohost\/sso\/ ]]
}
# ============= FUTURE YUNOHOST HELPER ============= # ============= FUTURE YUNOHOST HELPER =============
# Delete a file checksum from the app settings # Delete a file checksum from the app settings
# #

View file

@ -41,6 +41,17 @@ test -n "$new_path" || new_path="/"
new_path=$(ynh_normalize_url_path $new_path) new_path=$(ynh_normalize_url_path $new_path)
old_path=$(ynh_normalize_url_path $old_path) old_path=$(ynh_normalize_url_path $old_path)
#=================================================
# CHECK IF THE APP CAN BE MOVED WITH THESE ARGS
#=================================================
# FIXME Does not work as expected for now (See install script)
# Exits if another app serves "https://${domain}/.well-known/caldav" and display an error message for user
# Waiting for Yunohost to handles this kind of conflict https://github.com/YunoHost-Apps/baikal_ynh/issues/17
if is_url_handled "https://${domain}/.well-known/caldav" ; then
ynh_die "Baikal cannot be installed because of a conflit with another application, Nextcloud usually. This app handles the location where you want to install Baikal (https://${domain}/.well-known/caldav). You can either install Baikal on another domain, subdomain or move Nextcloud to another location"
fi
#================================================= #=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED # CHECK WHICH PARTS SHOULD BE CHANGED
#================================================= #=================================================

View file

@ -6,7 +6,7 @@
# IMPORT GENERIC HELPERS # IMPORT GENERIC HELPERS
#================================================= #=================================================
source ./_common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
@ -70,10 +70,12 @@ ynh_setup_source "$final_path"
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
# Do not serve .well-known if it's already served on the domain # Exits if another app serves "https://${domain}/.well-known/caldav" and display an error message for user
if https://github.com/YunoHost-Apps/nextcloud_ynh/blob/962cc61ec8ffb045d89dd460cf8b55778d862ffc/scripts/install "https://${domain}/.well-known/caldav" ; then # Waiting for Yunohost to handles this kind of conflict https://github.com/YunoHost-Apps/baikal_ynh/issues/17
sed -ri '/^location = \/\.well\-known\/(caldav|carddav) \{/,/\}/d' \ echo "je suis devant le if"
"../conf/nginx.conf" if is_url_handled_custom "https://${domain}/.well-known/caldav" ; then
echo "je passe dans le if"
ynh_die "Baikal cannot be installed because of a conflit with another application, Nextcloud usually. This app handles the location where you want to install Baikal (https://${domain}/.well-known/caldav). You can either install Baikal on another domain, subdomain or move Nextcloud to another location"
fi fi
# Taken from https://github.com/YunoHost-Apps/nextcloud_ynh/blob/962cc61ec8ffb045d89dd460cf8b55778d862ffc/scripts/install # Taken from https://github.com/YunoHost-Apps/nextcloud_ynh/blob/962cc61ec8ffb045d89dd460cf8b55778d862ffc/scripts/install