1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/z-push_ynh.git synced 2024-09-03 18:05:58 +02:00

upgrade to 2.4.5

This commit is contained in:
Yalh 2019-01-26 07:17:46 +01:00
parent ee2553d344
commit 20e04d38d6
5 changed files with 79 additions and 82 deletions

View file

@ -1,5 +1,5 @@
SOURCE_URL=http://download.z-push.org/final/2.3/z-push-2.3.6.tar.gz SOURCE_URL=url of app's source
SOURCE_SUM=9f86e4f6d822558bffdf05bebce4f1157ed7d8784b52d488935ef6d02efc27d7 SOURCE_SUM=sha256 checksum
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true SOURCE_IN_SUBDIR=true

View file

@ -1,8 +1,9 @@
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; location /Microsoft-Server-ActiveSync {
location __PATH__ {
# Path to source # 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 # Force usage of https
if ($scheme = http) { if ($scheme = http) {
@ -10,24 +11,46 @@ location __PATH__ {
} }
### Example PHP configuration (remove it if not used) ### 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 # 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; #try_files $uri $uri/ index.php;
location ~ [^/]\.php(/|$) { #rewrite ^(.*)$ __PATH__/index.php last;
fastcgi_split_path_info ^(.+?\.php)(/.*)$; #location ~ [^/]\.php(/|$) {
fastcgi_pass unix:/var/run/php5-fpm-__NAME__.sock; # fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_index index.php; # fastcgi_pass unix:/var/run/php5-fpm-__NAME__.sock;
include fastcgi_params; # fastcgi_index index.php;
fastcgi_param HTTPS on; # include fastcgi_params;
fastcgi_read_timeout 630; # fastcgi_param HTTPS on;
fastcgi_param SCRIPT_FILENAME $request_filename; # fastcgi_read_timeout 630;
} # fastcgi_param SCRIPT_FILENAME $request_filename;
#}
### End of PHP configuration part ### End of PHP configuration part
# Include SSOWAT user panel. # Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc; 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;
}
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;
}

View file

@ -15,7 +15,7 @@
"requirements": { "requirements": {
"yunohost": ">=2.4.0" "yunohost": ">=2.4.0"
}, },
"multi_instance": true, "multi_instance": false,
"services": [ "services": [
"nginx", "nginx",
"php5-fpm" "php5-fpm"

View file

@ -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 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" ### 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 #final_path=/var/www/$app
test ! -e "$final_path" || ynh_die "This path already contains a folder" #test ! -e "$final_path" || ynh_die "This path already contains a folder"
# Normalize the url path syntax # Normalize the url path syntax
path_url=$(ynh_normalize_url_path $path_url) 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 ### - As well as the section "REINSTALL DEPENDENCIES" in the restore script
### - And the section "UPGRADE DEPENDENCIES" in the upgrade 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 # 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 ynh_app_setting_set $app final_path $final_path
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source "$final_path" #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"
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
@ -152,10 +139,6 @@ ynh_app_setting_set "$app" final_logpath "$final_logpath"
# Create a dedicated nginx config # Create a dedicated nginx config
ynh_add_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 # CREATE DEDICATED USER
@ -250,57 +233,47 @@ ynh_add_fpm_config
#ynh_replace_string "match_string" "replace_string" "$final_path/conf/config.php" #ynh_replace_string "match_string" "replace_string" "$final_path/conf/config.php"
# Configuration # Configuration
sed -i "s^define('TIMEZONE', .*^define('TIMEZONE', '$(cat /etc/timezone)');^" ../conf/config.php #sed -i "s^define('TIMEZONE', .*^define('TIMEZONE', '$(cat /etc/timezone)');^" /etc/z-push/z-push.conf.php
sed -i "s@LOGTOCHANGE@$final_logpath@g" ../conf/config.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 # Enable caldav carddav support
if sudo yunohost app list --installed -f baikal | grep -q id ; then if sudo yunohost app list --installed -f baikal | grep -q id ; then
echo "Detected Baikal" echo "Detected Baikal"
caldavdomain=$(ynh_app_setting_get baikal domain) baikaldomain=$(ynh_app_setting_get baikal domain)
caldavpath=$(ynh_app_setting_get baikal path) baikalpath=$(ynh_app_setting_get baikal path)
caldavpath=${caldavpath%/} baikalpath=${caldavpath%/}
# Configuration of backend # 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 # Configuration baikal
sed -i "s@BAIKALDOMAIN@$caldavdomain@g" ../conf/backend/config*.php #sed -i "s@BAIKALDOMAIN@$caldavdomain@g" /etc/z-push/caldav.conf.php
sed -i "s@BAIKALPATH@$caldavpath@g" ../conf/backend/config*.php ynh_replace_string "caldavserver.domain.com" $baikaldomain /etc/z-push/caldav.conf.php
sed -i "s@DOMAINTOCHANGE@$domain@g" ../conf/backend/config-imap.php #sed -i "s@BAIKALPATH@$caldavpath@g" /etc/z-push/caldav.conf.php
sed -i "s@FLAGTOCHANGE@true@g" ../conf/backend/config-imap.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 else
# Configuration of backend # 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 # Copy config
sudo cp ../conf/config.php $final_path/config.php #sed -i "s@DOMAINTOCHANGE@$domain@g" /etc/z-push/imap.conf.php
sed -i "s@DOMAINTOCHANGE@$domain@g" ../conf/backend/config-imap.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@false@g" ../conf/backend/config-imap.php
sudo cp ../conf/backend/config-imap.php $final_path/backend/imap/config.php
fi 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 # 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. ### 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 # 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 # GENERIC FINALIZATION
@ -323,7 +296,7 @@ ynh_store_file_checksum "$final_path/config.php"
### that really need such authorization. ### that really need such authorization.
# Set permissions to app files # Set permissions to app files
chown -R www-data: $final_path #chown -R www-data: $final_path
#================================================= #=================================================
# SETUP LOGROTATE # SETUP LOGROTATE

View file

@ -110,6 +110,7 @@ ynh_secure_remove "/var/log/$app/"
# Remove the statedir # Remove the statedir
ynh_secure_remove "$statedir" ynh_secure_remove "$statedir"
ynh_secure_remove /etc/apt/sources.list.d/z-push.list
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION