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

Merge pull request #65 from YunoHost-Apps/testing

Testing
This commit is contained in:
yalh76 2021-02-15 22:28:07 +01:00 committed by GitHub
commit a05896f0e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 122 additions and 114 deletions

View file

@ -1,26 +1,27 @@
# Z-Push For Yunohost
[![Integration level](https://dash.yunohost.org/integration/z-push.svg)](https://dash.yunohost.org/appci/app/z-push)
[![Install z-push with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=z-push)
# Z-Push for YunoHost
[![Integration level](https://dash.yunohost.org/integration/z-push.svg)](https://dash.yunohost.org/appci/app/z-push) ![](https://ci-apps.yunohost.org/ci/badges/z-push.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/z-push.maintain.svg)
[![Install Z-Push with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=z-push)
> *This package allow you to install Z-Push quickly and simply on a YunoHost server.
If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.*
## Overview
Z-Push is an Exchange ActiveSync fronted written in php which lets you synchronize emails (imap/smtp backend) and calendar/contacts (carddav and caldav backend)
Z-Push is an Exchange ActiveSync fronted written in PHP which lets you synchronize emails (IMAP/SMTP backend) and calendar/contacts (cardDAV and caldDAV backend)
**Shipped version:** 2.5.2
**Shipped version:** 2.6.1
## Current status
- [x] Z-push for Yunohost supports IMAP sync and Carddav/Caldav sync if Baikal or Nextcloud is installed
- [x] Z-Push for YunoHost supports IMAP sync and CardDAV/CalDAV sync if Baïkal or Nextcloud is installed
- [x] Ability to send calendar invitations
- [x] Use of push for emails, contacts and calendar
- [x] Sync States are now stored in /home/yunohost.app/$app
- [x] Logrotate has been activated as z-push can become noisy at times
- [x] z-push is now configured to use smtp to send emails instead of php_mail() function. This let us have emails signed by dkim for example.
- [x] The current imap backend configuration seems able to handle email addresses different from login (for example login : john and email john.doe@domain.tld instead of john@domain.tld) - Further testing required !
- [x] Sync States are now stored in `/home/yunohost.app/$app`
- [x] Logrotate has been activated as Z-Push can become noisy at times
- [x] Z-Push is now configured to use SMTP to send emails instead of `php_mail()` function. This let us have emails signed by dkim for example.
- [x] The current IMAP backend configuration seems able to handle email addresses different from login (for example login: john and email john.doe@domain.tld instead of john@domain.tld) - Further testing required!
- [x] The sources are based on http://download.z-push.org/final/
- [x] Autodiscover implemented
- [x] Use of version 2.5.2 final
- [x] Use of version 2.6.1 final
## Documentation
@ -28,7 +29,7 @@ Z-Push is an Exchange ActiveSync fronted written in php which lets you synchroni
#### Supported architectures
* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/z-push%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/z-push/)
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/z-push%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/z-push/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/z-push%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/z-push/)
## Links
@ -40,8 +41,7 @@ Z-Push is an Exchange ActiveSync fronted written in php which lets you synchroni
---
Developers info
----------------
## Developers info
Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/z-push_ynh/tree/testing).

View file

@ -13,15 +13,17 @@
upgrade=1
# 2.5.1~ynh3
upgrade=1 from_commit=9e8a72669814237122dfc6f901c9377895c193db
# 2.5.2~ynh1
upgrade=1 from_commit=a857788c1fb369baa5f0608da12013b003cceed3
backup_restore=1
multi_instance=1
# This test is no longer necessary since the version 2.7 (PR: https://github.com/YunoHost/yunohost/pull/304), you can still do it if your app could be installed with this version.
# incorrect_path=1
port_already_use=0
change_url=0
;;; Levels
# If the level 5 (Package linter) is forced to 1. Please add justifications here.
Level 5=auto
;;; Options
Email=yalh@yahoo.com
Notification=all
;;; Upgrade options
; commit=9e8a72669814237122dfc6f901c9377895c193db
name=2.5.1~ynh3
; commit=a857788c1fb369baa5f0608da12013b003cceed3
name=2.5.2~ynh1

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://github.com/Z-Hub/Z-Push/archive/2.5.2.tar.gz
SOURCE_SUM=68fd705deee5481bb2935c32d9e184310ac2f1438e7791350313e7f4174d7040
SOURCE_URL=https://github.com/Z-Hub/Z-Push/archive/2.6.1.tar.gz
SOURCE_SUM=db97e9ff2eebec01c65e1a9150524a1fb45dc4b003955fb0847fbb069f143e33
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true

View file

@ -16,7 +16,7 @@ location /Microsoft-Server-ActiveSync/ {
rewrite ^(.*)$ /Microsoft-Server-ActiveSync/index.php last;
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock;
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
fastcgi_index index.php;
include fastcgi_params;
@ -31,7 +31,7 @@ location /Microsoft-Server-ActiveSync/ {
location /AutoDiscover/AutoDiscover.xml {
alias __FINALPATH__/autodiscover/autodiscover.php;
fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock;
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
include fastcgi_params;
fastcgi_param HTTPS on;
fastcgi_param SCRIPT_FILENAME $request_filename;
@ -39,7 +39,7 @@ location /AutoDiscover/AutoDiscover.xml {
location /Autodiscover/Autodiscover.xml {
alias __FINALPATH__/autodiscover/autodiscover.php;
fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock;
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
include fastcgi_params;
fastcgi_param HTTPS on;
fastcgi_param SCRIPT_FILENAME $request_filename;
@ -47,7 +47,7 @@ location /Autodiscover/Autodiscover.xml {
location /autodiscover/autodiscover.xml {
alias __FINALPATH__/autodiscover/autodiscover.php;
fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock;
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
include fastcgi_params;
fastcgi_param HTTPS on;
fastcgi_param SCRIPT_FILENAME $request_filename;

View file

@ -33,7 +33,7 @@ group = __USER__
; (IPv6 and IPv4-mapped) on a specific port;
; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
listen = /var/run/php/php7.0-fpm-__NAMETOCHANGE__.sock
listen = /var/run/php/php__PHPVERSION__-fpm-__NAMETOCHANGE__.sock
; Set listen(2) backlog.
; Default Value: 511 (-1 on FreeBSD and OpenBSD)

View file

@ -3,10 +3,10 @@
"id": "z-push",
"packaging_format": 1,
"description": {
"en": "Z-Push is an ActiveSync frontend that helps you synchronize emails, calendar and contacts",
"fr": "Z-Push est un frontend ActiveSync qui permet de synchroniser emails, calendrier et contacts"
"en": "ActiveSync frontend that helps you synchronize emails, calendar and contacts",
"fr": "Frontend ActiveSync qui permet de synchroniser emails, calendrier et contacts"
},
"version": "2.5.2~ynh1",
"version": "2.6.1~ynh1",
"url": "https://z-push.org",
"license": "AGPL-3.0-or-later",
"maintainer": {
@ -21,11 +21,11 @@
}
],
"requirements": {
"yunohost": ">= 3.5"
"yunohost": ">= 3.8.1"
},
"services": [
"nginx",
"php7.0-fpm"
"php7.3-fpm"
],
"multi_instance": true,
"arguments": {
@ -34,8 +34,8 @@
"name": "domain",
"type": "domain",
"ask": {
"en": "Choose a domain for Z-push",
"fr": "Choisissez un domaine pour Z-push"
"en": "Choose a domain for Z-Push",
"fr": "Choisissez un domaine pour Z-Push"
},
"example": "domain.org"
}

View file

@ -5,7 +5,11 @@
#=================================================
# dependencies used by the app
pkg_dependencies="php-soap php-imap libawl-php php-xsl php-curl libawl-php php-xml php-ldap php-cli php-mbstring php-memcached"
pkg_dependencies="libawl-php"
YNH_PHP_VERSION="7.3"
extra_php_dependencies="php${YNH_PHP_VERSION}-soap php${YNH_PHP_VERSION}-imap php${YNH_PHP_VERSION}-xsl php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-ldap php${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-memcached"
#=================================================
# PERSONAL HELPERS

View file

@ -13,7 +13,6 @@ source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_print_info --message="Managing script failure..."
ynh_clean_setup () {
true
@ -32,13 +31,16 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
statedir=$(ynh_app_setting_get --app=$app --key=statedir)
final_logpath=$(ynh_app_setting_get --app=$app --key=final_logpath)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# STANDARD BACKUP STEPS
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================
ynh_print_info --message="Backing up the main app directory..."
ynh_backup --src_path="$final_path"
@ -51,21 +53,20 @@ ynh_backup --src_path="$final_logpath"
#=================================================
# BACKUP THE NGINX CONFIGURATION
#=================================================
ynh_print_info --message="Backing up nginx web server configuration..."
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# BACKUP THE PHP-FPM CONFIGURATION
#=================================================
ynh_print_info --message="Backing up php-fpm configuration..."
ynh_backup --src_path="/etc/php/7.0/fpm/pool.d/$app.conf"
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#=================================================
# SPECIFIC BACKUP
#=================================================
# BACKUP LOGROTATE
#=================================================
ynh_print_info --message="Backing up logrotate configuration..."
ynh_backup --src_path="/etc/logrotate.d/$app"

View file

@ -12,7 +12,6 @@ source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_print_info --message="Managing script failure..."
ynh_clean_setup () {
true
@ -23,7 +22,6 @@ ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
ynh_print_info --message="Retrieving arguments from the manifest..."
domain=$YNH_APP_ARG_DOMAIN
path_url="/Microsoft-Server-ActiveSync"
@ -33,7 +31,7 @@ app=$YNH_APP_INSTANCE_NAME
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
ynh_print_info --message="Validating installation parameters..."
ynh_script_progression --message="Validating installation parameters..."
final_path=/var/www/$app
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
@ -49,11 +47,10 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_print_info --message="Storing installation settings..."
ynh_script_progression --message="Storing installation settings..."
ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=statedir --value="$statedir"
ynh_app_setting_set --app=$app --key=final_logpath --value="$final_logpath"
@ -62,14 +59,14 @@ ynh_app_setting_set --app=$app --key=final_logpath --value="$final_logpath"
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_print_info --message="Installing dependencies..."
ynh_script_progression --message="Installing dependencies..."
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_print_info --message="Setting up source files..."
ynh_script_progression --message="Setting up source files..."
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
@ -82,7 +79,7 @@ ynh_secure_remove "$final_path/tmp"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_print_info --message="Configuring nginx web server..."
ynh_script_progression --message="Configuring NGINX web server..."
# Create a dedicated nginx config
ynh_add_nginx_config
@ -90,7 +87,7 @@ ynh_add_nginx_config
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_print_info --message="Configuring system user..."
ynh_script_progression --message="Configuring system user..."
# Create a system user
ynh_system_user_create --username=$app
@ -98,17 +95,18 @@ ynh_system_user_create --username=$app
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_print_info --message="Configuring php-fpm..."
ynh_script_progression --message="Configuring PHP-FPM..."
# Create a dedicated php-fpm config
ynh_add_fpm_config
ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencies"
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# SPECIFIC SETUP
#=================================================
# CREATE STATEDIR AND FINAL_LOGPATH
#=================================================
ynh_print_info --message="Creating statedir and final_logpath..."
ynh_script_progression --message="Creating statedir and final_logpath..."
mkdir -p $statedir
chown -R $app: $statedir
@ -119,7 +117,7 @@ chown -R $app: $final_logpath
#=================================================
# MODIFY A CONFIG FILE
#=================================================
ynh_print_info --message="Modifying a config file..."
ynh_script_progression --message="Modifying a config file..."
# Configuration
ynh_replace_string --match_string="__TIMEZONE__" --replace_string=$(cat /etc/timezone) --target_file="../conf/config.php"
@ -132,7 +130,7 @@ ynh_replace_string --match_string="__FINAL_LOGPATH__" --replace_string=$final_lo
ynh_replace_string --match_string="__STATEDIR__" --replace_string=$statedir --target_file="../conf/config.php"
# Enable caldav carddav support
if yunohost app list --installed -f baikal | grep -q id ; then
if yunohost app list | grep -q 'id: baikal' ; then
echo "Detected Baikal"
bailkaldomain=$(ynh_app_setting_get --app="baikal" --key=domain)
bailkalpath=$(ynh_app_setting_get --app="baikal" --key=path)
@ -160,7 +158,7 @@ if yunohost app list --installed -f baikal | grep -q id ; then
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
elif yunohost app list | grep -q 'id: nextcloud' ; then
echo "Detected NextCloud"
nextclouddomain=$(ynh_app_setting_get --app="nextcloud" --key=domain)
nextcloudpath=$(ynh_app_setting_get --app="nextcloud" --key=path)
@ -213,7 +211,7 @@ ln -s /usr/share/awl/inc/XML* /var/www/$app/include/
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
ynh_print_info --message="Securing files and directories..."
ynh_script_progression --message="Securing files and directories..."
# Set permissions to app files
chown -R $app: $final_path
@ -221,7 +219,7 @@ chown -R $app: $final_path
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_print_info --message="Configuring log rotation..."
ynh_script_progression --message="Configuring log rotation..."
# Use logrotate to manage application logfile(s)
ynh_use_logrotate
@ -229,7 +227,7 @@ ynh_use_logrotate
#=================================================
# SETUP SSOWAT
#=================================================
ynh_print_info --message="Configuring SSOwat..."
ynh_script_progression --message="Configuring SSOwat..."
# Make app public
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
@ -239,7 +237,7 @@ ynh_app_setting_set --app=$app --key=skipped_regex --value="$domain_regex/[Aa]ut
#=================================================
# RELOAD NGINX
#=================================================
ynh_print_info --message="Reloading nginx web server..."
ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload
@ -247,4 +245,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT
#=================================================
ynh_print_info --message="Installation of $app completed"
ynh_script_progression --message="Installation of $app completed"

View file

@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info --message="Loading installation settings..."
ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
@ -27,7 +27,7 @@ final_logpath=$(ynh_app_setting_get --app=$app --key=final_logpath)
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_print_info --message="Removing dependencies..."
ynh_script_progression --message="Removing dependencies..."
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
@ -35,7 +35,7 @@ ynh_remove_app_dependencies
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_print_info --message="Removing app main directory..."
ynh_script_progression --message="Removing app main directory..."
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
@ -43,7 +43,7 @@ ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_print_info --message="Removing nginx web server configuration..."
ynh_script_progression --message="Removing NGINX web server configuration..."
# Remove the dedicated nginx config
ynh_remove_nginx_config
@ -51,7 +51,7 @@ ynh_remove_nginx_config
#=================================================
# REMOVE PHP-FPM CONFIGURATION
#=================================================
ynh_print_info --message="Removing php-fpm configuration..."
ynh_script_progression --message="Removing PHP-FPM configuration..."
# Remove the dedicated php-fpm config
ynh_remove_fpm_config
@ -59,7 +59,7 @@ ynh_remove_fpm_config
#=================================================
# REMOVE LOGROTATE CONFIGURATION
#=================================================
ynh_print_info --message="Removing logrotate configuration..."
ynh_script_progression --message="Removing logrotate configuration..."
# Remove the app-specific logrotate config
ynh_remove_logrotate
@ -69,13 +69,23 @@ ynh_remove_logrotate
#=================================================
# REMOVE STATEDIR AND FINAL_LOGPATH
#=================================================
ynh_print_info --message="Removing statedir and final_logpath..."
ynh_script_progression --message="Removing statedir and final_logpath..."
ynh_secure_remove --file="$statedir"
ynh_secure_remove --file="$final_logpath"
#=================================================
# GENERIC FINALIZATION
#=================================================
# REMOVE DEDICATED USER
#=================================================
ynh_script_progression --message="Removing the dedicated system user..."
# Delete a system user
ynh_system_user_delete --username=$app
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info --message="Removal of $app completed"
ynh_script_progression --message="Removal of $app completed"

View file

@ -13,7 +13,7 @@ source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_print_info --message="Managing script failure..."
ynh_script_progression --message="Managing script failure..."
ynh_clean_setup () {
true
@ -24,7 +24,7 @@ ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info --message="Loading settings..."
ynh_script_progression --message="Loading settings..."
app=$YNH_APP_INSTANCE_NAME
@ -33,11 +33,12 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
statedir=$(ynh_app_setting_get --app=$app --key=statedir)
final_logpath=$(ynh_app_setting_get --app=$app --key=final_logpath)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_print_info --message="Validating restoration parameters..."
ynh_script_progression --message="Validating restoration parameters..."
ynh_webpath_available --domain=$domain --path_url=$path_url \
|| ynh_die --message="Path not available: ${domain}${path_url}"
@ -49,14 +50,14 @@ test ! -d $final_path \
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_print_info --message="Restoring the nginx configuration..."
ynh_script_progression --message="Restoring the NGINX configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_print_info --message="Restoring the app main directory..."
ynh_script_progression --message="Restoring the app main directory..."
ynh_restore_file --origin_path="$final_path"
@ -69,7 +70,7 @@ ynh_restore_file --origin_path="$final_logpath"
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_print_info --message="Recreating the dedicated system user..."
ynh_script_progression --message="Recreating the dedicated system user..."
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app
@ -77,7 +78,7 @@ ynh_system_user_create --username=$app
#=================================================
# RESTORE USER RIGHTS
#=================================================
ynh_print_info --message="Restoring user rights..."
ynh_script_progression --message="Restoring user rights..."
# Restore permissions on app files
chown -R $app: $final_path
@ -87,16 +88,19 @@ chown -R $app: $final_logpath
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_print_info --message="Restoring PHP-FPM configuration..."
ynh_script_progression --message="Restoring PHP-FPM configuration..."
ynh_restore_file --origin_path="/etc/php/7.0/fpm/pool.d/$app.conf"
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
# Recreate a dedicated php-fpm config
ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencies"
#=================================================
# SPECIFIC RESTORATION
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_print_info --message="Reinstalling dependencies..."
ynh_script_progression --message="Reinstalling dependencies..."
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
@ -104,7 +108,7 @@ ynh_install_app_dependencies $pkg_dependencies
#=================================================
# RESTORE THE LOGROTATE CONFIGURATION
#=================================================
ynh_print_info --message="Restoring the logrotate configuration..."
ynh_script_progression --message="Restoring the logrotate configuration..."
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
@ -113,13 +117,13 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#=================================================
# RELOAD NGINX AND PHP-FPM
#=================================================
ynh_print_info --message="Reloading nginx web server and php-fpm..."
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..."
ynh_systemd_action --service_name=php7.0-fpm --action=reload
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info --message="Restoration completed for $app"
ynh_script_progression --message="Restoration completed for $app"

View file

@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info --message="Loading installation settings..."
ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
@ -25,14 +25,14 @@ final_logpath=$(ynh_app_setting_get --app=$app --key=final_logpath)
#=================================================
# CHECK VERSION
#=================================================
ynh_print_info --message="Checking version..."
ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_print_info --message="Ensuring downward compatibility..."
ynh_script_progression --message="Ensuring downward compatibility..."
# Fix is_public as a boolean value
if [ "$is_public" = "Yes" ]; then
@ -66,7 +66,7 @@ fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_print_info --message="Backing up the app before upgrading (may take a while)..."
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
# Backup the current version of the app
ynh_backup_before_upgrade
@ -77,18 +77,6 @@ ynh_clean_setup () {
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# CHECK THE PATH
#=================================================
# Normalize the URL path syntax
# N.B. : this is for app installations before YunoHost 2.7
# where this value might be something like /foo/ or foo/
# instead of /foo ....
# If nobody installed your app before 2.7, then you may
# safely remove this line
path_url=$(ynh_normalize_url_path --path_url=$path_url)
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
@ -97,7 +85,7 @@ path_url=$(ynh_normalize_url_path --path_url=$path_url)
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_print_info --message="Upgrading source files..."
ynh_script_progression --message="Upgrading source files..."
# Download, check integrity, uncompress and patch the source from app.src
mkdir "$final_path/tmp"
@ -109,7 +97,7 @@ fi
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_print_info --message="Upgrading nginx web server configuration..."
ynh_script_progression --message="Upgrading NGINX web server configuration..."
# Create a dedicated nginx config
ynh_add_nginx_config
@ -117,14 +105,14 @@ ynh_add_nginx_config
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_print_info --message="Upgrading dependencies..."
ynh_script_progression --message="Upgrading dependencies..."
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_print_info --message="Making sure dedicated system user exists..."
ynh_script_progression --message="Making sure dedicated system user exists..."
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app
@ -132,17 +120,18 @@ ynh_system_user_create --username=$app
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_print_info --message="Upgrading php-fpm configuration..."
ynh_script_progression --message="Upgrading PHP-FPM configuration..."
# Create a dedicated php-fpm config
ynh_add_fpm_config
ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencies"
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# SPECIFIC UPGRADE
#=================================================
# MODIFY A CONFIG FILE
#=================================================
ynh_print_info --message="Modifying a config file..."
ynh_script_progression --message="Modifying a config file..."
# Configuration
ynh_replace_string --match_string="__TIMEZONE__" --replace_string="$(cat /etc/timezone)" --target_file="../conf/config.php"
@ -155,7 +144,7 @@ ynh_replace_string --match_string="__FINAL_LOGPATH__" --replace_string="$final_l
ynh_replace_string __STATEDIR__ $statedir ../conf/config.php
# Enable caldav carddav support
if yunohost app list --installed -f baikal | grep -q id ; then
if yunohost app list | grep -q 'id: baikal' ; then
echo "Detected Baikal"
bailkaldomain=$(ynh_app_setting_get --app=baikal --key=domain)
bailkalpath=$(ynh_app_setting_get --app=baikal --key=path)
@ -183,7 +172,7 @@ if yunohost app list --installed -f baikal | grep -q id ; then
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
elif yunohost app list | grep -q 'id: nextcloud' ; then
echo "Detected NextCloud"
nextclouddomain=$(ynh_app_setting_get --app=nextcloud --key=domain)
nextcloudpath=$(ynh_app_setting_get --app=nextcloud --key=path)
@ -234,7 +223,7 @@ $final_path/z-push-admin.php -a fixstates
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_print_info --message="Upgrading logrotate configuration..."
ynh_script_progression --message="Upgrading logrotate configuration..."
# Use logrotate to manage app-specific logfile(s)
ynh_use_logrotate --non-append
@ -244,7 +233,7 @@ ynh_use_logrotate --non-append
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
ynh_print_info --message="Securing files and directories..."
ynh_script_progression --message="Securing files and directories..."
# Set permissions on app files
chown -R $app: $final_path
@ -255,7 +244,7 @@ chown -R $app: $final_logpath
#=================================================
# SETUP SSOWAT
#=================================================
ynh_print_info --message="Upgrading SSOwat configuration..."
ynh_script_progression --message="Upgrading SSOwat configuration..."
# Make app public
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
@ -265,7 +254,7 @@ ynh_app_setting_set --app=$app --key=skipped_regex --value="$domain_regex/[Aa]ut
#=================================================
# RELOAD NGINX
#=================================================
ynh_print_info --message="Reloading nginx web server..."
ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload
@ -273,4 +262,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT
#=================================================
ynh_print_info --message="Upgrade of $app completed"
ynh_script_progression --message="Upgrade of $app completed"