diff --git a/README.md b/README.md index b33a12b..5e1b720 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,8 @@ + + # 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,31 +10,29 @@ *[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 +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. -## Screenshots +### Features -![](https://roundcube.net/screens/skins/elastic/desktop/screens/mailbox_widescreen.png) +- CardDAV to connect with baïkal or Nextcloud +- Support for PGP encryption with Enigma plugin -## Demo -* [YunoHost demo](https://demo.yunohost.org/webmail/) +**Shipped version:** 1.5.0~ynh1 + +**Demo:** https://demo.yunohost.org/webmail/ + +## 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. -## Documentation - - * Official documentation: https://github.com/roundcube/roundcubemail/wiki - * YunoHost documentation: https://github.com/YunoHost/doc/blob/master/app_roundcube.md: - ## YunoHost specific features In addition to Roundcube core features, the following are made available with this package: @@ -37,22 +40,12 @@ 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. #### 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 +83,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 +101,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 \ No newline at end of file diff --git a/README_fr.md b/README_fr.md index adba282..3136487 100644 --- a/README_fr.md +++ b/README_fr.md @@ -1,35 +1,28 @@ # 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 +Roundcube est un client IMAP multilingue basé sur un navigateur avec une interface utilisateur semblable à une application. -## Screenshots +**Version incluse :** 1.5.0~ynh1 -![](https://roundcube.net/screens/skins/elastic/desktop/screens/mailbox_widescreen.png) +**Démo :** https://demo.yunohost.org/webmail/ -## Démo - -* [Démo YunoHost](https://demo.yunohost.org/webmail/) +## 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. -## Documentation - - * Documentation officielle : https://github.com/roundcube/roundcubemail/wiki - * Documentation YunoHost : https://github.com/YunoHost/doc/blob/master/app_roundcube.md: - ## Caractéristiques spécifiques YunoHost En plus des fonctionnalités principales de Roundcube, les éléments suivants sont disponibles avec ce paquet : @@ -38,22 +31,12 @@ 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 cryptage PGP avec le plugin Enigma installé par default. #### 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 +74,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 +92,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 \ No newline at end of file diff --git a/check_process b/check_process index e3779bf..399421a 100644 --- a/check_process +++ b/check_process @@ -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= diff --git a/conf/app.src b/conf/app.src index 546145a..5274aea 100644 --- a/conf/app.src +++ b/conf/app.src @@ -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= diff --git a/conf/config.inc.php b/conf/config.inc.php index 138a935..7ec6bc2 100644 --- a/conf/config.inc.php +++ b/conf/config.inc.php @@ -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'; diff --git a/conf/enigma.config.inc.php b/conf/enigma.config.inc.php index 4804bfb..8990189 100644 --- a/conf/enigma.config.inc.php +++ b/conf/enigma.config.inc.php @@ -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. diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md new file mode 100644 index 0000000..39dc2ad --- /dev/null +++ b/doc/DESCRIPTION.md @@ -0,0 +1,6 @@ +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. + +### Features + +- CardDAV to connect with baïkal or Nextcloud +- Support for PGP encryption with Enigma plugin diff --git a/doc/DESCRIPTION_fr.md b/doc/DESCRIPTION_fr.md new file mode 100644 index 0000000..5253eb1 --- /dev/null +++ b/doc/DESCRIPTION_fr.md @@ -0,0 +1 @@ +Roundcube est un client IMAP multilingue basé sur un navigateur avec une interface utilisateur semblable à une application. \ No newline at end of file diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md new file mode 100644 index 0000000..496009e --- /dev/null +++ b/doc/DISCLAIMER.md @@ -0,0 +1,53 @@ +## 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. + +## 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. + +#### 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: + ``` + = 4.0.7" + "yunohost": ">= 4.2.4" }, "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 } ] } diff --git a/scripts/_common.sh b/scripts/_common.sh index 45bb9ec..4d6980c 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -10,74 +10,13 @@ YNH_PHP_VERSION="7.3" 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" # 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." -} - diff --git a/scripts/backup b/scripts/backup index 6f4f9c1..3167c87 100644 --- a/scripts/backup +++ b/scripts/backup @@ -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 diff --git a/scripts/change_url b/scripts/change_url index 87ce1ab..7c6e6d2 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -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 #================================================= diff --git a/scripts/install b/scripts/install index 6cdb97b..7644b6d 100644 --- a/scripts/install +++ b/scripts/install @@ -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,21 @@ 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 +#================================================= +# 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 +77,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,14 +89,6 @@ 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 #================================================= @@ -119,17 +122,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 +147,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 +180,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 #================================================= diff --git a/scripts/remove b/scripts/remove index c409dac..031ebcc 100644 --- a/scripts/remove +++ b/scripts/remove @@ -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 diff --git a/scripts/restore b/scripts/restore index a7cd2b5..9ae8cab 100644 --- a/scripts/restore +++ b/scripts/restore @@ -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,29 +46,24 @@ 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 @@ -95,7 +89,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 diff --git a/scripts/upgrade b/scripts/upgrade index c9366fa..b912fb3 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -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,22 +112,18 @@ 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 -#================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." - -# Create a dedicated user (if not existing) -ynh_system_user_create --username=$app - #================================================= # PHP-FPM CONFIGURATION #================================================= @@ -139,21 +140,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 +156,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 +182,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 +222,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 +248,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