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:
parent
bb004f5b9d
commit
7d2d0cdbb1
3 changed files with 32 additions and 7 deletions
|
@ -13,6 +13,18 @@ is_url_handled() {
|
|||
[[ ! ${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 =============
|
||||
# Delete a file checksum from the app settings
|
||||
#
|
||||
|
@ -23,4 +35,4 @@ is_url_handled() {
|
|||
ynh_delete_file_checksum () {
|
||||
local checksum_setting_name=checksum_${1//[\/ ]/_} # Replace all '/' and ' ' by '_'
|
||||
ynh_app_setting_delete $app $checksum_setting_name
|
||||
}
|
||||
}
|
|
@ -41,6 +41,17 @@ test -n "$new_path" || new_path="/"
|
|||
new_path=$(ynh_normalize_url_path $new_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
|
||||
#=================================================
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
# IMPORT GENERIC HELPERS
|
||||
#=================================================
|
||||
|
||||
source ./_common.sh
|
||||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
|
@ -70,10 +70,12 @@ ynh_setup_source "$final_path"
|
|||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
# Do not serve .well-known if it's already served on the domain
|
||||
if https://github.com/YunoHost-Apps/nextcloud_ynh/blob/962cc61ec8ffb045d89dd460cf8b55778d862ffc/scripts/install "https://${domain}/.well-known/caldav" ; then
|
||||
sed -ri '/^location = \/\.well\-known\/(caldav|carddav) \{/,/\}/d' \
|
||||
"../conf/nginx.conf"
|
||||
# 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
|
||||
echo "je suis devant le if"
|
||||
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
|
||||
|
||||
# Taken from https://github.com/YunoHost-Apps/nextcloud_ynh/blob/962cc61ec8ffb045d89dd460cf8b55778d862ffc/scripts/install
|
||||
|
@ -167,4 +169,4 @@ ynh_app_setting_set "$app" protected_uris "/admin/"
|
|||
# RELOAD NGINX
|
||||
#=================================================
|
||||
|
||||
systemctl reload nginx
|
||||
systemctl reload nginx
|
Loading…
Add table
Reference in a new issue