From 20e04d38d6d805b7d19a17e9c400ac77bc5bb64d Mon Sep 17 00:00:00 2001 From: Yalh Date: Sat, 26 Jan 2019 07:17:46 +0100 Subject: [PATCH] upgrade to 2.4.5 --- conf/app.src | 4 +- conf/nginx.conf | 57 ++++++++++++++++++++--------- manifest.json | 2 +- scripts/install | 97 ++++++++++++++++++------------------------------- scripts/remove | 1 + 5 files changed, 79 insertions(+), 82 deletions(-) diff --git a/conf/app.src b/conf/app.src index 506e928..e4dd89f 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=http://download.z-push.org/final/2.3/z-push-2.3.6.tar.gz -SOURCE_SUM=9f86e4f6d822558bffdf05bebce4f1157ed7d8784b52d488935ef6d02efc27d7 +SOURCE_URL=url of app's source +SOURCE_SUM=sha256 checksum SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/conf/nginx.conf b/conf/nginx.conf index 1ed8396..04ec809 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,8 +1,9 @@ -#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; -location __PATH__ { +location /Microsoft-Server-ActiveSync { # Path to source - alias __FINALPATH__ ; + alias /usr/share/z-push/index.php; + access_log /var/log/nginx/z-push-access.log; + error_log /var/log/nginx/z-push-error.log; # Force usage of https if ($scheme = http) { @@ -10,24 +11,46 @@ location __PATH__ { } ### Example PHP configuration (remove it if not used) - index index.php; + #index index.php; # Common parameter to increase upload size limit in conjunction with dedicated php-fpm file - client_max_body_size 50M; + client_max_body_size 20m; + client_body_buffer_size 128k; + #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; + - try_files $uri $uri/ index.php; - rewrite ^(.*)$ __PATH__/index.php last; - location ~ [^/]\.php(/|$) { - fastcgi_split_path_info ^(.+?\.php)(/.*)$; - fastcgi_pass unix:/var/run/php5-fpm-__NAME__.sock; - fastcgi_index index.php; - include fastcgi_params; - fastcgi_param HTTPS on; - fastcgi_read_timeout 630; - fastcgi_param SCRIPT_FILENAME $request_filename; - } + #try_files $uri $uri/ index.php; + #rewrite ^(.*)$ __PATH__/index.php last; + #location ~ [^/]\.php(/|$) { + # fastcgi_split_path_info ^(.+?\.php)(/.*)$; + # fastcgi_pass unix:/var/run/php5-fpm-__NAME__.sock; + # fastcgi_index index.php; + # include fastcgi_params; + # fastcgi_param HTTPS on; + # fastcgi_read_timeout 630; + # fastcgi_param SCRIPT_FILENAME $request_filename; + #} ### End of PHP configuration part # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; -} \ No newline at end of file +} + + + + 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; + } + 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; + } + 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; + } \ No newline at end of file diff --git a/manifest.json b/manifest.json index 79d8f52..52a3dfb 100644 --- a/manifest.json +++ b/manifest.json @@ -15,7 +15,7 @@ "requirements": { "yunohost": ">=2.4.0" }, - "multi_instance": true, + "multi_instance": false, "services": [ "nginx", "php5-fpm" diff --git a/scripts/install b/scripts/install index eeba614..ec83857 100755 --- a/scripts/install +++ b/scripts/install @@ -49,8 +49,8 @@ app=$YNH_APP_INSTANCE_NAME ### If the app uses nginx as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app". ### If the app provides an internal web server (or uses another application server such as uwsgi), the final path should be "/opt/yunohost/$app" -final_path=/var/www/$app -test ! -e "$final_path" || ynh_die "This path already contains a folder" +#final_path=/var/www/$app +#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) @@ -96,7 +96,11 @@ ynh_app_setting_set $app path $path_url ### - As well as the section "REINSTALL DEPENDENCIES" in the restore script ### - And the section "UPGRADE DEPENDENCIES" in the upgrade script -ynh_install_app_dependencies php-soap php5-imap libawl-php php5-xsl +echo "deb http://repo.z-hub.io/z-push:/final/Debian_9.0/ /" | tee /etc/apt/sources.list.d/z-push.list +wget -qO - http://repo.z-hub.io/z-push:/final/Debian_8.0/Release.key | sudo apt-key add - +yunohost tools update +ynh_install_app_dependencies z-push-common z-push-config-nginx z-push-backend-caldav z-push-backend-carddav z-push-backend-combined z-push-backend-imap z-push-backend-ldap z-push-backend-galsearch-ldap z-push-autodiscover +ynh_install_app_dependencies php-memcached php-cli php-soap #================================================= # CREATE A MYSQL DATABASE @@ -125,24 +129,7 @@ ynh_install_app_dependencies php-soap php5-imap libawl-php php5-xsl ynh_app_setting_set $app final_path $final_path # Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source "$final_path" - -statedir="/home/yunohost.app/$app" -CHECK_STATEDIRPATH () { # Vérifie que le dossier de destination n'est pas déjà utilisé. - if [ -e "$statedir" ] - then - echo "This path already contains a folder" >&2 - false - fi -} - -CHECK_STATEDIRPATH -ynh_app_setting_set "$app" statedir "$statedir" - - - -final_logpath="/var/log/$app" -ynh_app_setting_set "$app" final_logpath "$final_logpath" +#ynh_setup_source "$final_path" #================================================= # NGINX CONFIGURATION @@ -152,10 +139,6 @@ ynh_app_setting_set "$app" final_logpath "$final_logpath" # Create a dedicated nginx config ynh_add_nginx_config -# Modify Nginx configuration file and copy it to Nginx conf directory -#sudo sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf -#sudo sed -i "s@NAMETOCHANGE@$app@g" ../conf/nginx.conf -#sudo cp ../conf/nginx.conf $final_nginxconf #================================================= # CREATE DEDICATED USER @@ -250,57 +233,47 @@ ynh_add_fpm_config #ynh_replace_string "match_string" "replace_string" "$final_path/conf/config.php" # Configuration -sed -i "s^define('TIMEZONE', .*^define('TIMEZONE', '$(cat /etc/timezone)');^" ../conf/config.php -sed -i "s@LOGTOCHANGE@$final_logpath@g" ../conf/config.php +#sed -i "s^define('TIMEZONE', .*^define('TIMEZONE', '$(cat /etc/timezone)');^" /etc/z-push/z-push.conf.php +ynh_replace_string "define('TIMEZONE', '');" "define('TIMEZONE', '$(cat /etc/timezone)');" /etc/z-push/z-push.conf.php + -# Storage of state_dir in /home/yunohost.app -# This contains the sync status in between device and z-push -sed -i "s@STATEDIRTOCHANGE@$statedir@g" ../conf/config.php -sudo mkdir -p $statedir -sudo chown -R www-data:www-data $statedir # Enable caldav carddav support if sudo 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%/} + baikaldomain=$(ynh_app_setting_get baikal domain) + baikalpath=$(ynh_app_setting_get baikal path) + baikalpath=${caldavpath%/} # Configuration of backend - sed -i "s@BACKENDTOCHANGE@BackendCombined@g" ../conf/config.php + #sed -i "s@BACKENDTOCHANGE@BackendCombined@g" /etc/z-push/z-push.conf.php + ynh_replace_string "define('BACKEND_PROVIDER', '');" "define('BACKEND_PROVIDER', 'BackendCombined');" /etc/z-push/z-push.conf.php # Configuration baikal - sed -i "s@BAIKALDOMAIN@$caldavdomain@g" ../conf/backend/config*.php - sed -i "s@BAIKALPATH@$caldavpath@g" ../conf/backend/config*.php - sed -i "s@DOMAINTOCHANGE@$domain@g" ../conf/backend/config-imap.php - sed -i "s@FLAGTOCHANGE@true@g" ../conf/backend/config-imap.php + #sed -i "s@BAIKALDOMAIN@$caldavdomain@g" /etc/z-push/caldav.conf.php + ynh_replace_string "caldavserver.domain.com" $baikaldomain /etc/z-push/caldav.conf.php + #sed -i "s@BAIKALPATH@$caldavpath@g" /etc/z-push/caldav.conf.php + ynh_replace_string "define('CALDAV_PATH', '/caldav.php/%u/');" "define('CALDAV_PATH', '$baikalpath/cal.php/calendars/%u/');" /etc/z-push/caldav.conf.php + #sed -i "s@BAIKALDOMAIN@$caldavdomain@g" /etc/z-push/carddav.conf.php + ynh_replace_string "define('CARDDAV_SERVER', 'localhost');" "define('CARDDAV_SERVER', '$baikaldomain');" /etc/z-push/carddav.conf.php + #sed -i "s@BAIKALPATH@$caldavpath@g" /etc/z-push/carddav.conf.php + ynh_replace_string "define('CARDDAV_PATH', '/caldav.php/%u/');" "define('CARDDAV_PATH', '$baikalpath/card.php/addressbooks/%u/');" /etc/z-push/carddav.conf.php + #sed -i "s@DOMAINTOCHANGE@$domain@g" /etc/z-push/imap.conf.php + ynh_replace_string "//$imap_smtp_params = array('host' => 'ssl://localhost', 'port' => 465, 'auth' => true, 'username' => 'imap_username', 'password' => 'imap_password');" "$imap_smtp_params = array('host' => 'tcp://$baikaldomai', 'port' => 587, 'auth' => true, 'username' => 'imap_username', 'password' => 'imap_password', 'localhost' => '$baikaldomai', 'verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true);" /etc/z-push/imap.conf.php + #sed -i "s@FLAGTOCHANGE@true@g" /etc/z-push/imap.conf.php + ynh_replace_string"define('IMAP_MEETING_USE_CALDAV', false);" "define('IMAP_MEETING_USE_CALDAV', true);" /etc/z-push/imap.conf.php - # Copy config - sudo cp ../conf/config.php $final_path/config.php - sudo cp ../conf/backend/config-imap.php $final_path/backend/imap/config.php - sudo cp ../conf/backend/config-carddav.php $final_path/backend/carddav/config.php - sudo cp ../conf/backend/config-caldav.php $final_path/backend/caldav/config.php - sudo cp ../conf/backend/config-combined.php $final_path/backend/combined/config.php else # Configuration of backend - sed -i "s@BACKENDTOCHANGE@BackendIMAP@g" ../conf/config.php + #sed -i "s@BACKENDTOCHANGE@BackendIMAP@g" /etc/z-push/z-push.conf.php + ynh_replace_string "define('BACKEND_PROVIDER', '');" "define('BACKEND_PROVIDER', 'BackendIMAP');" /etc/z-push/z-push.conf.php # Copy config - sudo cp ../conf/config.php $final_path/config.php - sed -i "s@DOMAINTOCHANGE@$domain@g" ../conf/backend/config-imap.php - sed -i "s@FLAGTOCHANGE@false@g" ../conf/backend/config-imap.php - sudo cp ../conf/backend/config-imap.php $final_path/backend/imap/config.php - + #sed -i "s@DOMAINTOCHANGE@$domain@g" /etc/z-push/imap.conf.php + ynh_replace_string "//$imap_smtp_params = array('host' => 'ssl://localhost', 'port' => 465, 'auth' => true, 'username' => 'imap_username', 'password' => 'imap_password');" "$imap_smtp_params = array('host' => 'tcp://$baikaldomai', 'port' => 587, 'auth' => true, 'username' => 'imap_username', 'password' => 'imap_password', 'localhost' => '$baikaldomai', 'verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true);" /etc/z-push/imap.conf.php + fi -#Copy XMLElement.php -sudo ln -s /usr/share/awl/inc/XML* /var/www/$app/include/ - -# Create log directory -sudo mkdir -p $final_logpath -sudo chmod 750 $final_logpath -sudo chown www-data:www-data $final_logpath - #================================================= # STORE THE CONFIG FILE CHECKSUM #================================================= @@ -310,7 +283,7 @@ sudo chown www-data:www-data $final_logpath ### you can make a backup of this file before modifying it again if the admin had modified it. # Calculate and store the config file checksum into the app settings -ynh_store_file_checksum "$final_path/config.php" +ynh_store_file_checksum "/etc/z-push/z-push.conf.php" #================================================= # GENERIC FINALIZATION @@ -323,7 +296,7 @@ ynh_store_file_checksum "$final_path/config.php" ### that really need such authorization. # Set permissions to app files -chown -R www-data: $final_path +#chown -R www-data: $final_path #================================================= # SETUP LOGROTATE diff --git a/scripts/remove b/scripts/remove index 65ee47f..036e8ad 100755 --- a/scripts/remove +++ b/scripts/remove @@ -110,6 +110,7 @@ ynh_secure_remove "/var/log/$app/" # Remove the statedir ynh_secure_remove "$statedir" +ynh_secure_remove /etc/apt/sources.list.d/z-push.list #================================================= # GENERIC FINALIZATION