1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/nextcloud_ynh.git synced 2024-09-03 19:55:57 +02:00
nextcloud_ynh/scripts/change_url
Kayou d0400f751d
Testing (#713)
* Update manifest.toml

* Auto-update READMEs

* add pre upgrade warning for NC 29

* update to PHP8.3

* Auto-update READMEs

* Update manifest.toml

* Auto-update READMEs

* Fix space splitting in phpflags on install (#690)

* Auto-update READMEs

* Update upgrade

* Update manifest.toml

* Auto-update READMEs

* Fix phpflags (#691)

* Fix upgrade: php version is 8.3 starting from 29.x ? (#692)

* Update manifest.toml

* Auto-update READMEs

* Update tests.toml

* [autopatch] Do not delete logs on app removal (#697)

* [autopatch] Do not delete logs on app removal (#698)

Co-authored-by: Yunohost-Bot <>

* 29.0.3

* Auto-update READMEs

* Update remove

* Indent

* Fix again upgrade ending with Nextcloud being in PHP 8.2 ?

* Auto-update READMEs

* Update nginx.conf

* Update manifest.toml

* Auto-update READMEs

* Rework DESCRIPTION.md (#707)

* Update DESCRIPTION_fr.md

* Auto-update READMEs

* Update DESCRIPTION.md

* Auto-update READMEs

* Update DESCRIPTION_fr.md

* Auto-update READMEs

---------

Co-authored-by: yunohost-bot <yunohost@yunohost.org>

* bump all old versions

* oupsie

* Auto-update READMEs

* system_addressbook_exposed is a boolean

* Auto-update READMEs

* migrate system_addressbook_exposed to boolean, fix upgrade test

* another fix for system_addressbook_exposed, update the dav conf accordingly

* zblerg, do not modify system_addressbook_exposed config value in the upgrade script

* add redis-server as deps

* find files before chown them

* chown the root folder too

* fix find condition

* find ... chmod is not faster, at least avoid to chown -R the data_dir in the upgrade script

* add a button in the config panel to run chown/chmod on data_dir

* we can avoid this chmod too i guess?

* only nextcloud is allowed to read the config file

* zblerg, the config file doesn't exist before install

* wait until nginx has actually remove the nextcloud conf during upgrade before checking the url_handled

* create a function for that

* fix change-url dav detection

* only if domain has changed...

* Update scripts/_common.sh

* moar sleep

* oups

* minor typos

* Update backup

* minor typos

---------

Co-authored-by: Éric Gaspar <46165813+ericgaspar@users.noreply.github.com>
Co-authored-by: yunohost-bot <yunohost@yunohost.org>
Co-authored-by: OniriCorpe <oniricorpe@disroot.org>
Co-authored-by: lyyn <79758863+lyynd@users.noreply.github.com>
Co-authored-by: tituspijean <titus+yunohost@pijean.ovh>
Co-authored-by: Alexandre Aubin <4533074+alexAubin@users.noreply.github.com>
Co-authored-by: YunoHost Bot <yunohost-bot@users.noreply.github.com>
Co-authored-by: Alexandre Aubin <alex.aubin@mailoo.org>
2024-08-08 17:20:30 +02:00

67 lines
2.6 KiB
Bash

#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2
if [ $change_domain -eq 1 ]
then
# Check if .well-known is available for this domain
if is_url_handled --domain="$new_domain" --path="/.well-known/caldav" || is_url_handled --domain="$new_domain" --path="/.well-known/carddav"
then
ynh_print_warn --message="Another app already uses the domain $new_domain to serve a CalDAV/CardDAV feature. You may encounter issues when dealing with your calendar or address book."
# Remove lines about .well-known/carddav and caldav with sed.
sed --in-place --regexp-extended '/location = \/\.well\-known\/(caldav|carddav)/d' "/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_store_file_checksum --file="/etc/nginx/conf.d/$domain.d/$app.conf"
fi
fi
ynh_change_url_nginx_config
#=================================================
# SPECIFIC MODIFICATIONS
#=================================================
ynh_script_progression --message="Applying $app specific modifications..." --weight=2
# Define a function to execute commands with `occ`
exec_occ() {
(cd "$install_dir" && ynh_exec_as "$app" \
php${phpversion} --define apc.enable_cli=1 occ --no-interaction --no-ansi "$@")
}
if [ $change_domain -eq 1 ]
then
# Change the trusted domain
exec_occ config:system:set trusted_domains 1 --value=$new_domain
# Change hostname for activity notifications
exec_occ config:system:set overwrite.cli.url --value="https://${new_domain}${new_path}"
# Reload PHP-FPM, necessary for force Nextcloud to re-read config.php, cf opcache.revalidate_freq
ynh_systemd_action --service_name=php${phpversion}-fpm --action=reload
fi
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring permissions..."
# Temporary fix for the API permission (workaround for https://github.com/YunoHost/issues/issues/2294 )
ynh_permission_url --permission="api" --url="re:$new_domain\/.well-known\/.*" --auth_header="false" --clear_urls
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Change of URL completed for $app" --last