From 1d2c80b1fddb87c2bd58d655533b38338a9466b0 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 8 Apr 2019 21:52:19 +0200 Subject: [PATCH] implement nextcloud upgrade --- scripts/upgrade | 68 ++++++++++++++++++++++++++++++++++++------------- 1 file changed, 51 insertions(+), 17 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 83555d7..c283622 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -141,42 +141,76 @@ ynh_replace_string __STATEDIR__ $statedir ../conf/config.php # Enable caldav carddav support if yunohost app list --installed -f baikal | grep -q id ; then echo "Detected Baikal" - caldavdomain=$(ynh_app_setting_get baikal domain) - caldavpath=$(ynh_app_setting_get baikal path) - caldavpath=${caldavpath%/} + bailkaldomain=$(ynh_app_setting_get baikal domain) + bailkalpath=$(ynh_app_setting_get baikal path) + bailkalpath=${bailkalpath%/} # Configuration of backend ynh_replace_string __BACKEND__ BackendCombined ../conf/config.php ynh_replace_string __BACKEND__ BackendCombined ../conf/backend/config-autodiscover.php # Configuration baikal - ynh_replace_string __BAIKALDOMAIN__ $caldavdomain ../conf/backend/config-caldav.php - ynh_replace_string __BAIKALDOMAIN__ $caldavdomain ../conf/backend/config-carddav.php - ynh_replace_string __BAIKALPATH__ $caldavpath ../conf/backend/config-caldav.php - ynh_replace_string __BAIKALPATH__ $caldavpath ../conf/backend/config-carddav.php - ynh_replace_string __DOMAINTOCHANGE__ $domain ../conf/backend/config-imap.php + ynh_replace_string __CALDAV_SERVER__ "${bailkaldomain}" ../conf/backend/config-caldav.php + ynh_replace_string __CALDAV_PATH__ "${bailkalpath}/cal.php/calendars/%u/" ../conf/backend/config-caldav.php + ynh_replace_string __CALDAV_PERSONAL__ "default" ../conf/backend/config-caldav.php + + ynh_replace_string __CARDDAV_SERVER__ "${bailkaldomain}" ../conf/backend/config-carddav.php + ynh_replace_string __CARDDAV_PATH__ "${bailkalpath}/card.php/addressbooks/%u/" ../conf/backend/config-carddav.php + ynh_replace_string __CARDDAV_DEFAULT_PATH__ "${bailkalpath}/card.php/addressbooks/%u/default" ../conf/backend/config-carddav.php + + ynh_replace_string __IMAP_SERVER__ "${domain}" ../conf/backend/config-imap.php ynh_replace_string __FLAGTOCHANGE__ true ../conf/backend/config-imap.php # Copy config - cp ../conf/config.php $final_path/config.php - cp ../conf/backend/config-imap.php $final_path/backend/imap/config.php - cp ../conf/backend/config-carddav.php $final_path/backend/carddav/config.php cp ../conf/backend/config-caldav.php $final_path/backend/caldav/config.php + cp ../conf/backend/config-carddav.php $final_path/backend/carddav/config.php + cp ../conf/backend/config-imap.php $final_path/backend/imap/config.php + cp ../conf/backend/config-combined.php $final_path/backend/combined/config.php + +elif yunohost app list --installed -f nextcloud | grep -q id ; then + echo "Detected NextCloud" + nextclouddomain=$(ynh_app_setting_get nextcloud domain) + nextcloudpath=$(ynh_app_setting_get nextcloud path) + nextcloudpath=${nextcloudpath%/} + + # Configuration of backend + ynh_replace_string __BACKEND__ BackendCombined ../conf/config.php + ynh_replace_string __BACKEND__ BackendCombined ../conf/backend/config-autodiscover.php + + # Configuration nextcloud + ynh_replace_string __CALDAV_SERVER__ "${nextclouddomain}" ../conf/backend/config-caldav.php + ynh_replace_string __CALDAV_PATH__ "${nextcloudpath}/remote.php/dav/calendars/%u/" ../conf/backend/config-caldav.php + ynh_replace_string __CALDAV_PERSONAL__ "personal" ../conf/backend/config-caldav.php + + ynh_replace_string __CARDDAV_SERVER__ "${nextclouddomain}" ../conf/backend/config-carddav.php + ynh_replace_string __CARDDAV_PATH__ "${nextcloudpath}/remote.php/dav/addressbooks/users/%u/contacts/" ../conf/backend/config-carddav.php + ynh_replace_string __CARDDAV_DEFAULT_PATH__ "${nextcloudpath}/remote.php/dav/addressbooks/users/%u/contacts/" ../conf/backend/config-carddav.php + + ynh_replace_string __IMAP_SERVER__ "${domain}" ../conf/backend/config-imap.php + ynh_replace_string __FLAGTOCHANGE__ true ../conf/backend/config-imap.php + + # Copy config + cp ../conf/backend/config-caldav.php $final_path/backend/caldav/config.php + cp ../conf/backend/config-carddav.php $final_path/backend/carddav/config.php + cp ../conf/backend/config-imap.php $final_path/backend/imap/config.php cp ../conf/backend/config-combined.php $final_path/backend/combined/config.php - cp ../conf/backend/config-autodiscover.php $final_path/autodiscover/config.php else # Configuration of backend ynh_replace_string __BACKEND__ BackendIMAP ../conf/config.php ynh_replace_string __BACKEND__ BackendIMAP ../conf/backend/config-autodiscover.php - # Copy config - cp ../conf/config.php $final_path/config.php - ynh_replace_string __DOMAINTOCHANGE__ $domain ../conf/backend/config-imap.php + # Configuration imap + ynh_replace_string __IMAP_SERVER__ "${domain}" ../conf/backend/config-imap.php ynh_replace_string __FLAGTOCHANGE__ false ../conf/backend/config-imap.php - cp ../conf/backend/config-imap.php $final_path/backend/imap/config.php - cp ../conf/backend/config-autodiscover.php $final_path/autodiscover/config.php + + # Copy config + cp ../conf/backend/config-imap.php $final_path/backend/imap/config.php fi +# Copy config +cp ../conf/config.php $final_path/config.php +cp ../conf/backend/config-autodiscover.php $final_path/autodiscover/config.php + # Fixstates to avoid full resync of devices after version upgrades $final_path/z-push-admin.php -a fixstates