mirror of
https://github.com/YunoHost-Apps/z-push_ynh.git
synced 2024-09-03 18:05:58 +02:00
Improve the horendous configuration management using shitload of ynh_replace_string ...
This commit is contained in:
parent
4c8766eca3
commit
cd679074f9
7 changed files with 96 additions and 144 deletions
|
@ -87,7 +87,7 @@
|
||||||
|
|
||||||
define('LOGBACKEND', 'filelog');
|
define('LOGBACKEND', 'filelog');
|
||||||
|
|
||||||
define('LOGFILEDIR', '__FINAL_LOGPATH__/');
|
define('LOGFILEDIR', '__LOG_DIR__/');
|
||||||
define('LOGFILE', LOGFILEDIR . 'autodiscover.log');
|
define('LOGFILE', LOGFILEDIR . 'autodiscover.log');
|
||||||
define('LOGERRORFILE', LOGFILEDIR . 'autodiscover-error.log');
|
define('LOGERRORFILE', LOGFILEDIR . 'autodiscover-error.log');
|
||||||
define('LOGLEVEL', LOGLEVEL_ERROR);
|
define('LOGLEVEL', LOGLEVEL_ERROR);
|
||||||
|
|
|
@ -217,7 +217,7 @@ define('SYSTEM_MIME_TYPES_MAPPING', '/etc/mime.types');
|
||||||
|
|
||||||
|
|
||||||
// Use BackendCalDAV for Meetings. You cannot hope to get that functionality working without a caldav backend.
|
// Use BackendCalDAV for Meetings. You cannot hope to get that functionality working without a caldav backend.
|
||||||
define('IMAP_MEETING_USE_CALDAV', __FLAGTOCHANGE__);
|
define('IMAP_MEETING_USE_CALDAV', __IMAP_MEETING_USE_CALDAV__);
|
||||||
|
|
||||||
// If your IMAP server allows authenticating via GSSAPI, php-imap will not fall back properly to other authentication
|
// If your IMAP server allows authenticating via GSSAPI, php-imap will not fall back properly to other authentication
|
||||||
// methods and you will be unable to log in. Uncomment the following line to disable that authentication method.
|
// methods and you will be unable to log in. Uncomment the following line to disable that authentication method.
|
||||||
|
|
|
@ -120,7 +120,7 @@
|
||||||
$specialLogUsers = array();
|
$specialLogUsers = array();
|
||||||
|
|
||||||
// Filelog settings
|
// Filelog settings
|
||||||
define('LOGFILEDIR', '/var/log/__APP__/');
|
define('LOGFILEDIR', '__LOG_DIR__');
|
||||||
define('LOGFILE', LOGFILEDIR . 'z-push.log');
|
define('LOGFILE', LOGFILEDIR . 'z-push.log');
|
||||||
define('LOGERRORFILE', LOGFILEDIR . 'z-push-error.log');
|
define('LOGERRORFILE', LOGFILEDIR . 'z-push-error.log');
|
||||||
|
|
||||||
|
|
|
@ -43,5 +43,8 @@ ram.runtime = "50M"
|
||||||
[resources.permissions]
|
[resources.permissions]
|
||||||
main.url = "/"
|
main.url = "/"
|
||||||
|
|
||||||
|
# FIXME: watdo with this ...
|
||||||
|
#REMOVEME? ynh_permission_create --permission="autodiscover" --url="re:$domain_regex/[Aa]uto[Dd]iscover/.*" --allowed="visitors" --show_tile="false" --protected="true"
|
||||||
|
|
||||||
[resources.apt]
|
[resources.apt]
|
||||||
packages = "php7.4-soap, php7.4-imap, php7.4-xsl, php7.4-curl, php7.4-xml, php7.4-ldap, php7.4-cli, php7.4-mbstring, php7.4-memcached, libawl-php"
|
packages = "php7.4-soap, php7.4-imap, php7.4-xsl, php7.4-curl, php7.4-xml, php7.4-ldap, php7.4-cli, php7.4-mbstring, php7.4-memcached, libawl-php"
|
||||||
|
|
120
scripts/install
120
scripts/install
|
@ -14,6 +14,8 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
path="/Microsoft-Server-ActiveSync"
|
path="/Microsoft-Server-ActiveSync"
|
||||||
|
timezone="$(cat /etc/timezone)"
|
||||||
|
log_dir="/var/log/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
|
@ -45,58 +47,40 @@ ynh_add_nginx_config
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Creating a final log path..." --weight=1
|
ynh_script_progression --message="Creating a final log path..." --weight=1
|
||||||
|
|
||||||
final_logpath="/var/log/$app"
|
mkdir -p $log_dir
|
||||||
ynh_app_setting_set --app=$app --key=final_logpath --value=$final_logpath
|
chmod 750 "$log_dir"
|
||||||
|
chmod -R o-rwx "$log_dir"
|
||||||
mkdir -p $final_logpath
|
chown -R $app:www-data "$log_dir"
|
||||||
|
|
||||||
chmod 750 "$final_logpath"
|
|
||||||
chmod -R o-rwx "$final_logpath"
|
|
||||||
chown -R $app:www-data "$final_logpath"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD A CONFIGURATION
|
# ADD A CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
||||||
|
|
||||||
# Configuration
|
|
||||||
ynh_replace_string --match_string="__TIMEZONE__" --replace_string=$(cat /etc/timezone) --target_file="../conf/config.php"
|
|
||||||
ynh_replace_string --match_string="__TIMEZONE__" --replace_string=$(cat /etc/timezone) --target_file="../conf/backend/config-autodiscover.php"
|
|
||||||
ynh_replace_string --match_string="__FINAL_LOGPATH__" --replace_string=$final_logpath --target_file="../conf/config.php"
|
|
||||||
ynh_replace_string --match_string="__FINAL_LOGPATH__" --replace_string=$final_logpath --target_file="../conf/backend/config-autodiscover.php"
|
|
||||||
|
|
||||||
# Storage of state_dir in /home/yunohost.app
|
|
||||||
# This contains the sync status in between device and z-push
|
|
||||||
ynh_replace_string --match_string="__DATA_DIR__" --replace_string=$data_dir --target_file="../conf/config.php"
|
|
||||||
|
|
||||||
# Enable caldav carddav support
|
# Enable caldav carddav support
|
||||||
if yunohost app list | grep -q 'id: baikal' ; then
|
if yunohost app list | grep -q 'id: baikal' ; then
|
||||||
echo "Detected Baikal"
|
echo "Detected Baikal"
|
||||||
bailkaldomain=$(ynh_app_setting_get --app="baikal" --key=domain)
|
baikaldomain=$(ynh_app_setting_get --app="baikal" --key=domain)
|
||||||
bailkalpath=$(ynh_app_setting_get --app="baikal" --key=path)
|
baikalpath=$(ynh_app_setting_get --app="baikal" --key=path)
|
||||||
bailkalpath=${bailkalpath%/}
|
baikalpath=${baikalpath%/}
|
||||||
|
|
||||||
# Configuration of backend
|
# Variables to hydrate template
|
||||||
ynh_replace_string --match_string="__BACKEND__" --replace_string="BackendCombined" --target_file="../conf/config.php"
|
backend="BackendCombined"
|
||||||
ynh_replace_string --match_string="__BACKEND__" --replace_string="BackendCombined" --target_file="../conf/backend/config-autodiscover.php"
|
caldav_server="$baikaldomain"
|
||||||
|
caldav_path="${baikalpath}/cal.php/calendars/%u/"
|
||||||
|
caldav_personal="default"
|
||||||
|
|
||||||
# Configuration baikal
|
carddav_server="$baikaldomain"
|
||||||
ynh_replace_string --match_string="__CALDAV_SERVER__" --replace_string="${bailkaldomain}" --target_file="../conf/backend/config-caldav.php"
|
carddav_path="${baikalpath}/card.php/addressbooks/%u/"
|
||||||
ynh_replace_string --match_string="__CALDAV_PATH__" --replace_string="${bailkalpath}/cal.php/calendars/%u/" --target_file="../conf/backend/config-caldav.php"
|
carddav_default_path="${baikalpath}/card.php/addressbooks/%u/default"
|
||||||
ynh_replace_string --match_string="__CALDAV_PERSONAL__" --replace_string="default" --target_file="../conf/backend/config-caldav.php"
|
|
||||||
|
|
||||||
ynh_replace_string --match_string="__CARDDAV_SERVER__" --replace_string="${bailkaldomain}" --target_file="../conf/backend/config-carddav.php"
|
imap_server="$domain"
|
||||||
ynh_replace_string --match_string="__CARDDAV_PATH__" --replace_string="${bailkalpath}/card.php/addressbooks/%u/" --target_file="../conf/backend/config-carddav.php"
|
imap_meeting_use_caldav="true"
|
||||||
ynh_replace_string --match_string="__CARDDAV_DEFAULT_PATH__" --replace_string="${bailkalpath}/card.php/addressbooks/%u/default" --target_file="../conf/backend/config-carddav.php"
|
|
||||||
|
|
||||||
ynh_replace_string --match_string="__IMAP_SERVER__" --replace_string="${domain}" --target_file="../conf/backend/config-imap.php"
|
ynh_add_config --template="backend/config-caldav.php" --destination="$install_dir/backend/caldav/config.php"
|
||||||
ynh_replace_string --match_string="__FLAGTOCHANGE__" --replace_string="true" --target_file="../conf/backend/config-imap.php"
|
ynh_add_config --template="backend/config-carddav.php" --destination="$install_dir/backend/carddav/config.php"
|
||||||
|
ynh_add_config --template="backend/config-imap.php" --destination="$install_dir/backend/imap/config.php"
|
||||||
# Copy config
|
ynh_add_config --template="backend/config-combined.php" --destination="$install_dir/backend/combined/config.php"
|
||||||
cp -af ../conf/backend/config-caldav.php $install_dir/backend/caldav/config.php
|
|
||||||
cp -af ../conf/backend/config-carddav.php $install_dir/backend/carddav/config.php
|
|
||||||
cp -af ../conf/backend/config-imap.php $install_dir/backend/imap/config.php
|
|
||||||
cp -af ../conf/backend/config-combined.php $install_dir/backend/combined/config.php
|
|
||||||
|
|
||||||
elif yunohost app list | grep -q 'id: nextcloud' ; then
|
elif yunohost app list | grep -q 'id: nextcloud' ; then
|
||||||
echo "Detected NextCloud"
|
echo "Detected NextCloud"
|
||||||
|
@ -104,44 +88,36 @@ elif yunohost app list | grep -q 'id: nextcloud' ; then
|
||||||
nextcloudpath=$(ynh_app_setting_get --app="nextcloud" --key=path)
|
nextcloudpath=$(ynh_app_setting_get --app="nextcloud" --key=path)
|
||||||
nextcloudpath=${nextcloudpath%/}
|
nextcloudpath=${nextcloudpath%/}
|
||||||
|
|
||||||
# Configuration of backend
|
# Variables to hydrate template
|
||||||
ynh_replace_string --match_string="__BACKEND__" --replace_string="BackendCombined" --target_file="../conf/config.php"
|
backend="BackendCombined"
|
||||||
ynh_replace_string --match_string="__BACKEND__" --replace_string="BackendCombined" --target_file="../conf/backend/config-autodiscover.php"
|
caldav_server="$nextclouddomain"
|
||||||
|
caldav_path="${nextcloudpath}/remote.php/dav/calendars/%u/"
|
||||||
|
caldav_personal="personal"
|
||||||
|
|
||||||
# Configuration nextcloud
|
carddav_server="$nextclouddomain"
|
||||||
ynh_replace_string --match_string="__CALDAV_SERVER__" --replace_string="${nextclouddomain}" --target_file="../conf/backend/config-caldav.php"
|
carddav_path="${nextcloudpath}/remote.php/dav/addressbooks/users/%u/"
|
||||||
ynh_replace_string --match_string="__CALDAV_PATH__" --replace_string="${nextcloudpath}/remote.php/dav/calendars/%u/" --target_file="../conf/backend/config-caldav.php"
|
carddav_default_path="${nextcloudpath}/remote.php/dav/addressbooks/users/%u/"
|
||||||
ynh_replace_string --match_string="__CALDAV_PERSONAL__" --replace_string="personal" --target_file="../conf/backend/config-caldav.php"
|
|
||||||
|
|
||||||
ynh_replace_string --match_string="__CARDDAV_SERVER__" --replace_string="${nextclouddomain}" --target_file="../conf/backend/config-carddav.php"
|
imap_server="$domain"
|
||||||
ynh_replace_string --match_string="__CARDDAV_PATH__" --replace_string="${nextcloudpath}/remote.php/dav/addressbooks/users/%u/" --target_file="../conf/backend/config-carddav.php"
|
imap_meeting_use_caldav="true"
|
||||||
ynh_replace_string --match_string="__CARDDAV_DEFAULT_PATH__" --replace_string="${nextcloudpath}/remote.php/dav/addressbooks/users/%u/" --target_file="../conf/backend/config-carddav.php"
|
|
||||||
|
|
||||||
ynh_replace_string --match_string="__IMAP_SERVER__" --replace_string="${domain}" --target_file="../conf/backend/config-imap.php"
|
ynh_add_config --template="backend/config-caldav.php" --destination="$install_dir/backend/caldav/config.php"
|
||||||
ynh_replace_string --match_string="__FLAGTOCHANGE__" --replace_string="true" --target_file="../conf/backend/config-imap.php"
|
ynh_add_config --template="backend/config-carddav.php" --destination="$install_dir/backend/carddav/config.php"
|
||||||
|
ynh_add_config --template="backend/config-imap.php" --destination="$install_dir/backend/imap/config.php"
|
||||||
|
ynh_add_config --template="backend/config-combined.php" --destination="$install_dir/backend/combined/config.php"
|
||||||
|
|
||||||
# Copy config
|
|
||||||
cp -af ../conf/backend/config-caldav.php $install_dir/backend/caldav/config.php
|
|
||||||
cp -af ../conf/backend/config-carddav.php $install_dir/backend/carddav/config.php
|
|
||||||
cp -af ../conf/backend/config-imap.php $install_dir/backend/imap/config.php
|
|
||||||
cp -af ../conf/backend/config-combined.php $install_dir/backend/combined/config.php
|
|
||||||
else
|
else
|
||||||
# Configuration of backend
|
backend="BackendIMAP"
|
||||||
ynh_replace_string --match_string="__BACKEND__" --replace_string="BackendIMAP" --target_file="../conf/config.php"
|
imap_server="$domain"
|
||||||
ynh_replace_string --match_string="__BACKEND__" --replace_string="BackendIMAP" --target_file="../conf/backend/config-autodiscover.php"
|
imap_meeting_use_caldav="false"
|
||||||
|
|
||||||
# Configuration imap
|
ynh_add_config --template="backend/config-imap.php" --destination="$install_dir/backend/imap/config.php"
|
||||||
ynh_replace_string --match_string="__IMAP_SERVER__" --replace_string="${domain}" --target_file="../conf/backend/config-imap.php"
|
|
||||||
ynh_replace_string --match_string="__FLAGTOCHANGE__" --replace_string="false" --target_file="../conf/backend/config-imap.php"
|
|
||||||
|
|
||||||
# Copy config
|
|
||||||
cp -af ../conf/backend/config-imap.php $install_dir/backend/imap/config.php
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Copy config
|
# Copy config
|
||||||
cp -af ../conf/config.php $install_dir/config.php
|
ynh_add_config --template="config.php" --destination="$install_dir/config.php"
|
||||||
cp -af ../conf/backend/config-autodiscover.php $install_dir/autodiscover/config.php
|
ynh_add_config --template="backend/config-autodiscover.php" --destination="$install_dir/autodiscover/config.php"
|
||||||
cp -af ../conf/backend/config-searchldap.php $install_dir/backend/searchldap/config.php
|
ynh_add_config --template="backend/config-searchldap.php" --destination="$install_dir/backend/searchldap/config.php"
|
||||||
|
|
||||||
#Copy XMLElement.php
|
#Copy XMLElement.php
|
||||||
ln -s /usr/share/awl/inc/XML* /var/www/$app/include/
|
ln -s /usr/share/awl/inc/XML* /var/www/$app/include/
|
||||||
|
@ -156,14 +132,6 @@ ynh_script_progression --message="Configuring log rotation..." --weight=1
|
||||||
# Use logrotate to manage application logfile(s)
|
# Use logrotate to manage application logfile(s)
|
||||||
ynh_use_logrotate
|
ynh_use_logrotate
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SETUP SSOWAT
|
|
||||||
#=================================================
|
|
||||||
#REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=1
|
|
||||||
|
|
||||||
#domain_regex=$(echo "$domain" | sed 's@-@.@g')
|
|
||||||
#REMOVEME? ynh_permission_create --permission="autodiscover" --url="re:$domain_regex/[Aa]uto[Dd]iscover/.*" --allowed="visitors" --show_tile="false" --protected="true"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -25,7 +25,7 @@ ynh_remove_nginx_config
|
||||||
# Remove the dedicated PHP-FPM config
|
# Remove the dedicated PHP-FPM config
|
||||||
ynh_remove_fpm_config
|
ynh_remove_fpm_config
|
||||||
|
|
||||||
ynh_secure_remove --file="$final_logpath"
|
ynh_secure_remove --file="$log_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
|
|
105
scripts/upgrade
105
scripts/upgrade
|
@ -15,6 +15,9 @@ source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
upgrade_type=$(ynh_check_app_version_changed)
|
upgrade_type=$(ynh_check_app_version_changed)
|
||||||
|
|
||||||
|
timezone="$(cat /etc/timezone)"
|
||||||
|
log_dir="/var/log/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -51,89 +54,67 @@ ynh_add_nginx_config
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Updating a config file..." --weight=1
|
ynh_script_progression --message="Updating a config file..." --weight=1
|
||||||
|
|
||||||
# Configuration
|
|
||||||
ynh_replace_string --match_string="__TIMEZONE__" --replace_string="$(cat /etc/timezone)" --target_file="../conf/config.php"
|
|
||||||
ynh_replace_string --match_string="__TIMEZONE__" --replace_string="$(cat /etc/timezone)" --target_file="../conf/backend/config-autodiscover.php"
|
|
||||||
ynh_replace_string --match_string="__FINAL_LOGPATH__" --replace_string="$final_logpath" --target_file="../conf/config.php"
|
|
||||||
ynh_replace_string --match_string="__FINAL_LOGPATH__" --replace_string="$final_logpath" --target_file="../conf/backend/config-autodiscover.php"
|
|
||||||
|
|
||||||
# Storage of state_dir in /home/yunohost.app
|
|
||||||
# This contains the sync status in between device and z-push
|
|
||||||
ynh_replace_string __DATA_DIR__ $data_dir ../conf/config.php
|
|
||||||
|
|
||||||
# Enable caldav carddav support
|
# Enable caldav carddav support
|
||||||
if yunohost app list | grep -q 'id: baikal' ; then
|
if yunohost app list | grep -q 'id: baikal' ; then
|
||||||
echo "Detected Baikal"
|
echo "Detected Baikal"
|
||||||
bailkaldomain=$(ynh_app_setting_get --app=baikal --key=domain)
|
baikaldomain=$(ynh_app_setting_get --app="baikal" --key=domain)
|
||||||
bailkalpath=$(ynh_app_setting_get --app=baikal --key=path)
|
baikalpath=$(ynh_app_setting_get --app="baikal" --key=path)
|
||||||
bailkalpath=${bailkalpath%/}
|
baikalpath=${baikalpath%/}
|
||||||
|
|
||||||
# Configuration of backend
|
# Variables to hydrate template
|
||||||
ynh_replace_string --match_string="__BACKEND__" --replace_string="BackendCombined" --target_file="../conf/config.php"
|
backend="BackendCombined"
|
||||||
ynh_replace_string --match_string="__BACKEND__" --replace_string="BackendCombined" --target_file="../conf/backend/config-autodiscover.php"
|
caldav_server="$baikaldomain"
|
||||||
|
caldav_path="${baikalpath}/cal.php/calendars/%u/"
|
||||||
|
caldav_personal="default"
|
||||||
|
|
||||||
# Configuration baikal
|
carddav_server="$baikaldomain"
|
||||||
ynh_replace_string --match_string="__CALDAV_SERVER__" --replace_string="${bailkaldomain}" --target_file="../conf/backend/config-caldav.php"
|
carddav_path="${baikalpath}/card.php/addressbooks/%u/"
|
||||||
ynh_replace_string --match_string="__CALDAV_PATH__" --replace_string="${bailkalpath}/cal.php/calendars/%u/" --target_file="../conf/backend/config-caldav.php"
|
carddav_default_path="${baikalpath}/card.php/addressbooks/%u/default"
|
||||||
ynh_replace_string --match_string="__CALDAV_PERSONAL__" --replace_string="default" --target_file="../conf/backend/config-caldav.php"
|
|
||||||
|
|
||||||
ynh_replace_string --match_string="__CARDDAV_SERVER__" --replace_string="${bailkaldomain}" --target_file="../conf/backend/config-carddav.php"
|
imap_server="$domain"
|
||||||
ynh_replace_string --match_string="__CARDDAV_PATH__" --replace_string="${bailkalpath}/card.php/addressbooks/%u/" --target_file="../conf/backend/config-carddav.php"
|
imap_meeting_use_caldav="true"
|
||||||
ynh_replace_string --match_string="__CARDDAV_DEFAULT_PATH__" --replace_string="${bailkalpath}/card.php/addressbooks/%u/default" --target_file="../conf/backend/config-carddav.php"
|
|
||||||
|
|
||||||
ynh_replace_string --match_string="__IMAP_SERVER__" --replace_string="${domain}" --target_file="../conf/backend/config-imap.php"
|
ynh_add_config --template="backend/config-caldav.php" --destination="$install_dir/backend/caldav/config.php"
|
||||||
ynh_replace_string --match_string="__FLAGTOCHANGE__" --replace_string="true" --target_file="../conf/backend/config-imap.php"
|
ynh_add_config --template="backend/config-carddav.php" --destination="$install_dir/backend/carddav/config.php"
|
||||||
|
ynh_add_config --template="backend/config-imap.php" --destination="$install_dir/backend/imap/config.php"
|
||||||
# Copy config
|
ynh_add_config --template="backend/config-combined.php" --destination="$install_dir/backend/combined/config.php"
|
||||||
cp -af ../conf/backend/config-caldav.php $install_dir/backend/caldav/config.php
|
|
||||||
cp -af ../conf/backend/config-carddav.php $install_dir/backend/carddav/config.php
|
|
||||||
cp -af ../conf/backend/config-imap.php $install_dir/backend/imap/config.php
|
|
||||||
cp -af ../conf/backend/config-combined.php $install_dir/backend/combined/config.php
|
|
||||||
|
|
||||||
elif yunohost app list | grep -q 'id: nextcloud' ; then
|
elif yunohost app list | grep -q 'id: nextcloud' ; then
|
||||||
echo "Detected NextCloud"
|
echo "Detected NextCloud"
|
||||||
nextclouddomain=$(ynh_app_setting_get --app=nextcloud --key=domain)
|
nextclouddomain=$(ynh_app_setting_get --app="nextcloud" --key=domain)
|
||||||
nextcloudpath=$(ynh_app_setting_get --app=nextcloud --key=path)
|
nextcloudpath=$(ynh_app_setting_get --app="nextcloud" --key=path)
|
||||||
nextcloudpath=${nextcloudpath%/}
|
nextcloudpath=${nextcloudpath%/}
|
||||||
|
|
||||||
# Configuration of backend
|
# Variables to hydrate template
|
||||||
ynh_replace_string --match_string="__BACKEND__" --replace_string="BackendCombined" --target_file="../conf/config.php"
|
backend="BackendCombined"
|
||||||
ynh_replace_string --match_string="__BACKEND__" --replace_string="BackendCombined" --target_file="../conf/backend/config-autodiscover.php"
|
caldav_server="$nextclouddomain"
|
||||||
|
caldav_path="${nextcloudpath}/remote.php/dav/calendars/%u/"
|
||||||
|
caldav_personal="personal"
|
||||||
|
|
||||||
# Configuration nextcloud
|
carddav_server="$nextclouddomain"
|
||||||
ynh_replace_string --match_string="__CALDAV_SERVER__" --replace_string="${nextclouddomain}" --target_file="../conf/backend/config-caldav.php"
|
carddav_path="${nextcloudpath}/remote.php/dav/addressbooks/users/%u/"
|
||||||
ynh_replace_string --match_string="__CALDAV_PATH__" --replace_string="${nextcloudpath}/remote.php/dav/calendars/%u/" --target_file="../conf/backend/config-caldav.php"
|
carddav_default_path="${nextcloudpath}/remote.php/dav/addressbooks/users/%u/"
|
||||||
ynh_replace_string --match_string="__CALDAV_PERSONAL__" --replace_string="personal" --target_file="../conf/backend/config-caldav.php"
|
|
||||||
|
|
||||||
ynh_replace_string --match_string="__CARDDAV_SERVER__" --replace_string="${nextclouddomain}" --target_file="../conf/backend/config-carddav.php"
|
imap_server="$domain"
|
||||||
ynh_replace_string --match_string="__CARDDAV_PATH__" --replace_string="${nextcloudpath}/remote.php/dav/addressbooks/users/%u/contacts/" --target_file="../conf/backend/config-carddav.php"
|
imap_meeting_use_caldav="true"
|
||||||
ynh_replace_string --match_string="__CARDDAV_DEFAULT_PATH__" --replace_string="${nextcloudpath}/remote.php/dav/addressbooks/users/%u/contacts/" --target_file="../conf/backend/config-carddav.php"
|
|
||||||
|
|
||||||
ynh_replace_string --match_string="__IMAP_SERVER__" --replace_string="${domain}" --target_file="../conf/backend/config-imap.php"
|
ynh_add_config --template="backend/config-caldav.php" --destination="$install_dir/backend/caldav/config.php"
|
||||||
ynh_replace_string --match_string="__FLAGTOCHANGE__" --replace_string="true" --target_file="../conf/backend/config-imap.php"
|
ynh_add_config --template="backend/config-carddav.php" --destination="$install_dir/backend/carddav/config.php"
|
||||||
|
ynh_add_config --template="backend/config-imap.php" --destination="$install_dir/backend/imap/config.php"
|
||||||
|
ynh_add_config --template="backend/config-combined.php" --destination="$install_dir/backend/combined/config.php"
|
||||||
|
|
||||||
# Copy config
|
|
||||||
cp -af ../conf/backend/config-caldav.php $install_dir/backend/caldav/config.php
|
|
||||||
cp -af ../conf/backend/config-carddav.php $install_dir/backend/carddav/config.php
|
|
||||||
cp -af ../conf/backend/config-imap.php $install_dir/backend/imap/config.php
|
|
||||||
cp -af ../conf/backend/config-combined.php $install_dir/backend/combined/config.php
|
|
||||||
else
|
else
|
||||||
# Configuration of backend
|
backend="BackendIMAP"
|
||||||
ynh_replace_string --match_string="__BACKEND__" --replace_string="BackendIMAP" --target_file="../conf/config.php"
|
imap_server="$domain"
|
||||||
ynh_replace_string --match_string="__BACKEND__" --replace_string="BackendIMAP" --target_file="../conf/backend/config-autodiscover.php"
|
imap_meeting_use_caldav="false"
|
||||||
|
|
||||||
# Configuration imap
|
ynh_add_config --template="backend/config-imap.php" --destination="$install_dir/backend/imap/config.php"
|
||||||
ynh_replace_string --match_string="__IMAP_SERVER__" --replace_string="${domain}" --target_file="../conf/backend/config-imap.php"
|
|
||||||
ynh_replace_string --match_string="__FLAGTOCHANGE__" --replace_string="false" --target_file="../conf/backend/config-imap.php"
|
|
||||||
|
|
||||||
# Copy config
|
|
||||||
cp -af ../conf/backend/config-imap.php $install_dir/backend/imap/config.php
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Copy config
|
# Copy config
|
||||||
cp -af ../conf/config.php $install_dir/config.php
|
ynh_add_config --template="config.php" --destination="$install_dir/config.php"
|
||||||
cp -af ../conf/backend/config-autodiscover.php $install_dir/autodiscover/config.php
|
ynh_add_config --template="backend/config-autodiscover.php" --destination="$install_dir/autodiscover/config.php"
|
||||||
cp -af ../conf/backend/config-searchldap.php $install_dir/backend/searchldap/config.php
|
ynh_add_config --template="backend/config-searchldap.php" --destination="$install_dir/backend/searchldap/config.php"
|
||||||
|
|
||||||
# Fixstates to avoid full resync of devices after version upgrades
|
# Fixstates to avoid full resync of devices after version upgrades
|
||||||
$install_dir/z-push-admin.php -a fixstates
|
$install_dir/z-push-admin.php -a fixstates
|
||||||
|
|
Loading…
Add table
Reference in a new issue