From 1c3ff2ec3e5e75d42b2f90047000e511f372d44f Mon Sep 17 00:00:00 2001 From: yalh76 Date: Tue, 26 Mar 2019 03:26:50 +0100 Subject: [PATCH] Cleanup Back to original variables --- check_process | 1 + conf/nginx.conf | 16 +++----- conf/systemd.service | 13 ------- manifest.json | 2 +- scripts/backup | 8 ++-- scripts/change_url | 34 +--------------- scripts/install | 53 +++++++++---------------- scripts/remove | 8 ++-- scripts/restore | 14 ++++--- scripts/upgrade | 93 +++++++++++++++++++++++++------------------- 10 files changed, 96 insertions(+), 146 deletions(-) delete mode 100644 conf/systemd.service diff --git a/check_process b/check_process index 1ab5ed1..98ddb01 100644 --- a/check_process +++ b/check_process @@ -9,6 +9,7 @@ setup_private=0 setup_public=1 upgrade=1 + upgrade=1 from_commit=bdac42b709cd2bc663a68422f69ac6bfd43a1ce5 backup_restore=1 multi_instance=0 incorrect_path=0 diff --git a/conf/nginx.conf b/conf/nginx.conf index 78174bd..c83ddb1 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -14,37 +14,33 @@ location /Microsoft-Server-ActiveSync { client_max_body_size 20m; client_body_buffer_size 128k; - fastcgi_pass unix:/var/run/php5-fpm-__NAME__.sock; + fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock; include fastcgi_params; fastcgi_param HTTPS on; fastcgi_param SCRIPT_FILENAME $request_filename; - - # Include SSOWAT user panel. - include conf.d/yunohost_panel.conf.inc; } location /AutoDiscover/AutoDiscover.xml { alias /usr/share/z-push/autodiscover/autodiscover.php; - #fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; # for PHP 7.X Debian/Ubuntu - fastcgi_pass unix:/var/run/php5-fpm-__NAME__.sock; + fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock; include fastcgi_params; fastcgi_param HTTPS on; fastcgi_param SCRIPT_FILENAME $request_filename; } + location /Autodiscover/Autodiscover.xml { alias /usr/share/z-push/autodiscover/autodiscover.php; - #fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; # for PHP 7.X Debian/Ubuntu - fastcgi_pass unix:/var/run/php5-fpm-__NAME__.sock; + fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock; include fastcgi_params; fastcgi_param HTTPS on; fastcgi_param SCRIPT_FILENAME $request_filename; } + location /autodiscover/autodiscover.xml { alias /usr/share/z-push/autodiscover/autodiscover.php; - #fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; # for PHP 7.X Debian/Ubuntu - fastcgi_pass unix:/var/run/php5-fpm-__NAME__.sock; + fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock; include fastcgi_params; fastcgi_param HTTPS on; fastcgi_param SCRIPT_FILENAME $request_filename; diff --git a/conf/systemd.service b/conf/systemd.service deleted file mode 100644 index 76cdf64..0000000 --- a/conf/systemd.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=Small description of the service -After=network.target - -[Service] -Type=simple -User=__APP__ -Group=__APP__ -WorkingDirectory=__FINALPATH__/ -ExecStart=__FINALPATH__/script >> /var/log/__APP__/__APP__.log 2>&1 - -[Install] -WantedBy=multi-user.target diff --git a/manifest.json b/manifest.json index e32102a..a0c2dea 100644 --- a/manifest.json +++ b/manifest.json @@ -8,7 +8,7 @@ }, "version": "2.4.5~ynh1", "url": "https://z-push.org", - "license": "free", + "license": "AGPL-3.0-or-later", "maintainer": { "name": "beudbeud, polytan02" }, diff --git a/scripts/backup b/scripts/backup index 850180a..ba78bf9 100755 --- a/scripts/backup +++ b/scripts/backup @@ -26,8 +26,8 @@ app=$YNH_APP_INSTANCE_NAME final_path=$(ynh_app_setting_get $app final_path) domain=$(ynh_app_setting_get $app domain) config_path=$(ynh_app_setting_get $app config_path) -state_path=$(ynh_app_setting_get $app state_path) -log_path=$(ynh_app_setting_get $app log_path) +final_logpath=$(ynh_app_setting_get $app final_logpath) +statedir=$(ynh_app_setting_get $app statedir) #================================================= # STANDARD BACKUP STEPS @@ -42,7 +42,7 @@ ynh_backup "$final_path" ynh_backup "$config_path" # Backup state -ynh_backup "$state_path" +ynh_backup "$statedir" #================================================= # BACKUP THE NGINX CONFIGURATION @@ -56,7 +56,7 @@ ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= ynh_print_info "Backing up php-fpm configuration..." -ynh_backup "/etc/php5/fpm/pool.d/$app.conf" +ynh_backup "/etc/php/7.0/fpm/pool.d/$app.conf" #================================================= # SPECIFIC BACKUP diff --git a/scripts/change_url b/scripts/change_url index 4fc9c72..a2618ee 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -14,10 +14,9 @@ source /usr/share/yunohost/helpers #================================================= old_domain=$YNH_APP_OLD_DOMAIN -old_path=$YNH_APP_OLD_PATH new_domain=$YNH_APP_NEW_DOMAIN -new_path=$YNH_APP_NEW_PATH +new_path="/Microsoft-Server-ActiveSync" app=$YNH_APP_INSTANCE_NAME @@ -29,19 +28,6 @@ ynh_print_info "Loading installation settings..." # Needed for helper "ynh_add_nginx_config" final_path=$(ynh_app_setting_get $app final_path) -# Add settings here as needed by your application -#db_name=$(ynh_app_setting_get "$app" db_name) -#db_pwd=$(ynh_app_setting_get $app db_pwd) - -#================================================= -# CHECK THE SYNTAX OF THE PATHS -#================================================= - -test -n "$old_path" || old_path="/" -test -n "$new_path" || new_path="/" -new_path=$(ynh_normalize_url_path $new_path) -old_path=$(ynh_normalize_url_path $old_path) - #================================================= # CHECK WHICH PARTS SHOULD BE CHANGED #================================================= @@ -52,12 +38,6 @@ then change_domain=1 fi -change_path=0 -if [ "$old_path" != "$new_path" ] -then - change_path=1 -fi - #================================================= # STANDARD MODIFICATIONS #================================================= @@ -67,18 +47,6 @@ ynh_print_info "Updating nginx web server configuration..." nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf -# Change the path in the nginx config file -if [ $change_path -eq 1 ] -then - # Make a backup of the original nginx config file if modified - ynh_backup_if_checksum_is_different "$nginx_conf_path" - # Set global variables for nginx helper - domain="$old_domain" - path_url="$new_path" - # Create a dedicated nginx config - ynh_add_nginx_config -fi - # Change the domain for nginx if [ $change_domain -eq 1 ] then diff --git a/scripts/install b/scripts/install index 9bd0933..8c561a2 100755 --- a/scripts/install +++ b/scripts/install @@ -14,11 +14,6 @@ source ynh_add_secure_repos__2 # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { - ### Remove this function if there's nothing to clean before calling the remove script. - read -p "Press any key..." - true -} # Exit if an error occurs during the execution of the script ynh_abort_if_errors @@ -27,13 +22,7 @@ ynh_abort_if_errors #================================================= domain=$YNH_APP_ARG_DOMAIN -path_url="/" - -path_url_activesync="/Microsoft-Server-ActiveSync" -path_url_autodiscover1="/AutoDiscover" -path_url_autodiscover2="/Autodiscover" -path_url_autodiscover3="/autodiscover" - +path_url="/Microsoft-Server-ActiveSync" app=$YNH_APP_INSTANCE_NAME @@ -44,16 +33,13 @@ ynh_print_info "Validating installation parameters..." final_path=/usr/share/z-push config_path=/etc/z-push -state_path=/var/lib/z-push -log_path=/var/log/z-push +final_logpath=/var/log/z-push +statedir=/var/lib/z-push test ! -e "$final_path" || ynh_die "This path already contains a folder" -# Normalize the url path syntax -path_url=$(ynh_normalize_url_path $path_url) - # Register (book) web path -ynh_webpath_register $app $domain $path_url_activesync +ynh_webpath_register $app $domain $path_url #================================================= # STORE SETTINGS FROM MANIFEST @@ -64,8 +50,8 @@ ynh_app_setting_set $app domain $domain ynh_app_setting_set $app path $path_url ynh_app_setting_set $app final_path $final_path ynh_app_setting_set $app config_path $config_path -ynh_app_setting_set $app state_path $state_path -ynh_app_setting_set $app log_path $log_path +ynh_app_setting_set $app final_logpath $final_logpath +ynh_app_setting_set $app statedir $statedir #================================================= # STANDARD MODIFICATIONS @@ -74,7 +60,6 @@ ynh_app_setting_set $app log_path $log_path #================================================= ynh_print_info "Installing dependencies..." -#ynh_install_extra_repo --repo="deb http://repo.z-hub.io/z-push:/final/Debian_9.0/ stretch stable" ynh_add_repo --uri="http://repo.z-hub.io/z-push:/final/Debian_9.0/" --suite="/" --component="" --name="$app" ynh_pin_repo --package="*" --pin="origin \"repo.z-hub.io\"" --name="$app" @@ -100,10 +85,10 @@ ynh_add_fpm_config # MODIFY A CONFIG FILE #================================================= -sudo cp ../conf/policies.ini $config_path/policies.ini -sudo cp ../conf/z-push.conf.php $config_path/z-push.conf.php -sudo cp ../conf/galsearch-ldap.conf.php $config_path/galsearch-ldap.conf.php -sudo cp ../conf/autodiscover.conf.php $config_path/autodiscover.conf.php +cp ../conf/policies.ini $config_path/policies.ini +cp ../conf/z-push.conf.php $config_path/z-push.conf.php +cp ../conf/galsearch-ldap.conf.php $config_path/galsearch-ldap.conf.php +cp ../conf/autodiscover.conf.php $config_path/autodiscover.conf.php # Configuration of timezone ynh_replace_string "__TIMEZONE__" "$(cat /etc/timezone)" "$config_path/z-push.conf.php" @@ -120,15 +105,15 @@ if yunohost app list --installed -f baikal | grep -q id ; then # Configuration of backend ynh_replace_string "__BACKEND_PROVIDER__" "BackendCombined" "$config_path/z-push.conf.php" ynh_replace_string "__BACKEND_PROVIDER__" "BackendCombined" "$config_path/autodiscover.conf.php" - sudo cp ../conf/combined.conf.php $config_path/combined.conf.php + cp ../conf/combined.conf.php $config_path/combined.conf.php # Configuration of caldav - sudo cp ../conf/caldav.conf.php $config_path/caldav.conf.php + cp ../conf/caldav.conf.php $config_path/caldav.conf.php ynh_replace_string "__DOMAIN__" "$baikaldomain" "$config_path/caldav.conf.php" ynh_replace_string "__CALDAV_PATH__" "$baikalpath/cal.php/calendars/%u/" "$config_path/caldav.conf.php" # Configuration of carddav - sudo cp ../conf/carddav.conf.php $config_path/carddav.conf.php + cp ../conf/carddav.conf.php $config_path/carddav.conf.php ynh_replace_string "__DOMAIN__" "$baikaldomain" "$config_path/carddav.conf.php" ynh_replace_string "__CARDDAV_PATH__" "$baikalpath/card.php/addressbooks/%u/" "$config_path/carddav.conf.php" ynh_replace_string "__CARDDAV_DEFAULT_PATH__" "$baikalpath/card.php/addressbooks/%u/default" "$config_path/carddav.conf.php" @@ -147,15 +132,15 @@ elif yunohost app list --installed -f nextcloud | grep -q id ; then # Configuration of backend ynh_replace_string "__BACKEND_PROVIDER__" "BackendCombined" "$config_path/z-push.conf.php" ynh_replace_string "__BACKEND_PROVIDER__" "BackendCombined" "$config_path/autodiscover.conf.php" - sudo cp ../conf/combined.conf.php $config_path/combined.conf.php + cp ../conf/combined.conf.php $config_path/combined.conf.php # Configuration of caldav - sudo cp ../conf/caldav.conf.php $config_path/caldav.conf.php + cp ../conf/caldav.conf.php $config_path/caldav.conf.php ynh_replace_string "__DOMAIN__" "$nextclouddomain" "$config_path/caldav.conf.php" ynh_replace_string "__CALDAV_PATH__" "$nextcloudpath/remote.php/dav/calendars/%u/personal/" "$config_path/caldav.conf.php" # Configuration of carddav - sudo cp ../conf/carddav.conf.php $config_path/carddav.conf.php + cp ../conf/carddav.conf.php $config_path/carddav.conf.php ynh_replace_string "__DOMAIN__" "$nextclouddomain" "$config_path/carddav.conf.php" ynh_replace_string "__CARDDAV_PATH__" "$nextcloudpath/remote.php/dav/addressbooks/users/%u/contacts/" "$config_path/carddav.conf.php" ynh_replace_string "__CARDDAV_DEFAULT_PATH__" "$nextcloudpath/remote.php/dav/addressbooks/users/%u/contacts/" "$config_path/carddav.conf.php" @@ -172,7 +157,7 @@ else fi # Configuration of imap - sudo cp ../conf/imap.conf.php $config_path/imap.conf.php + cp ../conf/imap.conf.php $config_path/imap.conf.php ynh_replace_string "__DOMAIN__" "$domain" "$config_path/imap.conf.php" ynh_replace_string "__IMAP_MEETING_USE_CALDAV__" "false" "$config_path/imap.conf.php" @@ -197,8 +182,8 @@ ynh_store_file_checksum "$config_path/autodiscover.conf.php" # Set permissions to app files chown -R www-data:www-data $final_path -chown -R www-data:www-data $log_path -chown -R www-data:www-data $state_path +chown -R www-data:www-data $final_logpath +chown -R www-data:www-data $statedir #================================================= # SETUP LOGROTATE diff --git a/scripts/remove b/scripts/remove index 5c9e505..6349fa9 100755 --- a/scripts/remove +++ b/scripts/remove @@ -20,8 +20,8 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get $app domain) final_path=$(ynh_app_setting_get $app final_path) config_path=$(ynh_app_setting_get $app config_path) -state_path=$(ynh_app_setting_get $app state_path) -log_path=$(ynh_app_setting_get $app log_path) +final_logpath=$(ynh_app_setting_get $app final_logpath) +statedir=$(ynh_app_setting_get $app statedir) #================================================= # STANDARD REMOVE @@ -77,10 +77,10 @@ ynh_remove_logrotate ynh_secure_remove "$config_path" # Remove the log files -ynh_secure_remove "$log_path" +ynh_secure_remove "$final_logpath" # Remove the state -ynh_secure_remove "$state_path" +ynh_secure_remove "$statedir" #================================================= # GENERIC FINALIZATION diff --git a/scripts/restore b/scripts/restore index a0bd973..4e06800 100755 --- a/scripts/restore +++ b/scripts/restore @@ -28,8 +28,8 @@ domain=$(ynh_app_setting_get $app domain) path_url=$(ynh_app_setting_get $app path) final_path=$(ynh_app_setting_get $app final_path) config_path=$(ynh_app_setting_get $app config_path) -state_path=$(ynh_app_setting_get $app state_path) -log_path=$(ynh_app_setting_get $app log_path) +final_logpath=$(ynh_app_setting_get $app final_logpath) +statedir=$(ynh_app_setting_get $app statedir) #================================================= # CHECK IF THE APP CAN BE RESTORED @@ -60,7 +60,7 @@ ynh_restore_file "$final_path" ynh_restore_file "$config_path" # Restore state -ynh_restore_file "$state_path" +ynh_restore_file "$statedir" #================================================= # RESTORE THE PHP-FPM CONFIGURATION @@ -73,8 +73,10 @@ ynh_restore_file "/etc/php/7.0/fpm/pool.d/$app.conf" #================================================= # REINSTALL DEPENDENCIES #================================================= +ynh_print_info "Reinstalling dependencies..." -ynh_install_extra_repo --repo="deb http://repo.z-hub.io/z-push:/final/Debian_9.0/ /" --key="http://repo.z-hub.io/z-push:/final/Debian_9.0/Release.key" +ynh_add_repo --uri="http://repo.z-hub.io/z-push:/final/Debian_9.0/" --suite="/" --component="" --name="$app" +ynh_pin_repo --package="*" --pin="origin \"repo.z-hub.io\"" --name="$app" ynh_install_app_dependencies $pkg_dependencies @@ -90,8 +92,8 @@ ynh_restore_file "/etc/logrotate.d/$app" # Restore permissions on app files chown -R www-data:www-data $final_path -chown -R www-data:www-data $log_path -chown -R www-data:www-data $state_path +chown -R www-data:www-data $final_logpath +chown -R www-data:www-data $statedir #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index 753eaa2..7fc71f9 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -21,29 +21,14 @@ domain=$(ynh_app_setting_get $app domain) path_url=$(ynh_app_setting_get $app path) final_path=$(ynh_app_setting_get $app final_path) config_path=$(ynh_app_setting_get $app config_path) -state_path=$(ynh_app_setting_get $app state_path) -log_path=$(ynh_app_setting_get $app log_path) +statedir=$(ynh_app_setting_get $app statedir) +final_logpath=$(ynh_app_setting_get $app final_logpath) #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= ynh_print_info "Ensuring downward compatibility..." -# If final_path doesn't exist, create it -if [ -z $final_path ]; then - final_path=/usr/share/z-push - ynh_app_setting_set $app final_path $final_path -fi - -config_path=/etc/z-push -state_path=/var/lib/z-push -log_path=/var/log/z-push - -ynh_app_setting_set $app config_path $config_path -ynh_app_setting_set $app state_path $state_path -ynh_app_setting_set $app log_path $log_path - - #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -65,6 +50,23 @@ ynh_abort_if_errors # Normalize the URL path syntax path_url=$(ynh_normalize_url_path $path_url) +#================================================= +# REMOVE OLD VERSION +#================================================= + +# If final_path doesn't exist, create it +if [ $final_path == "/var/www/$app" ]; then + ynh_secure_remove "$final_path" + final_path=/usr/share/z-push + config_path=/etc/z-push + statedir=/var/lib/z-push + final_logpath=/var/log/z-push + ynh_app_setting_set $app final_path $final_path + ynh_app_setting_set $app config_path $config_path + ynh_app_setting_set $app statedir $statedir + ynh_app_setting_set $app final_logpath $final_logpath +fi + #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -80,7 +82,8 @@ ynh_add_nginx_config #================================================= ynh_print_info "Upgrading dependencies..." -ynh_install_extra_repo --repo="deb http://repo.z-hub.io/z-push:/final/Debian_9.0/ /" --key="http://repo.z-hub.io/z-push:/final/Debian_9.0/Release.key" +ynh_add_repo --uri="http://repo.z-hub.io/z-push:/final/Debian_9.0/" --suite="/" --component="" --name="$app" +ynh_pin_repo --package="*" --pin="origin \"repo.z-hub.io\"" --name="$app" ynh_install_app_dependencies $pkg_dependencies @@ -98,10 +101,10 @@ ynh_add_fpm_config # MODIFY A CONFIG FILE #================================================= -sudo cp ../conf/policies.ini $config_path/policies.ini -sudo cp ../conf/z-push.conf.php $config_path/z-push.conf.php -sudo cp ../conf/galsearch-ldap.conf.php $config_path/galsearch-ldap.conf.php -sudo cp ../conf/autodiscover.conf.php $config_path/autodiscover.conf.php +cp ../conf/policies.ini $config_path/policies.ini +cp ../conf/z-push.conf.php $config_path/z-push.conf.php +cp ../conf/galsearch-ldap.conf.php $config_path/galsearch-ldap.conf.php +cp ../conf/autodiscover.conf.php $config_path/autodiscover.conf.php # Configuration of timezone ynh_replace_string "__TIMEZONE__" "$(cat /etc/timezone)" "$config_path/z-push.conf.php" @@ -109,7 +112,7 @@ ynh_replace_string "__TIMEZONE__" "$(cat /etc/timezone)" "$config_path/autodisco # Enable caldav carddav support -if sudo yunohost app list --installed -f baikal | grep -q id ; then +if yunohost app list --installed -f baikal | grep -q id ; then echo "Detected Baikal" baikaldomain=$(ynh_app_setting_get baikal domain) baikalpath=$(ynh_app_setting_get baikal path) @@ -118,15 +121,15 @@ if sudo yunohost app list --installed -f baikal | grep -q id ; then # Configuration of backend ynh_replace_string "__BACKEND_PROVIDER__" "BackendCombined" "$config_path/z-push.conf.php" ynh_replace_string "__BACKEND_PROVIDER__" "BackendCombined" "$config_path/autodiscover.conf.php" - sudo cp ../conf/combined.conf.php $config_path/combined.conf.php + cp ../conf/combined.conf.php $config_path/combined.conf.php # Configuration of caldav - sudo cp ../conf/caldav.conf.php $config_path/caldav.conf.php + cp ../conf/caldav.conf.php $config_path/caldav.conf.php ynh_replace_string "__DOMAIN__" "$baikaldomain" "$config_path/caldav.conf.php" ynh_replace_string "__CALDAV_PATH__" "$baikalpath/cal.php/calendars/%u/" "$config_path/caldav.conf.php" # Configuration of carddav - sudo cp ../conf/carddav.conf.php $config_path/carddav.conf.php + cp ../conf/carddav.conf.php $config_path/carddav.conf.php ynh_replace_string "__DOMAIN__" "$baikaldomain" "$config_path/carddav.conf.php" ynh_replace_string "__CARDDAV_PATH__" "$baikalpath/card.php/addressbooks/%u/" "$config_path/carddav.conf.php" ynh_replace_string "__CARDDAV_DEFAULT_PATH__" "$baikalpath/card.php/addressbooks/%u/default" "$config_path/carddav.conf.php" @@ -136,7 +139,7 @@ if sudo yunohost app list --installed -f baikal | grep -q id ; then ynh_store_file_checksum "$config_path/caldav.conf.php" ynh_store_file_checksum "$config_path/carddav.conf.php" -elif sudo yunohost app list --installed -f nextcloud | grep -q id ; then +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) @@ -145,15 +148,15 @@ elif sudo yunohost app list --installed -f nextcloud | grep -q id ; then # Configuration of backend ynh_replace_string "__BACKEND_PROVIDER__" "BackendCombined" "$config_path/z-push.conf.php" ynh_replace_string "__BACKEND_PROVIDER__" "BackendCombined" "$config_path/autodiscover.conf.php" - sudo cp ../conf/combined.conf.php $config_path/combined.conf.php + cp ../conf/combined.conf.php $config_path/combined.conf.php # Configuration of caldav - sudo cp ../conf/caldav.conf.php $config_path/caldav.conf.php + cp ../conf/caldav.conf.php $config_path/caldav.conf.php ynh_replace_string "__DOMAIN__" "$nextclouddomain" "$config_path/caldav.conf.php" ynh_replace_string "__CALDAV_PATH__" "$nextcloudpath/remote.php/dav/calendars/%u/personal/" "$config_path/caldav.conf.php" # Configuration of carddav - sudo cp ../conf/carddav.conf.php $config_path/carddav.conf.php + cp ../conf/carddav.conf.php $config_path/carddav.conf.php ynh_replace_string "__DOMAIN__" "$nextclouddomain" "$config_path/carddav.conf.php" ynh_replace_string "__CARDDAV_PATH__" "$nextcloudpath/remote.php/dav/addressbooks/users/%u/contacts/" "$config_path/carddav.conf.php" ynh_replace_string "__CARDDAV_DEFAULT_PATH__" "$nextcloudpath/remote.php/dav/addressbooks/users/%u/contacts/" "$config_path/carddav.conf.php" @@ -170,15 +173,32 @@ else fi # Configuration of imap - sudo cp ../conf/imap.conf.php $config_path/imap.conf.php + cp ../conf/imap.conf.php $config_path/imap.conf.php ynh_replace_string "__DOMAIN__" "$domain" "$config_path/imap.conf.php" ynh_replace_string "__IMAP_MEETING_USE_CALDAV__" "false" "$config_path/imap.conf.php" # Checksum of config files ynh_store_file_checksum "$config_path/imap.conf.php" +#================================================= +# SECURE FILES AND DIRECTORIES +#================================================= + +# Set permissions on app files +chown -R www-data:www-data $final_path +chown -R www-data:www-data $final_logpath +chown -R www-data:www-data $statedir + +#================================================= +# FIX STATES +#================================================= + # Fixstates to avoid full resync of devices after version upgrades -sudo $final_path/z-push-admin.php -a fixstates +$final_path/z-push-admin.php -a fixstates + +#================================================= +# STORE THE CONFIG FILE CHECKSUM +#================================================= ynh_backup_if_checksum_is_different "$config_path/policies.ini" ynh_backup_if_checksum_is_different "$config_path/z-push.conf.php" @@ -201,15 +221,6 @@ ynh_use_logrotate --non-append #================================================= # GENERIC FINALIZATION -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= - -# Set permissions on app files -chown -R www-data:www-data $final_path -chown -R www-data:www-data $log_path -chown -R www-data:www-data $state_path - #================================================= # SETUP SSOWAT #=================================================