1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/roundcube_ynh.git synced 2024-09-03 20:16:28 +02:00
* Add suport for PHP7.3
* Force to use composer version 1.10.17
* Set Elastic as default
* Add language setting
* Disable GoogleSpell as default
* Fix carddav plugin setup

Co-authored-by: Sebastien Mennetrier <sebmennetrier@gmail.com>
Co-authored-by: tituspijean <tituspijean@outlook.com>
Co-authored-by: Kayou <pierre@kayou.io>
This commit is contained in:
Éric Gaspar 2020-11-27 22:20:55 +01:00 committed by GitHub
parent 337b120eb3
commit a0a60418c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 192 additions and 183 deletions

View file

@ -39,6 +39,7 @@ In addition to Roundcube core features, the following are made available with th
* 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. * 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.
#### Multi-users support #### Multi-users support
* Integrate with YunoHost users and SSO - i.e logout button, YunoHost users search * Integrate with YunoHost users and SSO - i.e logout button, YunoHost users search
#### Supported architectures #### Supported architectures

View file

@ -67,30 +67,29 @@ Si, par exemple, vous voulez installer le plugin [html5_notifier](https://plugin
$ ssh admin@1.2.3.4 $ ssh admin@1.2.3.4
$ sudo -i $ sudo -i
``` ```
2. Connectez-vous en tant qu'utilisateur `roundcube` (qui possède le répertoire roundcube) et naviguez dedans : 2. Connectez-vous en tant qu'utilisateur `roundcube` (qui possède le répertoire roundcube) et naviguez dedans :
``` ```
# su -s /bin/bash - roundcube # su -s /bin/bash - roundcube
$ cd /var/www/roundcube $ cd /var/www/roundcube
``` ```
3. Installez le plugin que vous voulez en utilisant Composer - notez que vous devez spécifier 3. Installez le plugin que vous voulez en utilisant Composer - notez que vous devez spécifier *kitist/html5_notifier* et pas seulement *html5_notifier* :
*kitist/html5_notifier* et pas seulement *html5_notifier* :
``` ```
$ COMPOSER_HOME=./.composer php composer.phar require "kitist/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 utilisant un éditeur de texte en ajoutant : 4. Activez-le dans le fichier de configuration local `conf/local.inc.php` en ajoutant :
``` ```
<?php <?php
$config['plugins'][] = 'html5_notifier'; $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.
Notez que vous devriez également vérifier la page d'accueil du plugin pour une installation supplémentaire si besoin. ##### Installation manual
##### Installation manuelle 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`.
Vous pouvez également télécharger le plugin et le placer dans le répertoire `plugins/`. Dans ce cas, n'oubliez pas de changer l'*ownerships* de ce dossier à `roundcube`.
## Liens ## Liens
@ -108,6 +107,7 @@ Merci de faire vos pull request sur la [branche testing](https://github.com/Yuno
Pour essayer la branche testing, procédez comme suit. Pour essayer la branche testing, procédez comme suit.
``` ```
sudo yunohost app install https://github.com/YunoHost-Apps/roundcube_ynh/tree/testing --debug sudo yunohost app install https://github.com/YunoHost-Apps/roundcube_ynh/tree/testing --debug
or
ou ou
sudo yunohost app upgrade roundcube -u https://github.com/YunoHost-Apps/roundcube_ynh/tree/testing --debug sudo yunohost app upgrade roundcube -u https://github.com/YunoHost-Apps/roundcube_ynh/tree/testing --debug
``` ```

View file

@ -12,7 +12,6 @@
setup_private=0 setup_private=0
setup_public=0 setup_public=0
upgrade=1 upgrade=1
upgrade=1 from_commit=8d0acb6953a4c4c2206985c7d9881c5b7b637ebd
backup_restore=1 backup_restore=1
multi_instance=1 multi_instance=1
incorrect_path=1 incorrect_path=1
@ -23,7 +22,3 @@
;;; Options ;;; Options
Email= Email=
Notification=none Notification=none
;;; Upgrade options
; commit=269500433bdbce3b477fa84d0af0db3ac466244d
name=Fix install+upgrade and refactoring
manifest_arg=domain=DOMAIN&path=PATH&with_carddav=1&with_enigma=1&

16
conf/baikal.inc.php Normal file
View file

@ -0,0 +1,16 @@
$prefs['{baikal_id}'] = array(
// required attributes
'name' => '{baikal_id}',
'username' => '%u',
'password' => '%p',
'url' => '{baikal_url}/card.php/addressbooks/%u/',
// optional attributes
'active' => true,
'readonly' => false,
'refresh_time' => '00:05:00',
'fixed' => array('username', 'password'),
'hide' => false,
);

View file

@ -1,59 +0,0 @@
<?php
// RCMCardDAV Plugin Admin Settings
// ** ADDRESSBOOK PRESETS
/* PRESET FOR: baikal
$prefs['Baïkal'] = array(
// required attributes
'name' => 'Baïkal',
'username' => '%u',
'password' => '%p',
'url' => '{baikal_url}/card.php/addressbooks/%u/',
// optional attributes
'active' => true,
'readonly' => false,
'refresh_time' => '00:05:00',
'fixed' => array('username', 'password'),
'hide' => false,
);
END: baikal */
/* PRESET FOR: owncloud
$prefs['ownCloud'] = array(
// required attributes
'name' => 'ownCloud',
'username' => '%u',
'password' => '%p',
'url' => '{owncloud_url}/remote.php/dav/addressbooks/users/%u/default/',
// optional attributes
'active' => true,
'readonly' => false,
'refresh_time' => '00:05:00',
'fixed' => array('username', 'password'),
'hide' => false,
);
END: owncloud */
/* PRESET FOR: nextcloud
$prefs['NextCloud'] = array(
// required attributes
'name' => 'nextCloud',
'username' => '%u',
'password' => '%p',
'url' => '{nextcloud_url}/remote.php/dav/addressbooks/users/%u/contacts/',
// optional attributes
'active' => true,
'readonly' => false,
'refresh_time' => '00:05:00',
'fixed' => array('username', 'password'),
'hide' => false,
);
END: nextcloud */

View file

@ -97,7 +97,22 @@ $config['product_name'] = 'YunoHost Webmail';
$config['des_key'] = '__DESKEY__'; $config['des_key'] = '__DESKEY__';
// skin name: folder from skins/ // skin name: folder from skins/
$config['skin'] = 'larry'; $config['skin'] = 'elastic';
// ----------------------------------
// USER INTERFACE
// ----------------------------------
// the default locale setting (leave empty for auto-detection)
// RFC1766 formatted language name like en_US, de_DE, de_CH, fr_FR, pt_BR
$config['language'] = '__LANGUAGE__';
// use this format for date display (date or strftime format)
$config['date_format'] = 'd-m-Y';
// Make use of the built-in spell checker. It is based on GoogieSpell.
$config['enable_spellcheck'] = false;
// Enable YunoHost users search in the address book. // Enable YunoHost users search in the address book.
$config['ldap_public']['yunohost'] = array( $config['ldap_public']['yunohost'] = array(

16
conf/nextcloud.inc.php Normal file
View file

@ -0,0 +1,16 @@
$prefs['{nextcloud_id}'] = array(
// required attributes
'name' => '{nextcloud_id}',
'username' => '%u',
'password' => '%p',
'url' => '{nextcloud_url}/remote.php/dav/addressbooks/users/%u/contacts/',
// optional attributes
'active' => true,
'readonly' => false,
'refresh_time' => '00:05:00',
'fixed' => array('username', 'password'),
'hide' => false,
);

View file

@ -17,7 +17,7 @@ location __PATH__/ {
location ~ [^/]\.php(/|$) { location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$; fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock; fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
fastcgi_index index.php; fastcgi_index index.php;
fastcgi_param REMOTE_USER $remote_user; fastcgi_param REMOTE_USER $remote_user;
fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_INFO $fastcgi_path_info;
@ -39,6 +39,7 @@ location __PATH__/favicon.ico {
location ~ ^__PATH__/(config|temp|logs)/ { location ~ ^__PATH__/(config|temp|logs)/ {
deny all; deny all;
} }
location ~ ^__PATH__/(.+/|)\. { location ~ ^__PATH__/(.+/|)\. {
deny all; deny all;
} }

View file

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

View file

@ -6,7 +6,7 @@
"en": "Open Source Webmail software", "en": "Open Source Webmail software",
"fr": "Webmail Open Source" "fr": "Webmail Open Source"
}, },
"version": "1.4.9~ynh1", "version": "1.4.9~ynh2",
"url": "https://roundcube.net/", "url": "https://roundcube.net/",
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"maintainer": { "maintainer": {
@ -14,7 +14,7 @@
"email": "apps@yunohost.org" "email": "apps@yunohost.org"
}, },
"requirements": { "requirements": {
"yunohost": ">= 3.5.0" "yunohost": ">= 4.0.7"
}, },
"multi_instance": true, "multi_instance": true,
"services": [ "services": [
@ -43,6 +43,16 @@
"example": "/webmail", "example": "/webmail",
"default": "/webmail" "default": "/webmail"
}, },
{
"name": "language",
"type": "string",
"ask": {
"en": "Choose the application language",
"fr": "Choisissez la langue de l'application"
},
"choices": ["fr_FR", "en_GB", "de_DE"],
"default": "en_GB"
},
{ {
"name": "with_carddav", "name": "with_carddav",
"type": "boolean", "type": "boolean",

View file

@ -4,8 +4,13 @@
# COMMON VARIABLES # COMMON VARIABLES
#================================================= #=================================================
YNH_PHP_VERSION="7.3"
# Package dependencies # Package dependencies
pkg_dependencies="php-cli php-common php-intl php-json php-pear php-auth-sasl php-mail-mime php-patchwork-utf8 php-net-smtp php-net-socket php-zip php-gd php-mbstring php-curl" 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
# Plugins version # Plugins version
contextmenu_version=2.3 contextmenu_version=2.3
@ -16,9 +21,15 @@ carddav_version=3.0.3
# EXPERIMENTAL HELPERS # 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 # Execute a command with Composer
# #
# usage: ynh_composer_exec --phpversion=phpversion [--workdir=$final_path] --commands="commands" # 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: -w, --workdir - The directory from where the command will be executed. Default $final_path.
# | arg: -c, --commands - Commands to execute. # | arg: -c, --commands - Commands to execute.
ynh_composer_exec () { ynh_composer_exec () {
@ -31,7 +42,7 @@ ynh_composer_exec () {
# Manage arguments with getopts # Manage arguments with getopts
ynh_handle_getopts_args "$@" ynh_handle_getopts_args "$@"
workdir="${workdir:-$final_path}" workdir="${workdir:-$final_path}"
phpversion="${phpversion:-7.0}" phpversion="${phpversion:-$YNH_PHP_VERSION}"
COMPOSER_HOME="$workdir/.composer" \ COMPOSER_HOME="$workdir/.composer" \
php${phpversion} "$workdir/composer.phar" $commands \ php${phpversion} "$workdir/composer.phar" $commands \
@ -40,25 +51,33 @@ ynh_composer_exec () {
# Install and initialize Composer in the given directory # Install and initialize Composer in the given directory
# #
# usage: ynh_install_composer --phpversion=phpversion [--workdir=$final_path] # 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: -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 () { ynh_install_composer () {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=vw local legacy_args=vwa
declare -Ar args_array=( [v]=phpversion= [w]=workdir= ) declare -Ar args_array=( [v]=phpversion= [w]=workdir= [a]=install_args= [c]=composerversion=)
local phpversion local phpversion
local workdir local workdir
local install_args
local composerversion
# Manage arguments with getopts # Manage arguments with getopts
ynh_handle_getopts_args "$@" ynh_handle_getopts_args "$@"
workdir="${workdir:-$final_path}" workdir="${workdir:-$final_path}"
phpversion="${phpversion:-7.0}" phpversion="${phpversion:-$YNH_PHP_VERSION}"
install_args="${install_args:-}"
composerversion="${composerversion:-$YNH_COMPOSER_VERSION}"
curl -sS https://getcomposer.org/installer \ curl -sS https://getcomposer.org/installer \
| COMPOSER_HOME="$workdir/.composer" \ | COMPOSER_HOME="$workdir/.composer" \
php${phpversion} -- --quiet --install-dir="$workdir" \ php${phpversion} -- --quiet --install-dir="$workdir" --version=$composerversion \
|| ynh_die "Unable to install Composer." || ynh_die "Unable to install Composer."
# update dependencies to create composer.lock # update dependencies to create composer.lock
ynh_composer_exec --phpversion="${phpversion}" --workdir="$workdir" --commands="install --no-dev" \ ynh_composer_exec --phpversion="${phpversion}" --workdir="$workdir" --commands="install --no-dev $install_args" \
|| ynh_die "Unable to update core dependencies with Composer." || ynh_die "Unable to update core dependencies with Composer."
} }

View file

@ -19,41 +19,42 @@ ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#================================================= #=================================================
# STANDARD BACKUP STEPS # DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
#================================================= #=================================================
# BACKUP THE APP MAIN DIR # BACKUP THE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Backing up the main app directory..."
ynh_backup --src_path="$final_path" ynh_backup --src_path="$final_path"
#================================================= #=================================================
# BACKUP THE NGINX CONFIGURATION # BACKUP THE NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Backing up nginx web server configuration..."
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# BACKUP THE PHP-FPM CONFIGURATION # BACKUP THE PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Backing up php-fpm configuration..."
ynh_backup --src_path="/etc/php/7.0/fpm/pool.d/$app.conf" ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#================================================= #=================================================
# BACKUP THE MYSQL DATABASE # BACKUP THE MYSQL DATABASE
#================================================= #=================================================
ynh_script_progression --message="Backing up the MySQL database..." ynh_print_info --message="Backing up the MySQL database..."
ynh_mysql_dump_db --database="$db_name" > db.sql ynh_mysql_dump_db --database="$db_name" > db.sql
@ -61,4 +62,4 @@ ynh_mysql_dump_db --database="$db_name" > db.sql
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

View file

@ -24,7 +24,7 @@ app=$YNH_APP_INSTANCE_NAME
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." ynh_script_progression --message="Loading installation settings..." --weight=2
# Needed for helper "ynh_add_nginx_config" # Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
@ -50,23 +50,23 @@ fi
#================================================= #=================================================
# MODIFY URL IN NGINX CONF # MODIFY URL IN NGINX CONF
#================================================= #=================================================
ynh_script_progression --message="Updating nginx web server configuration..." --weight=2 ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
# Change the path in the nginx config file # Change the path in the NGINX config file
if [ $change_path -eq 1 ] if [ $change_path -eq 1 ]
then then
# Make a backup of the original nginx config file if modified # Make a backup of the original NGINX config file if modified
ynh_backup_if_checksum_is_different --file="$nginx_conf_path" ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
# Set global variables for nginx helper # Set global variables for NGINX helper
domain="$old_domain" domain="$old_domain"
path_url="$new_path" path_url="$new_path"
# Create a dedicated nginx config # Create a dedicated NGINX config
ynh_add_nginx_config ynh_add_nginx_config
fi fi
# Change the domain for nginx # Change the domain for NGINX
if [ $change_domain -eq 1 ] if [ $change_domain -eq 1 ]
then then
# Delete file checksum for the old conf file location # Delete file checksum for the old conf file location
@ -81,7 +81,7 @@ fi
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading nginx web server..." ynh_script_progression --message="Reloading NGINX web server..." --weight=2
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload

View file

@ -24,13 +24,14 @@ domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH path_url=$YNH_APP_ARG_PATH
with_carddav=$YNH_APP_ARG_WITH_CARDDAV with_carddav=$YNH_APP_ARG_WITH_CARDDAV
with_enigma=$YNH_APP_ARG_WITH_ENIGMA with_enigma=$YNH_APP_ARG_WITH_ENIGMA
language=$YNH_APP_ARG_LANGUAGE
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
#================================================= #=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#================================================= #=================================================
ynh_script_progression --message="Validating installation parameters..." ynh_script_progression --message="Validating installation parameters..." --weight=1
final_path=/var/www/$app final_path=/var/www/$app
test ! -e "$final_path" || ynh_die --message="This path already contains a folder" test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
@ -47,16 +48,10 @@ 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=path --value=$path_url
ynh_app_setting_set --app=$app --key=with_carddav --value=$with_carddav 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=with_enigma --value=$with_enigma
ynh_app_setting_set --app=$app --key=language --value=$language
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..."
ynh_install_app_dependencies "$pkg_dependencies"
#================================================= #=================================================
# CREATE A MYSQL DATABASE # CREATE A MYSQL DATABASE
#================================================= #=================================================
@ -78,9 +73,9 @@ ynh_setup_source --dest_dir="$final_path"
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Configuring nginx web server..." ynh_script_progression --message="Configuring NGINX web server..." --weight=2
# Create a dedicated nginx config # Create a dedicated NGINX config
ynh_add_nginx_config ynh_add_nginx_config
#================================================= #=================================================
@ -94,17 +89,18 @@ ynh_system_user_create --username=$app
#================================================= #=================================================
# PHP-FPM CONFIGURATION # PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Configuring php-fpm..." --weight=2 ynh_script_progression --message="Configuring PHP-FPM..." --weight=2
# Create a dedicated php-fpm config # Create a dedicated PHP-FPM config
ynh_add_fpm_config ynh_add_fpm_config --package="$extra_php_dependencies"
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#================================================= #=================================================
# SPECIFIC SETUP # SPECIFIC SETUP
#================================================= #=================================================
# INSTALL AND INITIALIZE COMPOSER # INSTALL AND INITIALIZE COMPOSER
#================================================= #=================================================
ynh_script_progression --message="Installing roundcube with composer..." --weight=30 ynh_script_progression --message="Installing Roundcube with Composer..." --weight=30
# Install composer.json # Install composer.json
cp "$final_path/composer.json-dist" "$final_path/composer.json" cp "$final_path/composer.json-dist" "$final_path/composer.json"
@ -123,16 +119,17 @@ ynh_mysql_connect_as --user="$db_name" --password="$db_pwd" --database="$db_name
#================================================= #=================================================
# CONFIGURE ROUNDCUBE # CONFIGURE ROUNDCUBE
#================================================= #=================================================
ynh_script_progression --message="Configuring roundcube..." ynh_script_progression --message="Configuring $app..."
rc_conf="$final_path/config/config.inc.php" rc_conf="$final_path/config/config.inc.php"
cp ../conf/config.inc.php "$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="__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="__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="__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="__DBNAME__" --replace_string="$db_name" --target_file="$rc_conf"
ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" --target_file="$rc_conf"
#================================================= #=================================================
# INSTALL ADDITIONAL PLUGINS # INSTALL ADDITIONAL PLUGINS
@ -162,27 +159,27 @@ then
carddav_tmp_config="../conf/carddav.config.inc.php" carddav_tmp_config="../conf/carddav.config.inc.php"
carddav_server=0 carddav_server=0
# Copy the plugin configuration file
cp $final_path/plugins/carddav/config.inc.php{.dist,}
# Look for installed and supported CardDAV servers # Look for installed and supported CardDAV servers
for carddav_app in "owncloud" "nextcloud" "baikal" for carddav_app in "nextcloud" "baikal"
do do
carddav_app_id=$(yunohost app list --installed -f $carddav_app \ carddav_app_ids=$(yunohost app list | grep "id: $carddav_app" | grep -Po 'id: \K(.*)' || echo "")
--output-as json | grep -Po '"id":[ ]?"\K.*?(?=")' | head -1) for carddav_app_id in $carddav_app_ids
if [ -n "$carddav_app_id" ] do
then
carddav_server=1 carddav_server=1
# Append preset configuration to the config file
cat "../conf/${carddav_app}.inc.php" >> $final_path/plugins/carddav/config.inc.php
# Retrieve app settings and enable relevant preset # Retrieve app settings and enable relevant preset
carddav_domain=$(ynh_app_setting_get --app=$carddav_app_id --key=domain) carddav_domain=$(ynh_app_setting_get --app=$carddav_app_id --key=domain)
carddav_path=$(ynh_app_setting_get --app=$carddav_app_id --key=path) carddav_path=$(ynh_app_setting_get --app=$carddav_app_id --key=path)
carddav_url="https://${carddav_domain}${carddav_path%/}" carddav_url="https://${carddav_domain}${carddav_path%/}"
ynh_replace_string --match_string="{${carddav_app}_url}" --replace_string="$carddav_url" --target_file="$carddav_tmp_config" ynh_replace_string --match_string="{${carddav_app}_id}" --replace_string="$carddav_app_id" --target_file="$final_path/plugins/carddav/config.inc.php"
ynh_replace_string --match_string="/* PRESET FOR: $carddav_app" --replace_string="" --target_file="$carddav_tmp_config" ynh_replace_string --match_string="{${carddav_app}_url}" --replace_string="$carddav_url" --target_file="$final_path/plugins/carddav/config.inc.php"
ynh_replace_string --match_string="END: $carddav_app */" --replace_string="" --target_file="$carddav_tmp_config" done
fi
done done
# Copy the plugin configuration file
cp "$carddav_tmp_config" ""$final_path/plugins/carddav/config.inc.php""
# 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 ] if [ $carddav_server -eq 1 ]
then then
@ -205,7 +202,7 @@ fi
#================================================= #=================================================
# UPDATE ROUNDCUBE CONFIGURATION # UPDATE ROUNDCUBE CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Updating roundcube configuration..." --weight=3 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="$rc_conf"
@ -230,7 +227,7 @@ chown -R $app: "$final_path/"{temp,logs,plugins/enigma/home}
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading nginx web server..." --weight=2 ynh_script_progression --message="Reloading NGINX web server..." --weight=2
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload

View file

@ -41,7 +41,7 @@ ynh_mysql_remove_db --db_user=$db_name --db_name=$db_name
#================================================= #=================================================
# REMOVE APP MAIN DIR # REMOVE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Removing app main directory..." --weight=3 ynh_script_progression --message="Removing $app main directory..." --weight=3
# Remove the app directory securely # Remove the app directory securely
ynh_secure_remove --file="$final_path" ynh_secure_remove --file="$final_path"
@ -49,17 +49,17 @@ ynh_secure_remove --file="$final_path"
#================================================= #=================================================
# REMOVE NGINX CONFIGURATION # REMOVE NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Removing nginx web server configuration..." --weight=2 ynh_script_progression --message="Removing NGINX web server configuration..." --weight=2
# Remove the dedicated nginx config # Remove the dedicated NGINX config
ynh_remove_nginx_config ynh_remove_nginx_config
#================================================= #=================================================
# REMOVE PHP-FPM CONFIGURATION # REMOVE PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Removing php-fpm configuration..." --weight=3 ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=3
# Remove the dedicated php-fpm config # Remove the dedicated PHP-FPM config
ynh_remove_fpm_config ynh_remove_fpm_config
#================================================= #=================================================

View file

@ -27,6 +27,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path) path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#================================================= #=================================================
# CHECK IF THE APP CAN BE RESTORED # CHECK IF THE APP CAN BE RESTORED
@ -49,7 +50,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Restoring the app main directory..." ynh_script_progression --message="Restoring $app main directory..."
ynh_restore_file --origin_path="$final_path" ynh_restore_file --origin_path="$final_path"
@ -74,18 +75,12 @@ chown -R $app: "$final_path/"{temp,logs,plugins/enigma/home}
# RESTORE THE PHP-FPM CONFIGURATION # RESTORE THE PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_restore_file --origin_path="/etc/php/7.0/fpm/pool.d/$app.conf" ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
ynh_add_fpm_config --package="$extra_php_dependencies"
#================================================= #=================================================
# SPECIFIC RESTORATION # SPECIFIC RESTORATION
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=30
# Define and install dependencies
ynh_install_app_dependencies "$pkg_dependencies"
#================================================= #=================================================
# RESTORE THE MYSQL DATABASE # RESTORE THE MYSQL DATABASE
#================================================= #=================================================
@ -100,9 +95,9 @@ ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ./
#================================================= #=================================================
# RELOAD NGINX AND PHP-FPM # 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..."
ynh_systemd_action --service_name=php7.0-fpm --action=reload ynh_systemd_action --service_name=php${phpversion}-fpm --action=reload
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================

View file

@ -22,6 +22,8 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
with_carddav=$(ynh_app_setting_get --app=$app --key=with_carddav) with_carddav=$(ynh_app_setting_get --app=$app --key=with_carddav)
with_enigma=$(ynh_app_setting_get --app=$app --key=with_enigma) 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)
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
@ -68,10 +70,16 @@ if [ -z "$with_enigma" ]; then
ynh_app_setting_set --app=$app --key=with_enigma --value=$with_enigma ynh_app_setting_set --app=$app --key=with_enigma --value=$with_enigma
fi 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 # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=30 ynh_script_progression --message="Backing up $app before upgrading (may take a while)..." --weight=30
# Backup the current version of the app # Backup the current version of the app
ynh_backup_before_upgrade ynh_backup_before_upgrade
@ -109,18 +117,11 @@ fi
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Upgrading nginx web server configuration..." ynh_script_progression --message="Upgrading NGINX web server configuration..."
# Create a dedicated nginx config # Create a dedicated NGINX config
ynh_add_nginx_config ynh_add_nginx_config
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=25
ynh_install_app_dependencies "$pkg_dependencies"
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
@ -132,10 +133,10 @@ ynh_system_user_create --username=$app
#================================================= #=================================================
# PHP-FPM CONFIGURATION # PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Upgrading php-fpm configuration..." --weight=5 ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=5
# Create a dedicated php-fpm config # Create a dedicated PHP-FPM config
ynh_add_fpm_config ynh_add_fpm_config --package="$extra_php_dependencies"
#================================================= #=================================================
# SPECIFIC UPGRADE # SPECIFIC UPGRADE
@ -145,7 +146,7 @@ ynh_add_fpm_config
if [ "$upgrade_type" == "UPGRADE_APP" ] if [ "$upgrade_type" == "UPGRADE_APP" ]
then then
ynh_script_progression --message="Reconfiguring roundcube..." ynh_script_progression --message="Reconfiguring Roundcube..."
rc_conf="$final_path/config/config.inc.php" rc_conf="$final_path/config/config.inc.php"
@ -158,17 +159,18 @@ then
ynh_replace_string --match_string="__DBUSER__" --replace_string=$db_name --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) 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="__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="__DBNAME__" --replace_string="$db_name" --target_file="$rc_conf"
ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" --target_file="$rc_conf"
#================================================= #=================================================
# UPDATE DEPENDENCIES WITH COMPOSER # UPDATE DEPENDENCIES WITH COMPOSER
#================================================= #=================================================
ynh_script_progression --message="Updating dependencies with composer..." --weight=30 ynh_script_progression --message="Updating dependencies with Composer..." --weight=30
# Upgrade composer itself # Upgrade composer itself
ynh_install_composer ynh_install_composer
# Check if dependencies need to be updated with composer # Check if dependencies need to be updated with Composer
if [ -f "$final_path/composer.json" ] if [ -f "$final_path/composer.json" ]
then then
ynh_exec_warn_less ynh_composer_exec --commands=\"update --no-dev --prefer-dist\" ynh_exec_warn_less ynh_composer_exec --commands=\"update --no-dev --prefer-dist\"
@ -204,27 +206,27 @@ then
carddav_tmp_config="../conf/carddav.config.inc.php" carddav_tmp_config="../conf/carddav.config.inc.php"
carddav_server=0 carddav_server=0
# Copy the plugin configuration file
cp $final_path/plugins/carddav/config.inc.php{.dist,}
# Look for installed and supported CardDAV servers # Look for installed and supported CardDAV servers
for carddav_app in "owncloud" "nextcloud" "baikal" for carddav_app in "nextcloud" "baikal"
do do
carddav_app_id=$(yunohost app list --installed -f $carddav_app \ carddav_app_ids=$(yunohost app list | grep "id: $carddav_app" | grep -Po 'id: \K(.*)' || echo "")
--output-as json | grep -Po '"id":[ ]?"\K.*?(?=")' | head -1) for carddav_app_id in $carddav_app_ids
if [ -n "$carddav_app_id" ] do
then
carddav_server=1 carddav_server=1
# Append preset configuration to the config file
cat "../conf/${carddav_app}.inc.php" >> $final_path/plugins/carddav/config.inc.php
# Retrieve app settings and enable relevant preset # Retrieve app settings and enable relevant preset
carddav_domain=$(ynh_app_setting_get --app=$carddav_app_id --key=domain) carddav_domain=$(ynh_app_setting_get --app=$carddav_app_id --key=domain)
carddav_path=$(ynh_app_setting_get --app=$carddav_app_id --key=path) carddav_path=$(ynh_app_setting_get --app=$carddav_app_id --key=path)
carddav_url="https://${carddav_domain}${carddav_path%/}" carddav_url="https://${carddav_domain}${carddav_path%/}"
ynh_replace_string --match_string="{${carddav_app}_url}" --replace_string="$carddav_url" --target_file="$carddav_tmp_config" ynh_replace_string --match_string="{${carddav_app}_id}" --replace_string="$carddav_app_id" --target_file="$final_path/plugins/carddav/config.inc.php"
ynh_replace_string --match_string="\/\* PRESET FOR: $carddav_app" --replace_string="" --target_file="$carddav_tmp_config" ynh_replace_string --match_string="{${carddav_app}_url}" --replace_string="$carddav_url" --target_file="$final_path/plugins/carddav/config.inc.php"
ynh_replace_string --match_string="END: $carddav_app \*\/" --replace_string="" --target_file="$carddav_tmp_config" done
fi
done done
# Copy the plugin configuration file
cp "$carddav_tmp_config" ""$final_path/plugins/carddav/config.inc.php""
# Do not actually add the carddav plugin if there's no carddav server available... # Do not actually add the carddav plugin if there's no carddav server available...
if [ $carddav_server -eq 1 ] if [ $carddav_server -eq 1 ]
then then
@ -247,11 +249,11 @@ then
#================================================= #=================================================
# UPDATE ROUNDCUBE CONFIGURATION # UPDATE ROUNDCUBE CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Updating roundcube configuration..." --weight=4 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="$rc_conf"
# Update javascript dependencies # Update JavaScript dependencies
(cd "$final_path" (cd "$final_path"
/usr/bin/php -q ./bin/install-jsdeps.sh) /usr/bin/php -q ./bin/install-jsdeps.sh)
@ -261,7 +263,7 @@ then
#================================================= #=================================================
# UPDATE ROUNDCUBE CORE # UPDATE ROUNDCUBE CORE
#================================================= #=================================================
ynh_script_progression --message="Updating roundcube core..." --weight=4 ynh_script_progression --message="Updating $app core..." --weight=4
( cd "$final_path" ( cd "$final_path"
ynh_exec_warn ./bin/update.sh --version=$oldversion -y) ynh_exec_warn ./bin/update.sh --version=$oldversion -y)
@ -281,7 +283,7 @@ chown -R $app: "$final_path/"{temp,logs,plugins/enigma/home}
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading nginx web server..." ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload