1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/roundcube_ynh.git synced 2024-09-03 20:16:28 +02:00

Merge pull request #119 from YunoHost-Apps/testing

Testing
This commit is contained in:
Alexandre Aubin 2021-11-20 22:36:30 +01:00 committed by GitHub
commit f470adac11
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 544 additions and 360 deletions

129
.github/workflows/updater.sh vendored Executable file
View file

@ -0,0 +1,129 @@
#!/bin/bash
#=================================================
# PACKAGE UPDATING HELPER
#=================================================
# This script is meant to be run by GitHub Actions
# The YunoHost-Apps organisation offers a template Action to run this script periodically
# Since each app is different, maintainers can adapt its contents so as to perform
# automatic actions when a new upstream release is detected.
# Remove this exit command when you are ready to run this Action
#exit 1
#=================================================
# FETCHING LATEST RELEASE AND ITS ASSETS
#=================================================
# Fetching information
current_version=$(cat manifest.json | jq -j '.version|split("~")[0]')
repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]')
# Some jq magic is needed, because the latest upstream release is not always the latest version (e.g. security patches for older versions)
version=$(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '.[] | select( .prerelease != true ) | .tag_name' | sort -V | tail -1)
assets=($(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '[ .[] | select(.tag_name=="'$version'").assets[].browser_download_url ] | join(" ") | @sh' | tr -d "'"))
# Later down the script, we assume the version has only digits and dots
# Sometimes the release name starts with a "v", so let's filter it out.
# You may need more tweaks here if the upstream repository has different naming conventions.
if [[ ${version:0:1} == "v" || ${version:0:1} == "V" ]]; then
version=${version:1}
fi
# Setting up the environment variables
echo "Current version: $current_version"
echo "Latest release from upstream: $version"
echo "VERSION=$version" >> $GITHUB_ENV
# For the time being, let's assume the script will fail
echo "PROCEED=false" >> $GITHUB_ENV
# Proceed only if the retrieved version is greater than the current one
if ! dpkg --compare-versions "$current_version" "lt" "$version" ; then
echo "::warning ::No new version available"
exit 0
# Proceed only if a PR for this new version does not already exist
elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.git ci-auto-update-v$version ; then
echo "::warning ::A branch already exists for this update"
exit 0
fi
# Each release can hold multiple assets (e.g. binaries for different architectures, source code, etc.)
echo "${#assets[@]} available asset(s)"
#=================================================
# UPDATE SOURCE FILES
#=================================================
# Here we use the $assets variable to get the resources published in the upstream release.
# Here is an example for Grav, it has to be adapted in accordance with how the upstream releases look like.
# Let's loop over the array of assets URLs
for asset_url in ${assets[@]}; do
echo "Handling asset at $asset_url"
# Assign the asset to a source file in conf/ directory
# Here we base the source file name upon a unique keyword in the assets url (admin vs. update)
# Leave $src empty to ignore the asset
case $asset_url in
*"roundcubemail-"*".tar.gz"*)
src="app"
;;
esac
# If $src is not empty, let's process the asset
if [ ! -z "$src" ]; then
# Create the temporary directory
tempdir="$(mktemp -d)"
# Download sources and calculate checksum
filename=${asset_url##*/}
curl --silent -4 -L $asset_url -o "$tempdir/$filename"
checksum=$(sha256sum "$tempdir/$filename" | head -c 64)
# Delete temporary directory
rm -rf $tempdir
# Get extension
if [[ $filename == *.tar.gz ]]; then
extension=tar.gz
else
extension=${filename##*.}
fi
# Rewrite source file
cat <<EOT > conf/$src.src
SOURCE_URL=$asset_url
SOURCE_SUM=$checksum
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
EOT
echo "... conf/$src.src updated"
else
echo "... asset ignored"
fi
done
#=================================================
# SPECIFIC UPDATE STEPS
#=================================================
# Any action on the app's source code can be done.
# The GitHub Action workflow takes care of committing all changes after this script ends.
#=================================================
# GENERIC FINALIZATION
#=================================================
# Replace new version in manifest
echo "$(jq -s --indent 4 ".[] | .version = \"$version~ynh1\"" manifest.json)" > manifest.json
# No need to update the README, yunohost-bot takes care of it
# The Action will proceed only if the PROCEED environment variable is set to true
echo "PROCEED=true" >> $GITHUB_ENV
exit 0

49
.github/workflows/updater.yml vendored Normal file
View file

@ -0,0 +1,49 @@
# This workflow allows GitHub Actions to automagically update your app whenever a new upstream release is detected.
# You need to enable Actions in your repository settings, and fetch this Action from the YunoHost-Apps organization.
# This file should be enough by itself, but feel free to tune it to your needs.
# It calls updater.sh, which is where you should put the app-specific update steps.
name: Check for new upstream releases
on:
# Allow to manually trigger the workflow
workflow_dispatch:
# Run it every day at 6:00 UTC
schedule:
- cron: '0 6 * * *'
jobs:
updater:
runs-on: ubuntu-latest
steps:
- name: Fetch the source code
uses: actions/checkout@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run the updater script
id: run_updater
run: |
# Setting up Git user
git config --global user.name 'yunohost-bot'
git config --global user.email 'yunohost-bot@users.noreply.github.com'
# Run the updater script
/bin/bash .github/workflows/updater.sh
- name: Commit changes
id: commit
if: ${{ env.PROCEED == 'true' }}
run: |
git commit -am "Upgrade to v$VERSION"
- name: Create Pull Request
id: cpr
if: ${{ env.PROCEED == 'true' }}
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update to version ${{ env.VERSION }}
committer: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
author: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
signoff: false
base: testing
branch: ci-auto-update-v${{ env.VERSION }}
delete-branch: true
title: 'Upgrade to version ${{ env.VERSION }}'
body: |
Upgrade to v${{ env.VERSION }}
draft: false

View file

@ -1,3 +1,8 @@
<!--
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
It shall NOT be edited by hand.
-->
# Roundcube for YunoHost
[![Integration level](https://dash.yunohost.org/integration/roundcube.svg)](https://dash.yunohost.org/appci/app/roundcube) ![](https://ci-apps.yunohost.org/ci/badges/roundcube.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/roundcube.maintain.svg)
@ -5,30 +10,12 @@
*[Lire ce readme en français.](./README_fr.md)*
> *This package allow you to install Roundcube 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.*
> *This package allows you to install Roundcube quickly and simply on a YunoHost server.
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
## Overview
[Roundcube](https://roundcube.net/) is a browser-based multilingual IMAP client with an application-like user interface.
**Shipped version:** 1.4.11
## Screenshots
![](https://roundcube.net/screens/skins/elastic/desktop/screens/mailbox_widescreen.png)
## Demo
* [YunoHost demo](https://demo.yunohost.org/webmail/)
## Configuration
You can extend - or even override - the Roundcube configuration which is coming with this package in the file `conf/local.inc.php`. Do not edit the file `conf/config.inc.php` as future upgrades will overwrite it.
## Documentation
* Official documentation: https://github.com/roundcube/roundcubemail/wiki
* YunoHost documentation: https://github.com/YunoHost/doc/blob/master/app_roundcube.md:
Roundcube is a browser-based multilingual IMAP client with an application-like user interface. It provides full functionality you expect from an email client, including MIME support, address book, folder manipulation, message searching and spell checking.
## YunoHost specific features
@ -37,22 +24,27 @@ In addition to Roundcube core features, the following are made available with th
* Synchronize your email aliases as identities in Roundcube
* Install the [contextmenu](https://plugins.roundcube.net/packages/johndoh/contextmenu) and [automatic addressbook](https://plugins.roundcube.net/packages/sblaisot/automatic_addressbook) plugins by default
* Allow to install the [CardDAV](https://plugins.roundcube.net/packages/roundcube/carddav) (address book) synchronization plugin at the installation - note that if you have installed Nextcloud or Baïkal, it will automatically add the corresponding and existing address book.
* Support for PGP encryption with Enigma plugin by default.
**Shipped version:** 1.5.0~ynh1
**Demo:** https://demo.yunohost.org/webmail/
## Screenshots
![](./doc/screenshots/screenshot.png)
## Disclaimers / important information
## Configuration
You can extend - or even override - the Roundcube configuration which is coming with this package in the file `conf/local.inc.php`. Do not edit the file `conf/config.inc.php` as future upgrades will overwrite it.
#### Multi-users support
* Integrate with YunoHost users and SSO - i.e logout button, YunoHost users search
#### Supported architectures
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/roundcube%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/roundcube/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/roundcube%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/roundcube/)
## Limitations
* No known limitations.
## Additional information
#### Plugins
You can also install other plugins - which will not be removed with upgrades. To do so, you can use the official [Plugin Repository](https://plugins.roundcube.net/).
@ -90,18 +82,17 @@ Note that you should also check the plugin homepage for additional installation
You can also download the plugin and put it under the `plugins/` directory. In this case, do not forget to change ownerships of this folder to `roundcube`.
## Links
## Documentation and resources
* Report a bug: https://github.com/YunoHost-Apps/roundcube_ynh/issues
* Roundcube website: https://roundcube.net/
* Roundcube repository: https://github.com/roundcube/roundcubemail
* YunoHost website: https://yunohost.org/
* Official app website: https://roundcube.net/
* Official admin documentation: https://github.com/roundcube/roundcubemail/wiki
* Upstream app code repository: https://github.com/roundcube/roundcubemail
* YunoHost documentation for this app: https://yunohost.org/app_roundcube
* Report a bug: https://github.com/YunoHost-Apps/roundcube_ynh/issues
---
## Developer info
## Developers info
Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/roundcube_ynh/tree/testing).
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/roundcube_ynh/tree/testing).
To try the testing branch, please proceed like that.
```
@ -109,3 +100,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/roundcube_ynh/tree/te
or
sudo yunohost app upgrade roundcube -u https://github.com/YunoHost-Apps/roundcube_ynh/tree/testing --debug
```
**More info regarding app packaging:** https://yunohost.org/packaging_apps

View file

@ -1,34 +1,17 @@
# Roundcube pour YunoHost
[![Integration level](https://dash.yunohost.org/integration/roundcube.svg)](https://dash.yunohost.org/appci/app/roundcube) ![](https://ci-apps.yunohost.org/ci/badges/roundcube.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/roundcube.maintain.svg)
[![Niveau d'intégration](https://dash.yunohost.org/integration/roundcube.svg)](https://dash.yunohost.org/appci/app/roundcube) ![](https://ci-apps.yunohost.org/ci/badges/roundcube.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/roundcube.maintain.svg)
[![Installer Roundcube avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=roundcube)
*[Read this readme in english.](./README.md)*
*[Read this readme in english.](./README.md)*
*[Lire ce readme en français.](./README_fr.md)*
> *Ce package vous permet d'installer Roundcube rapidement et simplement sur un serveur YunoHost.
Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/#/install) pour apprendre comment l'installer.*
> *Ce package vous permet d'installer Roundcube rapidement et simplement sur un serveur YunoHost.
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
## Overview
[Roundcube](https://roundcube.net/) est un client IMAP multilingue basé sur un navigateur avec une interface utilisateur semblable à une application.
## Vue d'ensemble
**Shipped version:** 1.4.11
## Screenshots
![](https://roundcube.net/screens/skins/elastic/desktop/screens/mailbox_widescreen.png)
## Démo
* [Démo YunoHost](https://demo.yunohost.org/webmail/)
## Configuration
Vous pouvez étendre (ou même remplacer) la configuration de Roundcube fournie avec ce paquet dans le fichier `conf/local.inc.php`. Ne modifiez pas le fichier `conf/config.inc.php` car les futures mises à jour le remplaceront.
## Documentation
* Documentation officielle : https://github.com/roundcube/roundcubemail/wiki
* Documentation YunoHost : https://github.com/YunoHost/doc/blob/master/app_roundcube.md:
Roundcube est un client IMAP multilingue basé sur un navigateur avec une interface utilisateur semblable à une application.
## Caractéristiques spécifiques YunoHost
@ -38,22 +21,27 @@ En plus des fonctionnalités principales de Roundcube, les éléments suivants s
* Installation des plugins [contextmenu](https://plugins.roundcube.net/packages/johndoh/contextmenu)
et [automatic addressbook](https://plugins.roundcube.net/packages/sblaisot/automatic_addressbook) par default.
* Permettre d'installer [CardDAV](https://plugins.roundcube.net/packages/roundcube/carddav) (carnet d'adresses) de synchronisation à l'installation - notez que si vous avez installé Nextcloud ou Baïkal, il ajoutera automatiquement le carnet d'adresses correspondant.
* Prise en charge du chiffrement PGP avec le plugin Enigma installé par default.
**Version incluse :** 1.5.0~ynh1
**Démo :** https://demo.yunohost.org/webmail/
## Captures d'écran
![](./doc/screenshots/screenshot.png)
## Avertissements / informations importantes
## Configuration
Vous pouvez étendre (ou même remplacer) la configuration de Roundcube fournie avec ce paquet dans le fichier `conf/local.inc.php`. Ne modifiez pas le fichier `conf/config.inc.php` car les futures mises à jour le remplaceront.
#### Support multi-utilisateur
* Intégration avec les utilisateurs YunoHost et SSO - c'est-à-dire le bouton de déconnexion, reconnaissance des autres utilisateurs de l'instance YunoHost.
#### Supported architectures
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/roundcube%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/roundcube/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/roundcube%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/roundcube/)
## Limitations
* Aucune limitation connue.
## Additional information
#### Plugins
Vous pouvez également installer d'autres plugins (qui ne seront pas supprimés avec les mises à niveau). Pour cela, vous pouvez utiliser le [Plugin Repository](https://plugins.roundcube.net/) officiel.
@ -91,14 +79,13 @@ Notez que vous devez également consulter la page d'accueil du plugin pour conna
Vous pouvez également télécharger le plugin et le placer dans le répertoire `plugins /`. Dans ce cas, n'oubliez pas de changer la propriété de ce dossier en `roundcube`.
## Liens
## Documentations et ressources
* Signaler un bug : https://github.com/YunoHost-Apps/roundcube_ynh/issues
* Site de l'application : https://roundcube.net/
* Dépôt de l'application principale : https://github.com/roundcube/roundcubemail
* Site web YunoHost : https://yunohost.org/
---
* Site officiel de l'app : https://roundcube.net/
* Documentation officielle de l'admin : https://github.com/roundcube/roundcubemail/wiki
* Dépôt de code officiel de l'app : https://github.com/roundcube/roundcubemail
* Documentation YunoHost pour cette app : https://yunohost.org/app_roundcube
* Signaler un bug : https://github.com/YunoHost-Apps/roundcube_ynh/issues
## Informations pour les développeurs
@ -110,3 +97,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/roundcube_ynh/tree/te
ou
sudo yunohost app upgrade roundcube -u https://github.com/YunoHost-Apps/roundcube_ynh/tree/testing --debug
```
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps

View file

@ -4,7 +4,6 @@
path="/path"
language="en_GB"
with_carddav=1
with_enigma=1
; Checks
pkg_linter=1
setup_sub_dir=1
@ -16,7 +15,6 @@
upgrade=1 from_commit=67cb9813b18254b5f478d9a2974862d0a3af40e5
backup_restore=1
multi_instance=1
port_already_use=0
change_url=1
;;; Options
Email=

View file

@ -1,6 +1,5 @@
SOURCE_URL=https://github.com/roundcube/roundcubemail/releases/download/1.4.11/roundcubemail-1.4.11.tar.gz
SOURCE_SUM=524a6c8095508b8d911c0c5121ea6d16ca4c42894e10aaa0e29ded983687923c
SOURCE_URL=https://github.com/roundcube/roundcubemail/releases/download/1.5.0/roundcubemail-1.5.0.tar.gz
SOURCE_SUM=f204b412f930ef6af9832d9afa95640803b7b94c3028450b0f94f56cdc4bbe1d
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=

View file

@ -2,19 +2,14 @@
/*
+-----------------------------------------------------------------------+
| YunoHost configuration for the Roundcube Webmail installation. |
| Local configuration for the Roundcube Webmail installation. |
| |
| This is based on the sample configuration file which is shipped with |
| Roundcube and adapted to works with YunoHost. It comes with some |
| additionnal activated plugins for a better integration and |
| experience. |
| |
| You can override and extend this configuration in local.inc.php. |
| |
| DO NOT EDIT THIS FILE BY HAND, IT WILL BE OVERWRITTEN AT UPGRADES. |
| This is a sample configuration file only containing the minimum |
| setup required for a functional installation. Copy more options |
| from defaults.inc.php to this file to override the defaults. |
| |
| This file is part of the Roundcube Webmail client |
| Copyright (C) 2005-2013, The Roundcube Dev Team |
| Copyright (C) The Roundcube Dev Team |
| |
| Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. |
@ -29,26 +24,28 @@ $config = array();
// Database connection string (DSN) for read+write operations
// Format (compatible with PEAR MDB2): db_provider://user:password@host/database
// Currently supported db_providers: mysql, pgsql, sqlite, mssql or sqlsrv
// Currently supported db_providers: mysql, pgsql, sqlite, mssql, sqlsrv, oracle
// For examples see http://pear.php.net/manual/en/package.database.mdb2.intro-dsn.php
// NOTE: for SQLite use absolute path: 'sqlite:////full/path/to/sqlite.db?mode=0646'
$config['db_dsnw'] = 'mysql://__DBUSER__:__DBPASS__@localhost/__DBNAME__';
// NOTE: for SQLite use absolute path (Linux): 'sqlite:////full/path/to/sqlite.db?mode=0646'
// or (Windows): 'sqlite:///C:/full/path/to/sqlite.db'
$config['db_dsnw'] = 'mysql://__DB_NAME__:__DB_PWD__@localhost/__DB_NAME__';
// The mail host chosen to perform the log-in.
// The IMAP host chosen to perform the log-in.
// Leave blank to show a textbox at login, give a list of hosts
// to display a pulldown menu or set one host as string.
// To use SSL/TLS connection, enter hostname with prefix ssl:// or tls://
// Enter hostname with prefix ssl:// to use Implicit TLS, or use
// prefix tls:// to use STARTTLS.
// Supported replacement variables:
// %n - hostname ($_SERVER['SERVER_NAME'])
// %t - hostname without the first part
// %d - domain (http hostname $_SERVER['HTTP_HOST'] without the first part)
// %s - domain name after the '@' from e-mail address provided at login screen
// For example %n = mail.domain.tld, %t = domain.tld
$config['default_host'] = 'localhost';
$config['default_host'] = '%t';
// SMTP server host (for sending mails).
// To use SSL/TLS connection, enter hostname with prefix ssl:// or tls://
// If left blank, the PHP mail() function is used
// Enter hostname with prefix ssl:// to use Implicit TLS, or use
// prefix tls:// to use STARTTLS.
// Supported replacement variables:
// %h - user's IMAP hostname
// %n - hostname ($_SERVER['SERVER_NAME'])
@ -56,10 +53,11 @@ $config['default_host'] = 'localhost';
// %d - domain (http hostname $_SERVER['HTTP_HOST'] without the first part)
// %z - IMAP domain (IMAP hostname without the first part)
// For example %n = mail.domain.tld, %t = domain.tld
// To specify different SMTP servers for different IMAP hosts provide an array
// of IMAP host (no prefix or port) and SMTP server e.g. ['imap.example.com' => 'smtp.example.net']
$config['smtp_server'] = 'tls://' . $main_domain;
// SMTP port (default is 25; use 587 for STARTTLS or 465 for the
// deprecated SSL over SMTP (aka SMTPS))
// SMTP port. Use 25 for cleartext, 465 for Implicit TLS, or 587 for STARTTLS (default)
$config['smtp_port'] = 587;
// SMTP username (if required) if you use %u as the username Roundcube
@ -90,9 +88,9 @@ $config['support_url'] = 'https://forum.yunohost.org/t/roundcube-a-webmail/3965'
// Name your service. This is displayed on the login screen and in the window title
$config['product_name'] = 'YunoHost Webmail';
// this key is used to encrypt the users imap password which is stored
// in the session record (and the client cookie if remember password is enabled).
// please provide a string of exactly 24 chars.
// This key is used to encrypt the users imap password which is stored
// in the session record. For the default cipher method it must be
// exactly 24 characters long.
// YOUR KEY MUST BE DIFFERENT THAN THE SAMPLE VALUE FOR SECURITY REASONS
$config['des_key'] = '__DESKEY__';
@ -126,24 +124,24 @@ $config['ldap_public']['yunohost'] = array(
'hidden' => false,
'searchonly' => true,
'fieldmap' => array(
'name' => 'uid',
'surname' => 'sn',
'firstname' => 'givenName',
'email' => 'mail:*',
'name' => 'uid',
'surname' => 'sn',
'firstname' => 'givenName',
'email' => 'mail:*',
),
);
// List of active plugins (in plugins/ directory)
$config['plugins'] = array(
'archive',
'zipdownload',
// additionnal plugins
'http_authentication',
'managesieve',
'markasjunk',
'new_user_dialog',
'new_user_identity',
// installed plugins
'archive',
'zipdownload',
// additionnal plugins
'http_authentication',
'managesieve',
'markasjunk',
'new_user_dialog',
'new_user_identity',
'enigma',
);
// ----------------------------------
@ -191,11 +189,5 @@ $config['ldapAliasSync'] = array(
),
);
// ----------------------------------
// LOCAL CONFIGURATION
// ----------------------------------
$local_config = dirname(__FILE__) . '/local.inc.php';
if (file_exists($local_config)) {
include $local_config;
}
// skin name: folder from skins/
$config['skin'] = 'elastic';

View file

@ -14,7 +14,7 @@ $config['enigma_debug'] = false;
// REQUIRED! Keys directory for all users.
// Must be writeable by PHP process, and not in the web server document root
$config['enigma_pgp_homedir'] = '__DIR__';
$config['enigma_pgp_homedir'] = '__FINALPATH__/plugins/enigma/home';
// Location of gpg binary. By default it will be auto-detected.
// This is also a way to force gpg2 use if there are both 1.x and 2.x on the system.

10
doc/DESCRIPTION.md Normal file
View file

@ -0,0 +1,10 @@
Roundcube is a browser-based multilingual IMAP client with an application-like user interface. It provides full functionality you expect from an email client, including MIME support, address book, folder manipulation, message searching and spell checking.
## YunoHost specific features
In addition to Roundcube core features, the following are made available with this package:
* Synchronize your email aliases as identities in Roundcube
* Install the [contextmenu](https://plugins.roundcube.net/packages/johndoh/contextmenu) and [automatic addressbook](https://plugins.roundcube.net/packages/sblaisot/automatic_addressbook) plugins by default
* Allow to install the [CardDAV](https://plugins.roundcube.net/packages/roundcube/carddav) (address book) synchronization plugin at the installation - note that if you have installed Nextcloud or Baïkal, it will automatically add the corresponding and existing address book.
* Support for PGP encryption with Enigma plugin by default.

11
doc/DESCRIPTION_fr.md Normal file
View file

@ -0,0 +1,11 @@
Roundcube est un client IMAP multilingue basé sur un navigateur avec une interface utilisateur semblable à une application.
## Caractéristiques spécifiques YunoHost
En plus des fonctionnalités principales de Roundcube, les éléments suivants sont disponibles avec ce paquet :
* Synchronisez vos alias de messagerie en tant qu'identités dans Roundcube.
* Installation des plugins [contextmenu](https://plugins.roundcube.net/packages/johndoh/contextmenu)
et [automatic addressbook](https://plugins.roundcube.net/packages/sblaisot/automatic_addressbook) par default.
* Permettre d'installer [CardDAV](https://plugins.roundcube.net/packages/roundcube/carddav) (carnet d'adresses) de synchronisation à l'installation - notez que si vous avez installé Nextcloud ou Baïkal, il ajoutera automatiquement le carnet d'adresses correspondant.
* Prise en charge du chiffrement PGP avec le plugin Enigma installé par default.

44
doc/DISCLAIMER.md Normal file
View file

@ -0,0 +1,44 @@
## Configuration
You can extend - or even override - the Roundcube configuration which is coming with this package in the file `conf/local.inc.php`. Do not edit the file `conf/config.inc.php` as future upgrades will overwrite it.
#### Multi-users support
* Integrate with YunoHost users and SSO - i.e logout button, YunoHost users search
#### Plugins
You can also install other plugins - which will not be removed with upgrades. To do so, you can use the official [Plugin Repository](https://plugins.roundcube.net/).
##### From the Plugin Repository
Let's say for example that we want to install the [html5_notifier](https://plugins.roundcube.net/packages/kitist/html5_notifier) plugin.
1. Connect to your server as root using SSH:
```
$ ssh admin@1.2.3.4
$ sudo -i
```
2. Log in as the `roundcube` user - which owns the roundcube directory - and navigate in it:
```
# su -s /bin/bash - roundcube
$ cd /var/www/roundcube
```
3. Install the plugin you want using composer - note that you have to specify *kitist/html5_notifier* and not only *html5_notifier*:
```
$ COMPOSER_HOME=./.composer php composer.phar require "kitist/html5_notifier"
```
4. Enable it in the local configuration file `conf/local.inc.php` using your favorite text editor by adding:
```
<?php
$config['plugins'][] = 'html5_notifier';
```
Note that you should also check the plugin homepage for additional installation steps as needed.
##### Manual installation
You can also download the plugin and put it under the `plugins/` directory. In this case, do not forget to change ownerships of this folder to `roundcube`.

44
doc/DISCLAIMER_fr.md Normal file
View file

@ -0,0 +1,44 @@
## Configuration
Vous pouvez étendre (ou même remplacer) la configuration de Roundcube fournie avec ce paquet dans le fichier `conf/local.inc.php`. Ne modifiez pas le fichier `conf/config.inc.php` car les futures mises à jour le remplaceront.
#### Support multi-utilisateur
* Intégration avec les utilisateurs YunoHost et SSO - c'est-à-dire le bouton de déconnexion, reconnaissance des autres utilisateurs de l'instance YunoHost.
#### Plugins
Vous pouvez également installer d'autres plugins (qui ne seront pas supprimés avec les mises à niveau). Pour cela, vous pouvez utiliser le [Plugin Repository](https://plugins.roundcube.net/) officiel.
##### Depuis le dépôt de plugins
Si, par exemple, vous voulez installer le plugin [html5_notifier](https://plugins.roundcube.net/packages/kitist/html5_notifier).
1. Connectez-vous en SSH à votre serveur en tant que root :
```
$ ssh admin@1.2.3.4
$ sudo -i
```
2. Connectez-vous en tant qu'utilisateur `roundcube` (qui possède le répertoire roundcube) et naviguez dedans :
```
# su -s /bin/bash - roundcube
$ cd /var/www/roundcube
```
3. Installez le plugin que vous voulez en utilisant Composer - notez que vous devez spécifier *kitist/html5_notifier* et pas seulement *html5_notifier* :
```
$ COMPOSER_HOME=./.composer php composer.phar require "kitist/html5_notifier"
```
4. Activez-le dans le fichier de configuration local `conf/local.inc.php` en ajoutant :
```
<?php
$config['plugins'][] = 'html5_notifier';
```
Notez que vous devez également consulter la page d'accueil du plugin pour connaître les étapes d'installation supplémentaires si nécessaire.
##### Installation manual
Vous pouvez également télécharger le plugin et le placer dans le répertoire `plugins /`. Dans ce cas, n'oubliez pas de changer la propriété de ce dossier en `roundcube`.

Binary file not shown.

After

Width:  |  Height:  |  Size: 269 KiB

View file

@ -6,40 +6,38 @@
"en": "Open Source Webmail software",
"fr": "Webmail Open Source"
},
"version": "1.4.11~ynh2",
"version": "1.5.0~ynh1",
"url": "https://roundcube.net/",
"upstream": {
"license": "GPL-3.0-only",
"website": "https://roundcube.net/",
"demo": "https://demo.yunohost.org/webmail/",
"admindoc": "https://github.com/roundcube/roundcubemail/wiki",
"code": "https://github.com/roundcube/roundcubemail"
},
"license": "GPL-3.0-only",
"maintainer": {
"name": "",
"email": ""
},
"requirements": {
"yunohost": ">= 4.0.7"
"yunohost": ">= 4.3.2"
},
"multi_instance": true,
"services": [
"nginx",
"php7.0-fpm",
"php7.3-fpm",
"mysql"
],
"arguments": {
"install" : [
{
"name": "domain",
"type": "domain",
"ask": {
"en": "Choose a domain for Roundcube",
"fr": "Choisissez un domaine pour Roundcube"
},
"example": "domain.org"
"type": "domain"
},
{
"name": "path",
"type": "path",
"ask": {
"en": "Choose a path for Roundcube",
"fr": "Choisissez un chemin pour Roundcube"
},
"example": "/webmail",
"default": "/webmail"
},
@ -50,7 +48,7 @@
"en": "Choose the application language",
"fr": "Choisissez la langue de l'application"
},
"choices": ["fr_FR", "en_GB", "de_DE"],
"choices": ["de_DE", "en_GB", "fr_FR", "it_IT"],
"default": "en_GB"
},
{
@ -61,15 +59,6 @@
"fr": "Installer le plugin de synchronisation CardDAV ?"
},
"default": false
},
{
"name": "with_enigma",
"type": "boolean",
"ask": {
"en": "Install Enigma messages encryption plugin?",
"fr": "Installer le plugin de chiffrement des messages Enigma ?"
},
"default": false
}
]
}

View file

@ -7,77 +7,16 @@
YNH_PHP_VERSION="7.3"
# Package dependencies
extra_php_dependencies="php-pear php${YNH_PHP_VERSION}-ldap php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-dom php${YNH_PHP_VERSION}-curl"
pkg_dependencies="php-pear php${YNH_PHP_VERSION}-ldap php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-dom php${YNH_PHP_VERSION}-curl"
# Composer version
composer_version=1.10.17
YNH_COMPOSER_VERSION=2.1.1
# Plugins version
contextmenu_version=2.3
contextmenu_version=3.2.1
automatic_addressbook_version=v0.4.3
carddav_version=3.0.3
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
readonly YNH_DEFAULT_COMPOSER_VERSION=1.10.17
# Declare the actual composer version to use.
# A packager willing to use another version of composer can override the variable into its _common.sh.
YNH_COMPOSER_VERSION=${YNH_COMPOSER_VERSION:-$YNH_DEFAULT_COMPOSER_VERSION}
# Execute a command with Composer
#
# usage: ynh_composer_exec [--phpversion=phpversion] [--workdir=$final_path] --commands="commands"
# | arg: -v, --phpversion - PHP version to use with composer
# | arg: -w, --workdir - The directory from where the command will be executed. Default $final_path.
# | arg: -c, --commands - Commands to execute.
ynh_composer_exec () {
# Declare an array to define the options of this helper.
local legacy_args=vwc
declare -Ar args_array=( [v]=phpversion= [w]=workdir= [c]=commands= )
local phpversion
local workdir
local commands
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
workdir="${workdir:-$final_path}"
phpversion="${phpversion:-$YNH_PHP_VERSION}"
COMPOSER_HOME="$workdir/.composer" \
php${phpversion} "$workdir/composer.phar" $commands \
-d "$workdir" --quiet --no-interaction
}
# Install and initialize Composer in the given directory
#
# usage: ynh_install_composer [--phpversion=phpversion] [--workdir=$final_path] [--install_args="--optimize-autoloader"] [--composerversion=composerversion]
# | arg: -v, --phpversion - PHP version to use with composer
# | arg: -w, --workdir - The directory from where the command will be executed. Default $final_path.
# | arg: -a, --install_args - Additional arguments provided to the composer install. Argument --no-dev already include
# | arg: -c, --composerversion - Composer version to install
ynh_install_composer () {
# Declare an array to define the options of this helper.
local legacy_args=vwa
declare -Ar args_array=( [v]=phpversion= [w]=workdir= [a]=install_args= [c]=composerversion=)
local phpversion
local workdir
local install_args
local composerversion
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
workdir="${workdir:-$final_path}"
phpversion="${phpversion:-$YNH_PHP_VERSION}"
install_args="${install_args:-}"
composerversion="${composerversion:-$YNH_COMPOSER_VERSION}"
curl -sS https://getcomposer.org/installer \
| COMPOSER_HOME="$workdir/.composer" \
php${phpversion} -- --quiet --install-dir="$workdir" --version=$composerversion \
|| ynh_die "Unable to install Composer."
# update dependencies to create composer.lock
ynh_composer_exec --phpversion="${phpversion}" --workdir="$workdir" --commands="install --no-dev $install_args" \
|| ynh_die "Unable to update core dependencies with Composer."
}

View file

@ -26,7 +26,7 @@ app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
phpversion=$YNH_PHP_VERSION
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP

View file

@ -30,6 +30,23 @@ ynh_script_progression --message="Loading installation settings..." --weight=2
# Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED
#=================================================

View file

@ -23,7 +23,6 @@ ynh_abort_if_errors
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
with_carddav=$YNH_APP_ARG_WITH_CARDDAV
with_enigma=$YNH_APP_ARG_WITH_ENIGMA
language=$YNH_APP_ARG_LANGUAGE
app=$YNH_APP_INSTANCE_NAME
@ -47,7 +46,6 @@ ynh_script_progression --message="Storing installation settings..." --weight=2
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=with_carddav --value=$with_carddav
ynh_app_setting_set --app=$app --key=with_enigma --value=$with_enigma
ynh_app_setting_set --app=$app --key=language --value=$language
#=================================================
@ -55,12 +53,28 @@ ynh_app_setting_set --app=$app --key=language --value=$language
#=================================================
# CREATE A MYSQL DATABASE
#=================================================
ynh_script_progression --message="Creating a MySQL database..."
ynh_script_progression --message="Creating a MySQL database..." --weight=2
db_name=$(ynh_sanitize_dbid --db_name=$app)
db_user=$db_name
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
ynh_mysql_setup_db --db_user=$db_name --db_name=$db_name
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=1
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..." --weight=3
# Create a system user
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
@ -70,6 +84,10 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
@ -78,21 +96,13 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=2
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..." --weight=3
# Create a system user
ynh_system_user_create --username=$app
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring PHP-FPM..." --weight=2
# Create a dedicated PHP-FPM config
ynh_add_fpm_config --package="$extra_php_dependencies"
ynh_add_fpm_config
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
@ -119,17 +129,10 @@ ynh_mysql_connect_as --user="$db_name" --password="$db_pwd" --database="$db_name
#=================================================
# CONFIGURE ROUNDCUBE
#=================================================
ynh_script_progression --message="Configuring Roundcube..."
ynh_script_progression --message="Configuring Roundcube..." --weight=2
rc_conf="$final_path/config/config.inc.php"
cp ../conf/config.inc.php "$rc_conf"
ynh_replace_string --match_string="__DESKEY__" --replace_string="$(ynh_string_random --length=24)" --target_file="$rc_conf"
ynh_replace_string --match_string="__DBUSER__" --replace_string="$db_name" --target_file="$rc_conf"
ynh_replace_string --match_string="__DBPASS__" --replace_string="$db_pwd" --target_file="$rc_conf"
ynh_replace_string --match_string="__DBNAME__" --replace_string="$db_name" --target_file="$rc_conf"
ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" --target_file="$rc_conf"
deskey=$(ynh_string_random --length=24)
ynh_add_config --template="../conf/config.inc.php" --destination="$final_path/config/config.inc.php"
#=================================================
# INSTALL ADDITIONAL PLUGINS
@ -151,6 +154,10 @@ ynh_composer_exec --commands="require \
installed_plugins+=" 'contextmenu', 'automatic_addressbook',"
ynh_add_config --template="../conf/enigma.config.inc.php" --destination="$final_path/plugins/enigma/config.inc.php"
mkdir -p "$final_path/plugins/enigma/home"
chown -R $app:www-data "$final_path/plugins/enigma/home"
# Install CardDAV plugin
if [ $with_carddav -eq 1 ]
then
@ -180,50 +187,32 @@ then
done
done
# Do not actualy add the carddav plugin if there's no carddav server available...
# Do not actualy add the cardDAV plugin if there's no cardDAV server available...
if [ $carddav_server -eq 1 ]
then
installed_plugins+=" 'carddav',"
fi
fi
# Install Enigma plugin
if [ $with_enigma -eq 1 ]
then
enigma_tmp_config="../conf/enigma.config.inc.php"
ynh_replace_string --match_string="__DIR__" --replace_string="$final_path/plugins/enigma/home" --target_file="$enigma_tmp_config"
cp "$enigma_tmp_config" "$final_path/plugins/enigma/config.inc.php" \
&& installed_plugins+=" 'enigma'," \
|| ynh_print_warn --message="Unable to install Enigma plugin"
fi
#=================================================
# UPDATE ROUNDCUBE CONFIGURATION
#=================================================
ynh_script_progression --message="Updating Roundcube configuration..." --weight=3
ynh_replace_string --match_string="^\s*// installed plugins" --replace_string="&\n $installed_plugins" --target_file="$rc_conf"
ynh_replace_string --match_string="^\s*// installed plugins" --replace_string="&\n $installed_plugins" --target_file="$final_path/config/config.inc.php"
# Update javascript dependencies
(cd "$final_path"
/usr/bin/php -q ./bin/install-jsdeps.sh)
/usr/bin/php$phpversion -q ./bin/install-jsdeps.sh)
# Store the config file checksum into the app settings
ynh_store_file_checksum --file="$rc_conf"
ynh_store_file_checksum --file="$final_path/config/config.inc.php"
chmod 400 "$final_path/config/config.inc.php"
chown $app:$app "$final_path/config/config.inc.php"
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
# Set permissions to app files
chown -R root: "$final_path"
mkdir -p "$final_path/plugins/enigma/home"
chown -R $app: "$final_path/"{temp,logs,plugins/enigma/home}
#=================================================
# RELOAD NGINX
#=================================================

View file

@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..."
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
@ -38,6 +38,14 @@ ynh_script_progression --message="Removing the MySQL database..." --weight=2
# Remove a database if it exists, along with the associated user
ynh_mysql_remove_db --db_user=$db_name --db_name=$db_name
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=1
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#=================================================
# REMOVE APP MAIN DIR
#=================================================

View file

@ -19,7 +19,7 @@ ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading settings..."
ynh_script_progression --message="Loading settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
@ -27,6 +27,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
@ -34,8 +35,6 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=3
ynh_webpath_available --domain=$domain --path_url=$path_url \
|| ynh_die --message="Path not available: ${domain}${path_url}"
test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path "
@ -47,37 +46,40 @@ test ! -d $final_path \
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring $app main directory..."
ynh_restore_file --origin_path="$final_path"
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_script_progression --message="Recreating the dedicated system user..." --weight=4
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# RESTORE USER RIGHTS
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring $app main directory..." --weight=4
# Restore permissions on app files
chown -R root: "$final_path"
mkdir -p "$final_path/plugins/enigma/home"
chown -R $app: "$final_path/"{temp,logs,plugins/enigma/home}
ynh_restore_file --origin_path="$final_path"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=1
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
ynh_add_fpm_config
ynh_add_fpm_config --package="$extra_php_dependencies"
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=1
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# SPECIFIC RESTORATION
@ -95,7 +97,7 @@ ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ./
#=================================================
# RELOAD NGINX AND PHP-FPM
#=================================================
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..."
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1
ynh_systemd_action --service_name=php${phpversion}-fpm --action=reload
ynh_systemd_action --service_name=nginx --action=reload

View file

@ -20,10 +20,11 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
with_carddav=$(ynh_app_setting_get --app=$app --key=with_carddav)
with_enigma=$(ynh_app_setting_get --app=$app --key=with_enigma)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
language=$(ynh_app_setting_get --app=$app --key=language)
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
#=================================================
# CHECK VERSION
@ -31,10 +32,24 @@ language=$(ynh_app_setting_get --app=$app --key=language)
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up $app before upgrading (may take a while)..." --weight=5
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..."
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# If db_name doesn't exist, create it
if [ -z "$db_name" ]; then
@ -59,36 +74,26 @@ if [ -z "$with_carddav" ]; then
ynh_app_setting_set --app=$app --key=with_carddav --value=$with_carddav
fi
# If with_enigma doesn't exist, create it
if [ -z "$with_enigma" ]; then
if [ -f "${final_path}/plugins/enigma/config.inc.php" ]
then
with_enigma=1
else
with_enigma=0
fi
ynh_app_setting_set --app=$app --key=with_enigma --value=$with_enigma
fi
# If language doesn't exist, create it
if [ -z "$language" ]; then
language="en_GB"
ynh_app_setting_set --app=$app --key=language --value=$language
fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up $app before upgrading (may take a while)..." --weight=30
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
ynh_app_setting_delete --app=$app --key=is_public
fi
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# STANDARD UPGRADE STEPS
@ -107,21 +112,24 @@ then
ynh_setup_source --dest_dir="$final_path"
fi
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..."
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# CREATE DEDICATED USER
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..."
ynh_script_progression --message="Upgrading dependencies..." --weight=1
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# PHP-FPM CONFIGURATION
@ -129,7 +137,7 @@ ynh_system_user_create --username=$app
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=5
# Create a dedicated PHP-FPM config
ynh_add_fpm_config --package="$extra_php_dependencies"
ynh_add_fpm_config
#=================================================
# SPECIFIC UPGRADE
@ -139,21 +147,10 @@ ynh_add_fpm_config --package="$extra_php_dependencies"
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Reconfiguring Roundcube..."
ynh_script_progression --message="Reconfiguring Roundcube..." --weight=1
rc_conf="$final_path/config/config.inc.php"
# Verify the checksum and backup the file if it's different
ynh_backup_if_checksum_is_different "$rc_conf"
cp ../conf/config.inc.php "$rc_conf"
ynh_replace_string --match_string="__DESKEY__" --replace_string="$(ynh_string_random --length=24)" --target_file="$rc_conf"
ynh_replace_string --match_string="__DBUSER__" --replace_string=$db_name --target_file="$rc_conf"
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
ynh_replace_string --match_string="__DBPASS__" --replace_string="$db_pwd" --target_file="$rc_conf"
ynh_replace_string --match_string="__DBNAME__" --replace_string="$db_name" --target_file="$rc_conf"
ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" --target_file="$rc_conf"
deskey=$(ynh_string_random --length=24)
ynh_add_config --template="../conf/config.inc.php" --destination="$final_path/config/config.inc.php"
#=================================================
# UPDATE DEPENDENCIES WITH COMPOSER
@ -166,11 +163,12 @@ then
# Check if dependencies need to be updated with Composer
if [ -f "$final_path/composer.json" ]
then
ynh_exec_warn_less ynh_composer_exec --commands=\"update --no-dev --prefer-dist\"
ynh_exec_warn_less ynh_composer_exec --commands="update"
else
# Install composer.json
cp "$final_path/composer.json-dist" "$final_path/composer.json"
fi
#=================================================
# UPGRADE ADDITIONAL PLUGINS
#=================================================
@ -191,6 +189,10 @@ then
installed_plugins+=" 'contextmenu', 'automatic_addressbook',"
ynh_add_config --template="../conf/enigma.config.inc.php" --destination="$final_path/plugins/enigma/config.inc.php"
mkdir -p "$final_path/plugins/enigma/home"
chown -R $app:$app "$final_path/plugins/enigma/home"
# Update or install CardDAV plugin
if [ $with_carddav -eq 1 ]
then
@ -227,31 +229,22 @@ then
fi
fi
# Install Enigma plugin
if [ $with_enigma -eq 1 ]
then
enigma_tmp_config="../conf/enigma.config.inc.php"
ynh_replace_string --match_string="__DIR__" --replace_string="$final_path/plugins/enigma/home" --target_file="$enigma_tmp_config"
cp "$enigma_tmp_config" "$final_path/plugins/enigma/config.inc.php" \
&& installed_plugins+=" 'enigma'," \
|| ynh_print_warn --message="Unable to install Enigma plugin"
fi
#=================================================
# UPDATE ROUNDCUBE CONFIGURATION
#=================================================
ynh_script_progression --message="Updating $app configuration..." --weight=4
ynh_replace_string --match_string="^\s*// installed plugins" --replace_string="&\n $installed_plugins" --target_file="$rc_conf"
ynh_replace_string --match_string="^\s*// installed plugins" --replace_string="&\n $installed_plugins" --target_file="$final_path/config/config.inc.php"
# Update JavaScript dependencies
(cd "$final_path"
/usr/bin/php -q ./bin/install-jsdeps.sh)
/usr/bin/php$phpversion -q ./bin/install-jsdeps.sh)
# Store the config file checksum into the app settings
ynh_store_file_checksum --file="$rc_conf"
ynh_store_file_checksum --file="$final_path/config/config.inc.php"
chmod 400 "$final_path/config/config.inc.php"
chown $app:$app "$final_path/config/config.inc.php"
#=================================================
# UPDATE ROUNDCUBE CORE
@ -262,21 +255,10 @@ then
ynh_exec_warn ./bin/update.sh --version=$oldversion -y)
fi
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
# Set permissions to app files
chown -R root: "$final_path"
mkdir -p "$final_path/plugins/enigma/home"
chown -R $app: "$final_path/"{temp,logs,plugins/enigma/home}
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..."
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload