1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/roundcube_ynh.git synced 2024-09-03 20:16:28 +02:00
This commit is contained in:
Alexandre Aubin 2024-08-31 15:22:26 +02:00 committed by GitHub
commit 6a2d6f5fc0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 206 additions and 447 deletions

2
.gitignore vendored
View file

@ -1,2 +1,4 @@
*.swp *.swp
*~ *~
*.sw[op]
.DS_Store

View file

@ -6,4 +6,5 @@
- [Lire le README en français](README_fr.md) - [Lire le README en français](README_fr.md)
- [Le o README en galego](README_gl.md) - [Le o README en galego](README_gl.md)
- [Baca README dalam bahasa bahasa Indonesia](README_id.md) - [Baca README dalam bahasa bahasa Indonesia](README_id.md)
- [Прочитать README на русский](README_ru.md)
- [阅读中文(简体)的 README](README_zh_Hans.md) - [阅读中文(简体)的 README](README_zh_Hans.md)

57
README_ru.md Normal file
View file

@ -0,0 +1,57 @@
<!--
Важно: этот README был автоматически сгенерирован <https://github.com/YunoHost/apps/tree/master/tools/readme_generator>
Он НЕ ДОЛЖЕН редактироваться вручную.
-->
# Roundcube для YunoHost
[![Уровень интеграции](https://dash.yunohost.org/integration/roundcube.svg)](https://ci-apps.yunohost.org/ci/apps/roundcube/) ![Состояние работы](https://ci-apps.yunohost.org/ci/badges/roundcube.status.svg) ![Состояние сопровождения](https://ci-apps.yunohost.org/ci/badges/roundcube.maintain.svg)
[![Установите Roundcube с YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=roundcube)
*[Прочтите этот README на других языках.](./ALL_README.md)*
> *Этот пакет позволяет Вам установить Roundcube быстро и просто на YunoHost-сервер.*
> *Если у Вас нет YunoHost, пожалуйста, посмотрите [инструкцию](https://yunohost.org/install), чтобы узнать, как установить его.*
## Обзор
Roundcube is a web-based e-mail client. It offers all the features you'd expect from a mail client, including multilingual support, address book management, folder manipulation, message search and spell checking.
### YunoHost specific features
- Synchronize your email aliases as identities in Roundcube
- Install the [contextmenu](https://packagist.org/packages/johndoh/contextmenu) and [automatic addressbook](https://packagist.org/packages/projectmyst/automatic_addressbook) plugins by default
- Allow to install the [CardDAV](https://packagist.org/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.
**Поставляемая версия:** 1.6.8~ynh1
**Демо-версия:** <https://demo.yunohost.org/webmail/>
## Снимки экрана
![Снимок экрана Roundcube](./doc/screenshots/screenshot.png)
## Документация и ресурсы
- Официальный веб-сайт приложения: <https://roundcube.net/>
- Официальная документация администратора: <https://github.com/roundcube/roundcubemail/wiki>
- Репозиторий кода главной ветки приложения: <https://github.com/roundcube/roundcubemail>
- Магазин YunoHost: <https://apps.yunohost.org/app/roundcube>
- Сообщите об ошибке: <https://github.com/YunoHost-Apps/roundcube_ynh/issues>
## Информация для разработчиков
Пришлите Ваш запрос на слияние в [ветку `testing`](https://github.com/YunoHost-Apps/roundcube_ynh/tree/testing).
Чтобы попробовать ветку `testing`, пожалуйста, сделайте что-то вроде этого:
```bash
sudo yunohost app install 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
```
**Больше информации о пакетировании приложений:** <https://yunohost.org/packaging_apps>

View file

@ -1,5 +0,0 @@
SOURCE_URL=https://github.com/roundcube/roundcubemail/releases/download/1.6.6/roundcubemail-1.6.6.tar.gz
SOURCE_SUM=40e4d7505b01f401e757f7439930ed96b1245ffc3863dd326fcf21e0e5847c74
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true

View file

@ -1,4 +0,0 @@
; Additional php.ini defines, specific to this pool of workers.
php_admin_value[upload_max_filesize] = 256M
php_admin_value[post_max_size] = 256M

View file

@ -12,7 +12,7 @@ location __PATH__/ {
location ~ [^/]\.php(/|$) { location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$; fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock; fastcgi_pass unix:/var/run/php/php__PHP_VERSION__-fpm-__APP__.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;

View file

@ -1,30 +0,0 @@
version = "1.0"
[main]
name = "Roundcube configuration"
[main.php_fpm_config]
name = "PHP-FPM configuration"
[main.php_fpm_config.fpm_footprint]
ask = "Memory footprint"
type = "select"
choices.low = "Low, <= 20Mb per pool"
choices.medium = "Medium, between 20Mb and 40Mb per pool"
choices.high = "High, > 40Mb per pool"
choices.specific = "Use specific value"
default = "low"
[main.php_fpm_config.fpm_free_footprint]
visible = "fpm_footprint == 'specific'"
ask = "Memory footprint of the service?"
type = "number"
default = "0"
help = "Free field to specify exactly the footprint in Mb if you don't want to use one of the three previous values."
[main.php_fpm_config.fpm_usage]
ask = "Expected usage"
type = "select"
choices = ["low", "medium", "high"]
default = "low"
help = "low: Personal usage, behind the SSO. No RAM footprint when not used, but the impact on the processor can be high if many users are using the service.<br>medium: Low usage, few people or/and publicly accessible. Low RAM footprint, medium processor footprint when used.<br>high: High usage, frequently visited website. High RAM footprint, but lower on processor usage and quickly responding."

View file

@ -18,7 +18,8 @@ admindoc = "https://github.com/roundcube/roundcubemail/wiki"
code = "https://github.com/roundcube/roundcubemail" code = "https://github.com/roundcube/roundcubemail"
[integration] [integration]
yunohost = ">= 11.2" yunohost = ">= 11.2.29"
helpers_version = "2.1"
architectures = "all" architectures = "all"
multi_instance = true multi_instance = true
ldap = true ldap = true
@ -62,6 +63,7 @@ ram.runtime = "50M"
[resources.system_user] [resources.system_user]
[resources.install_dir] [resources.install_dir]
group = "www-data:r-x"
[resources.permissions] [resources.permissions]
main.url = "/" main.url = "/"

View file

@ -1,17 +1,13 @@
#!/bin/bash #!/bin/bash
#================================================= #=================================================
# COMMON VARIABLES # COMMON VARIABLES AND CUSTOM HELPERS
#================================================= #=================================================
# Composer version # Composer version
YNH_COMPOSER_VERSION=2.5.5 composer_version=2.5.5
# Plugins version # Plugins version
contextmenu_version=3.3.1 contextmenu_version=3.3.1
automatic_addressbook_version=v0.4.3 automatic_addressbook_version=v0.4.3
carddav_version=5.1.0 carddav_version=5.1.0
#=================================================
# EXPERIMENTAL HELPERS
#=================================================

View file

@ -1,46 +1,33 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= ynh_print_info "Declaring files to be backed up..."
# 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_backup --src_path="$install_dir" ynh_backup "$install_dir"
#================================================= #=================================================
# BACKUP THE NGINX CONFIGURATION # SYSTEM CONFIGURATION
#================================================= #=================================================
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= ynh_backup "/etc/php/$php_version/fpm/pool.d/$app.conf"
# BACKUP THE PHP-FPM CONFIGURATION
#=================================================
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#================================================= #=================================================
# BACKUP THE MYSQL DATABASE # BACKUP THE MYSQL DATABASE
#================================================= #=================================================
ynh_print_info --message="Backing up the MySQL database..." ynh_print_info "Backing up the MySQL database..."
ynh_mysql_dump_db --database="$db_name" > db.sql ynh_mysql_dump_db > db.sql
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

View file

@ -1,25 +1,17 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# STANDARD MODIFICATIONS
#================================================= #=================================================
# MODIFY URL IN NGINX CONF # MODIFY URL IN NGINX CONF
#================================================= #=================================================
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2 ynh_script_progression "Updating NGINX web server configuration..."
ynh_change_url_nginx_config ynh_config_change_url_nginx
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Change of URL completed for $app" --last ynh_script_progression "Change of URL completed for $app"

View file

@ -1,95 +0,0 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
current_fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
#=================================================
# SPECIFIC GETTERS FOR TOML SHORT KEY
#=================================================
get__fpm_footprint() {
# Free footprint value for php-fpm
# Check if current_fpm_footprint is an integer
if [ "$current_fpm_footprint" -eq "$current_fpm_footprint" ] 2> /dev/null
then
echo "specific"
else
echo "$current_fpm_footprint"
fi
}
get__free_footprint() {
# Free footprint value for php-fpm
# Check if current_fpm_footprint is an integer
if [ "$current_fpm_footprint" -eq "$current_fpm_footprint" ] 2> /dev/null
then
# If current_fpm_footprint is an integer, that's a numeric value for the footprint
echo "$current_fpm_footprint"
else
echo "0"
fi
}
#=================================================
# SPECIFIC SETTERS FOR TOML SHORT KEYS
#=================================================
set__fpm_footprint() {
if [ "$fpm_footprint" != "specific" ]
then
ynh_app_setting_set --app=$app --key=fpm_footprint --value="$fpm_footprint"
fi
}
set__fpm_free_footprint() {
if [ "$fpm_footprint" = "specific" ]
then
ynh_app_setting_set --app=$app --key=fpm_footprint --value="$fpm_free_footprint"
fi
}
#=================================================
# GENERIC FINALIZATION
#=================================================
ynh_app_config_validate() {
_ynh_app_config_validate
if [ "${changed[fpm_usage]}" == "true" ] || [ "${changed[fpm_footprint]}" == "true" ] || [ "${changed[fpm_free_footprint]}" == "true" ]; then
# If fpm_footprint is set to 'specific', use $fpm_free_footprint value.
if [ "$fpm_footprint" = "specific" ]
then
fpm_footprint=$fpm_free_footprint
fi
if [ "$fpm_footprint" == "0" ]
then
ynh_print_err --message="When selecting 'specific', you have to set a footprint value into the field below."
exit 0
fi
fi
}
ynh_app_config_apply() {
_ynh_app_config_apply
ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint
}
ynh_app_config_run $1

View file

@ -1,110 +1,70 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= ynh_app_setting_set --key=php_upload_max_filesize --value=256M
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
fpm_footprint="low"
fpm_free_footprint=0
fpm_usage="low"
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_script_progression --message="Storing installation settings..." --weight=2
ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint
ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint
ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression --message="Setting up source files..." --weight=7 ynh_script_progression "Setting up source files..."
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir" ynh_setup_source --dest_dir="$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#================================================= #=================================================
# NGINX CONFIGURATION # APP INITIAL CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=2 ynh_script_progression "Adding $app's configuration files..."
# Create a dedicated NGINX config ynh_config_add_nginx
ynh_add_nginx_config
# Create a dedicated php-fpm config ynh_config_add_phpfpm
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint
ynh_composer_install
#================================================= #=================================================
# SPECIFIC SETUP # SPECIFIC SETUP
#=================================================
# INSTALL AND INITIALIZE COMPOSER
#=================================================
ynh_script_progression --message="Installing Roundcube with Composer..." --weight=30
# Install composer.json
cp "$install_dir/composer.json-dist" "$install_dir/composer.json"
# Install composer
ynh_install_composer
#================================================= #=================================================
# INITIALIZE DATABASE # INITIALIZE DATABASE
#================================================= #=================================================
ynh_script_progression --message="Initializing database..." --weight=3 ynh_script_progression "Initializing database..."
ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < "$install_dir/SQL/mysql.initial.sql" ynh_mysql_db_shell < "$install_dir/SQL/mysql.initial.sql"
#================================================= #=================================================
# CONFIGURE ROUNDCUBE # CONFIGURE ROUNDCUBE
#================================================= #=================================================
ynh_script_progression --message="Configuring Roundcube..." --weight=2 ynh_script_progression "Configuring Roundcube..."
deskey=$(ynh_string_random --length=24) deskey=$(ynh_string_random --length=24)
ynh_add_config --template="../conf/config.inc.php" --destination="$install_dir/config/config.inc.php" ynh_config_add --template="config.inc.php" --destination="$install_dir/config/config.inc.php"
#================================================= #=================================================
# INSTALL ADDITIONAL PLUGINS # INSTALL ADDITIONAL PLUGINS
#================================================= #=================================================
ynh_script_progression --message="Installing additional plugins..." --weight=60 ynh_script_progression "Installing additional plugins..."
# Create logs and temp directories
mkdir -p "$install_dir/"{logs,temp}
# Install net_LDAP # Install net_LDAP
export COMPOSER_ALLOW_SUPERUSER=1 ynh_composer_exec require kolab/net_ldap3
ynh_composer_exec --commands="require kolab/net_ldap3"
# Install contextmenu and automatic_addressbook plugins # Install contextmenu and automatic_addressbook plugins
# https://plugins.roundcube.net/packages/sblaisot/automatic_addressbook # https://plugins.roundcube.net/packages/sblaisot/automatic_addressbook
# https://plugins.roundcube.net/packages/johndoh/contextmenu # https://plugins.roundcube.net/packages/johndoh/contextmenu
ynh_composer_exec --commands="require \ ynh_composer_exec require \
johndoh/contextmenu $contextmenu_version \ johndoh/contextmenu $contextmenu_version \
sblaisot/automatic_addressbook $automatic_addressbook_version" sblaisot/automatic_addressbook $automatic_addressbook_version
installed_plugins+=" 'contextmenu', 'automatic_addressbook'," installed_plugins+=" 'contextmenu', 'automatic_addressbook',"
ynh_add_config --template="../conf/enigma.config.inc.php" --destination="$install_dir/plugins/enigma/config.inc.php" ynh_config_add --template="enigma.config.inc.php" --destination="$install_dir/plugins/enigma/config.inc.php"
mkdir -p "$install_dir/plugins/enigma/home" mkdir -p "$install_dir/plugins/enigma/home"
chown -R $app:www-data "$install_dir/plugins/enigma/home" chown -R $app:www-data "$install_dir/plugins/enigma/home"
# Install CardDAV plugin # Install CardDAV plugin
if [ $with_carddav -eq 1 ] if [ $with_carddav -eq 1 ]
then then
ynh_composer_exec --commands="require roundcube/carddav $carddav_version --with-all-dependencies" ynh_composer_exec require roundcube/carddav $carddav_version --with-all-dependencies
carddav_tmp_config="../conf/carddav.config.inc.php" carddav_tmp_config="../conf/carddav.config.inc.php"
carddav_server=0 carddav_server=0
@ -125,8 +85,8 @@ then
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}_id}" --replace_string="$carddav_app_id" --target_file="$install_dir/plugins/carddav/config.inc.php" ynh_replace --match="{${carddav_app}_id}" --replace="$carddav_app_id" --file="$install_dir/plugins/carddav/config.inc.php"
ynh_replace_string --match_string="{${carddav_app}_url}" --replace_string="$carddav_url" --target_file="$install_dir/plugins/carddav/config.inc.php" ynh_replace --match="{${carddav_app}_url}" --replace="$carddav_url" --file="$install_dir/plugins/carddav/config.inc.php"
done done
done done
@ -140,22 +100,13 @@ fi
#================================================= #=================================================
# UPDATE ROUNDCUBE CONFIGURATION # UPDATE ROUNDCUBE CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Updating Roundcube configuration..." --weight=3 ynh_script_progression "Updating Roundcube configuration..."
ynh_replace_string --match_string="^\s*// installed plugins" --replace_string="&\n $installed_plugins" --target_file="$install_dir/config/config.inc.php" ynh_replace --match="^\s*// installed plugins" --replace="&\n $installed_plugins" --file="$install_dir/config/config.inc.php"
ynh_store_file_checksum "$install_dir/config/config.inc.php"
# Update javascript dependencies
(cd "$install_dir"
/usr/bin/php$phpversion -q ./bin/install-jsdeps.sh -v ?)
# Store the config file checksum into the app settings
ynh_store_file_checksum --file="$install_dir/config/config.inc.php"
chmod 400 "$install_dir/config/config.inc.php"
chown $app:$app "$install_dir/config/config.inc.php"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Installation of $app completed" --last ynh_script_progression "Installation of $app completed"

View file

@ -1,27 +1,19 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
# REMOVE NGINX CONFIGURATION # REMOVE SYSTEM CONFIGURATIONS
#================================================= #=================================================
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=2 ynh_script_progression "Removing system configurations related to $app..."
# Remove the dedicated NGINX config ynh_config_remove_nginx
ynh_remove_nginx_config
# Remove the dedicated PHP-FPM config ynh_config_remove_phpfpm
ynh_remove_fpm_config
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Removal of $app completed" --last ynh_script_progression "Removal of $app completed"

View file

@ -1,52 +1,41 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Restoring $app main directory..." --weight=4 ynh_script_progression "Restoring $app main directory..."
ynh_restore_file --origin_path="$install_dir" ynh_restore "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#================================================= #=================================================
# RESTORE THE MYSQL DATABASE # RESTORE THE MYSQL DATABASE
#================================================= #=================================================
ynh_script_progression --message="Restoring the MySQL database..." --weight=5 ynh_script_progression "Restoring the MySQL database..."
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql ynh_mysql_db_shell < ./db.sql
#================================================= #=================================================
# RESTORE THE PHP-FPM CONFIGURATION # RESTORE SYSTEM CONFIGURATIONS
#================================================= #=================================================
ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=1 ynh_script_progression "Restoring system configurations related to $app..."
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" ynh_restore "/etc/php/$php_version/fpm/pool.d/$app.conf"
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# GENERIC FINALIZATION
#================================================= #=================================================
# RELOAD NGINX AND PHP-FPM # RELOAD NGINX AND PHP-FPM
#================================================= #=================================================
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1 ynh_script_progression "Reloading NGINX web server and PHP-FPM..."
ynh_systemd_action --service_name=php${phpversion}-fpm --action=reload ynh_systemctl --service=php${php_version}-fpm --action=reload
ynh_systemd_action --service_name=nginx --action=reload ynh_systemctl --service=nginx --action=reload
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Restoration completed for $app" --last ynh_script_progression "Restoration completed for $app"

View file

@ -1,151 +1,82 @@
#!/bin/bash #!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= ynh_app_setting_set_default --key=php_upload_max_filesize --value=256M
# CHECK VERSION
#=================================================
upgrade_type=$(ynh_check_app_version_changed)
#================================================= #=================================================
# ENSURE DOWNWARD COMPATIBILITY # ENSURE DOWNWARD COMPATIBILITY
#================================================= #=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 ynh_script_progression "Ensuring downward compatibility..."
# If with_carddav doesn't exist, create it # If with_carddav doesn't exist, create it
if [ -z "${with_carddav:-}" ]; then if [ -z "${with_carddav:-}" ]; then
if [ -f "$install_dir/plugins/carddav/config.inc.php" ] if [ -f "$install_dir/plugins/carddav/config.inc.php" ]
then then
with_carddav=1 ynh_app_setting_set_default --key=with_carddav --value="1"
else else
with_carddav=0 ynh_app_setting_set_default --key=with_carddav --value="0"
fi fi
ynh_app_setting_set --app=$app --key=with_carddav --value=$with_carddav
fi fi
# If language doesn't exist, create it # If language doesn't exist, create it
if [ -z "${language:-}" ]; then ynh_app_setting_set_default --key=language --value="en_GB"
language="en_GB"
ynh_app_setting_set --app=$app --key=language --value=$language
fi
# If fpm_footprint doesn't exist, create it
if [ -z "${fpm_footprint:-}" ]; then
fpm_footprint=low
ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint
fi
# If fpm_free_footprint doesn't exist, create it
if [ -z "${fpm_free_footprint:-}" ]; then
fpm_free_footprint=0
ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint
fi
# If fpm_usage doesn't exist, create it
if [ -z "${fpm_usage:-}" ]; then
fpm_usage=low
ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage
fi
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
# Get the current version of roundcube # Get the current version of roundcube
oldversion=$(grep RCMAIL_VERSION "$install_dir/program/include/iniset.php" | cut -d\' -f4) oldversion=$(grep RCMAIL_VERSION "$install_dir/program/include/iniset.php" | cut -d\' -f4)
if [ "$upgrade_type" == "UPGRADE_APP" ] #=================================================
then # DOWNLOAD, CHECK AND UNPACK SOURCE
ynh_script_progression --message="Upgrading source files..." --weight=3 #=================================================
ynh_script_progression "Upgrading source files..."
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir" ynh_setup_source --dest_dir="$install_dir"
fi
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#================================================= #=================================================
# PHP-FPM CONFIGURATION # REAPPLY SYSTEM CONFIGURATIONS
#================================================= #=================================================
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=5 ynh_script_progression "Upgrading system configurations related to $app..."
# Create a dedicated PHP-FPM config ynh_config_add_phpfpm
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint
# Create a dedicated NGINX config ynh_config_add_nginx
ynh_add_nginx_config
ynh_composer_install
#=================================================
# SPECIFIC UPGRADE
#================================================= #=================================================
# CONFIGURE ROUNDCUBE # CONFIGURE ROUNDCUBE
#================================================= #=================================================
ynh_script_progression "Reconfiguring Roundcube..."
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Reconfiguring Roundcube..." --weight=1
deskey=$(ynh_string_random --length=24) deskey=$(ynh_string_random --length=24)
ynh_add_config --template="../conf/config.inc.php" --destination="$install_dir/config/config.inc.php" ynh_config_add --template="config.inc.php" --destination="$install_dir/config/config.inc.php"
#=================================================
# UPDATE DEPENDENCIES WITH COMPOSER
#=================================================
ynh_script_progression --message="Updating dependencies with Composer..." --weight=30
# Upgrade composer itself
ynh_install_composer
# Check if dependencies need to be updated with Composer
if [ -f "$install_dir/composer.json" ]
then
ynh_exec_warn_less ynh_composer_exec --commands="update"
# Update plugin-installer for Composer version 2.0
ynh_exec_warn_less ynh_composer_exec --commands="require roundcube/plugin-installer:>=0.2.0"
else
# Install composer.json
cp "$install_dir/composer.json-dist" "$install_dir/composer.json"
fi
#================================================= #=================================================
# UPGRADE ADDITIONAL PLUGINS # UPGRADE ADDITIONAL PLUGINS
#================================================= #=================================================
ynh_script_progression --message="Upgrading additional plugins..." --weight=30 ynh_script_progression "Upgrading additional plugins..."
# Create logs and temp directories
mkdir -p "$install_dir/"{logs,temp}
# Install net_LDAP # Install net_LDAP
ynh_composer_exec --commands="require kolab/net_ldap3" ynh_composer_exec require kolab/net_ldap3
# Update or install contextmenu and automatic_addressbook plugins # Update or install contextmenu and automatic_addressbook plugins
# https://plugins.roundcube.net/packages/sblaisot/automatic_addressbook # https://plugins.roundcube.net/packages/sblaisot/automatic_addressbook
# https://plugins.roundcube.net/packages/johndoh/contextmenu # https://plugins.roundcube.net/packages/johndoh/contextmenu
ynh_composer_exec --commands="update --no-dev --prefer-dist \ ynh_composer_exec update --no-dev --prefer-dist \
johndoh/contextmenu $contextmenu_version \ johndoh/contextmenu $contextmenu_version \
sblaisot/automatic_addressbook $automatic_addressbook_version" sblaisot/automatic_addressbook $automatic_addressbook_version
installed_plugins+=" 'contextmenu', 'automatic_addressbook'," installed_plugins+=" 'contextmenu', 'automatic_addressbook',"
ynh_add_config --template="../conf/enigma.config.inc.php" --destination="$install_dir/plugins/enigma/config.inc.php" ynh_config_add --template="enigma.config.inc.php" --destination="$install_dir/plugins/enigma/config.inc.php"
mkdir -p "$install_dir/plugins/enigma/home" mkdir -p "$install_dir/plugins/enigma/home"
chown -R $app:$app "$install_dir/plugins/enigma/home" chown -R $app:$app "$install_dir/plugins/enigma/home"
# Update or install CardDAV plugin # Update or install CardDAV plugin
if [ $with_carddav -eq 1 ] if [ $with_carddav -eq 1 ]
then then
ynh_composer_exec --commands="require roundcube/carddav $carddav_version --with-all-dependencies" ynh_composer_exec require roundcube/carddav $carddav_version --with-all-dependencies
carddav_tmp_config="../conf/carddav.config.inc.php" carddav_tmp_config="../conf/carddav.config.inc.php"
carddav_server=0 carddav_server=0
@ -166,8 +97,8 @@ then
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}_id}" --replace_string="$carddav_app_id" --target_file="$install_dir/plugins/carddav/config.inc.php" ynh_replace --match="{${carddav_app}_id}" --replace="$carddav_app_id" --file="$install_dir/plugins/carddav/config.inc.php"
ynh_replace_string --match_string="{${carddav_app}_url}" --replace_string="$carddav_url" --target_file="$install_dir/plugins/carddav/config.inc.php" ynh_replace --match="{${carddav_app}_url}" --replace="$carddav_url" --file="$install_dir/plugins/carddav/config.inc.php"
done done
done done
@ -181,31 +112,24 @@ then
#================================================= #=================================================
# UPDATE ROUNDCUBE CONFIGURATION # UPDATE ROUNDCUBE CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Updating $app configuration..." --weight=4 ynh_script_progression "Updating $app configuration..."
ynh_replace_string --match_string="^\s*// installed plugins" --replace_string="&\n $installed_plugins" --target_file="$install_dir/config/config.inc.php" ynh_replace --match="^\s*// installed plugins" --replace="&\n $installed_plugins" --file="$install_dir/config/config.inc.php"
# Update JavaScript dependencies # Update JavaScript dependencies
pushd "$install_dir" pushd "$install_dir"
COMPOSER_ALLOW_SUPERUSER=1 "php$phpversion" ./bin/update.sh --version="?" -y <<< "" export COMPOSER_HOME="$install_dir/.composer"
ynh_exec_as_app "php$php_version" ./bin/update.sh --version="?" -y <<< ""
ynh_script_progression "Updating $app core..."
ynh_exec_as_app "php$php_version" ./bin/update.sh --version=$oldversion -y
popd
# Store the config file checksum into the app settings # Store the config file checksum into the app settings
ynh_store_file_checksum --file="$install_dir/config/config.inc.php" ynh_store_file_checksum "$install_dir/config/config.inc.php"
chmod 400 "$install_dir/config/config.inc.php"
chown $app:$app "$install_dir/config/config.inc.php"
#=================================================
# UPDATE ROUNDCUBE CORE
#=================================================
ynh_script_progression --message="Updating $app core..." --weight=4
COMPOSER_ALLOW_SUPERUSER=1 ynh_exec_warn "php$phpversion" ./bin/update.sh --version=$oldversion -y
popd
fi
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Installation of $app completed" --last ynh_script_progression "Installation of $app completed"