From 1200165f38a53a207590ffe6f9f92ca1072087a9 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Thu, 20 Jun 2024 22:14:23 +0200 Subject: [PATCH 1/4] Apply convert_to_helpers_2.1.py --- .gitignore | 2 + conf/nginx.conf | 2 +- config_panel.toml | 30 ------ manifest.toml | 1 + .../app-fix-login-page-when-ssoed.patch | 0 scripts/_common.sh | 8 +- scripts/backup | 23 ++--- scripts/change_url | 14 +-- scripts/config | 95 ------------------- scripts/install | 67 ++++++------- scripts/remove | 14 +-- scripts/restore | 30 +++--- scripts/upgrade | 89 ++++++++--------- 13 files changed, 99 insertions(+), 276 deletions(-) delete mode 100644 config_panel.toml rename {sources/patches => patches}/app-fix-login-page-when-ssoed.patch (100%) delete mode 100644 scripts/config diff --git a/.gitignore b/.gitignore index d38c149..e8cf934 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ *.swp *~ +~.sw[op] +.DS_Store diff --git a/conf/nginx.conf b/conf/nginx.conf index 24e9fd5..fbdd3f7 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -12,7 +12,7 @@ location __PATH__/ { location ~ [^/]\.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_param REMOTE_USER $remote_user; fastcgi_param PATH_INFO $fastcgi_path_info; diff --git a/config_panel.toml b/config_panel.toml deleted file mode 100644 index e18cff6..0000000 --- a/config_panel.toml +++ /dev/null @@ -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.
medium: Low usage, few people or/and publicly accessible. Low RAM footprint, medium processor footprint when used.
high: High usage, frequently visited website. High RAM footprint, but lower on processor usage and quickly responding." diff --git a/manifest.toml b/manifest.toml index 05770ea..1820dbe 100644 --- a/manifest.toml +++ b/manifest.toml @@ -19,6 +19,7 @@ code = "https://github.com/roundcube/roundcubemail" [integration] yunohost = ">= 11.2" +helpers_version = "2.1" architectures = "all" multi_instance = true ldap = true diff --git a/sources/patches/app-fix-login-page-when-ssoed.patch b/patches/app-fix-login-page-when-ssoed.patch similarity index 100% rename from sources/patches/app-fix-login-page-when-ssoed.patch rename to patches/app-fix-login-page-when-ssoed.patch diff --git a/scripts/_common.sh b/scripts/_common.sh index c191e21..2753546 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,17 +1,13 @@ #!/bin/bash #================================================= -# COMMON VARIABLES +# COMMON VARIABLES AND CUSTOM HELPERS #================================================= # Composer version -YNH_COMPOSER_VERSION=2.5.5 +composer_version=2.5.5 # Plugins version contextmenu_version=3.3.1 automatic_addressbook_version=v0.4.3 carddav_version=5.0.1 - -#================================================= -# EXPERIMENTAL HELPERS -#================================================= diff --git a/scripts/backup b/scripts/backup index 86dca3b..d4bd7b0 100644 --- a/scripts/backup +++ b/scripts/backup @@ -1,46 +1,37 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# DECLARE DATA AND CONF FILES TO BACKUP -#================================================= -ynh_print_info --message="Declaring files to be backed up..." +ynh_print_info "Declaring files to be backed up..." #================================================= # BACKUP THE APP MAIN DIR #================================================= -ynh_backup --src_path="$install_dir" +ynh_backup "$install_dir" #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= -ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # BACKUP THE PHP-FPM CONFIGURATION #================================================= -ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" +ynh_backup "/etc/php/$php_version/fpm/pool.d/$app.conf" #================================================= # 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 #================================================= -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)." diff --git a/scripts/change_url b/scripts/change_url index 16e0f3c..39d37fc 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -1,25 +1,17 @@ #!/bin/bash -#================================================= -# GENERIC STARTING -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers -#================================================= -# STANDARD MODIFICATIONS #================================================= # 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 #================================================= -ynh_script_progression --message="Change of URL completed for $app" --last +ynh_script_progression "Change of URL completed for $app" diff --git a/scripts/config b/scripts/config deleted file mode 100644 index 91c2de7..0000000 --- a/scripts/config +++ /dev/null @@ -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 diff --git a/scripts/install b/scripts/install index 25ac65e..f8017b4 100644 --- a/scripts/install +++ b/scripts/install @@ -1,11 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers @@ -13,23 +7,23 @@ source /usr/share/yunohost/helpers # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= -fpm_footprint="low" -fpm_free_footprint=0 -fpm_usage="low" +#REMOVEME? fpm_footprint="low" +#REMOVEME? fpm_free_footprint=0 +#REMOVEME? fpm_usage="low" #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_script_progression --message="Storing installation settings..." --weight=2 +ynh_script_progression "Storing installation settings..." -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 +ynh_app_setting_set --key=fpm_footprint --value=$fpm_footprint +ynh_app_setting_set --key=fpm_free_footprint --value=$fpm_free_footprint +ynh_app_setting_set --key=fpm_usage --value=$fpm_usage #================================================= # 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" @@ -40,71 +34,72 @@ chown -R $app:www-data "$install_dir" #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring NGINX web server..." --weight=2 +ynh_script_progression "Configuring NGINX web server..." # Create a dedicated NGINX config -ynh_add_nginx_config +ynh_config_add_nginx # Create a dedicated php-fpm config -ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint +ynh_config_add_phpfpm #================================================= # SPECIFIC SETUP #================================================= # INSTALL AND INITIALIZE COMPOSER #================================================= -ynh_script_progression --message="Installing Roundcube with Composer..." --weight=30 +ynh_script_progression "Installing Roundcube with Composer..." # Install composer.json cp "$install_dir/composer.json-dist" "$install_dir/composer.json" # Install composer -ynh_install_composer +ynh_composer_install +ynh_composer_exec install --no-dev #================================================= # 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 #================================================= -ynh_script_progression --message="Configuring Roundcube..." --weight=2 +ynh_script_progression "Configuring Roundcube..." 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 #================================================= -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 export COMPOSER_ALLOW_SUPERUSER=1 -ynh_composer_exec --commands="require kolab/net_ldap3" +ynh_composer_exec require kolab/net_ldap3 # Install contextmenu and automatic_addressbook plugins # https://plugins.roundcube.net/packages/sblaisot/automatic_addressbook # https://plugins.roundcube.net/packages/johndoh/contextmenu -ynh_composer_exec --commands="require \ +ynh_composer_exec require \ johndoh/contextmenu $contextmenu_version \ - sblaisot/automatic_addressbook $automatic_addressbook_version" + sblaisot/automatic_addressbook $automatic_addressbook_version 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" chown -R $app:www-data "$install_dir/plugins/enigma/home" # Install CardDAV plugin if [ $with_carddav -eq 1 ] 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_server=0 @@ -125,8 +120,8 @@ then 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_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_string --match_string="{${carddav_app}_url}" --replace_string="$carddav_url" --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 --match="{${carddav_app}_url}" --replace="$carddav_url" --file="$install_dir/plugins/carddav/config.inc.php" done done @@ -140,16 +135,16 @@ fi #================================================= # 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" # Update javascript dependencies (cd "$install_dir" -/usr/bin/php$phpversion -q ./bin/install-jsdeps.sh -v ?) +/usr/bin/php$php_version -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" +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" @@ -158,4 +153,4 @@ chown $app:$app "$install_dir/config/config.inc.php" # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of $app completed" --last +ynh_script_progression "Installation of $app completed" diff --git a/scripts/remove b/scripts/remove index 4fb7e3c..0201b35 100644 --- a/scripts/remove +++ b/scripts/remove @@ -1,27 +1,21 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --weight=2 +ynh_script_progression "Removing NGINX web server configuration..." # Remove the dedicated NGINX config -ynh_remove_nginx_config +ynh_config_remove_nginx # Remove the dedicated PHP-FPM config -ynh_remove_fpm_config +ynh_config_remove_phpfpm #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of $app completed" --last +ynh_script_progression "Removal of $app completed" diff --git a/scripts/restore b/scripts/restore index e87c0a6..922b27c 100644 --- a/scripts/restore +++ b/scripts/restore @@ -1,20 +1,14 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers #================================================= # 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" @@ -22,31 +16,29 @@ chown -R $app:www-data "$install_dir" #================================================= # 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 #================================================= -ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=1 +ynh_script_progression "Restoring the PHP-FPM configuration..." -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 #================================================= -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_systemd_action --service_name=nginx --action=reload +ynh_systemctl --service=php${php_version}-fpm --action=reload +ynh_systemctl --service=nginx --action=reload #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for $app" --last +ynh_script_progression "Restoration completed for $app" diff --git a/scripts/upgrade b/scripts/upgrade index c9be392..3cf675f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1,24 +1,12 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers -#================================================= -# CHECK VERSION -#================================================= - -upgrade_type=$(ynh_check_app_version_changed) - #================================================= # 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 [ -z "${with_carddav:-}" ]; then @@ -28,35 +16,33 @@ if [ -z "${with_carddav:-}" ]; then else with_carddav=0 fi - ynh_app_setting_set --app=$app --key=with_carddav --value=$with_carddav + ynh_app_setting_set --key=with_carddav --value=$with_carddav 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 + ynh_app_setting_set --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 + #REMOVEME? fpm_footprint=low + ynh_app_setting_set --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 + #REMOVEME? fpm_free_footprint=0 + ynh_app_setting_set --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 + #REMOVEME? fpm_usage=low + ynh_app_setting_set --key=fpm_usage --value=$fpm_usage fi -#================================================= -# STANDARD UPGRADE STEPS #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -64,9 +50,9 @@ fi # Get the current version of roundcube oldversion=$(grep RCMAIL_VERSION "$install_dir/program/include/iniset.php" | cut -d\' -f4) -if [ "$upgrade_type" == "UPGRADE_APP" ] +if ynh_app_upstream_version_changed then - 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" @@ -78,41 +64,40 @@ chown -R $app:www-data "$install_dir" #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=5 +ynh_script_progression "Upgrading PHP-FPM configuration..." # Create a dedicated PHP-FPM config -ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint +ynh_config_add_phpfpm # Create a dedicated NGINX config -ynh_add_nginx_config +ynh_config_add_nginx -#================================================= -# SPECIFIC UPGRADE #================================================= # CONFIGURE ROUNDCUBE #================================================= -if [ "$upgrade_type" == "UPGRADE_APP" ] +if ynh_app_upstream_version_changed then - ynh_script_progression --message="Reconfiguring Roundcube..." --weight=1 + ynh_script_progression "Reconfiguring Roundcube..." 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 + ynh_script_progression "Updating dependencies with Composer..." # Upgrade composer itself - ynh_install_composer + ynh_composer_install +ynh_composer_exec install --no-dev # 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" + ynh_composer_exec update # Update plugin-installer for Composer version 2.0 - ynh_exec_warn_less ynh_composer_exec --commands="require roundcube/plugin-installer:>=0.2.0" + ynh_composer_exec require roundcube/plugin-installer:>=0.2.0 else # Install composer.json cp "$install_dir/composer.json-dist" "$install_dir/composer.json" @@ -121,31 +106,31 @@ then #================================================= # 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 - ynh_composer_exec --commands="require kolab/net_ldap3" + ynh_composer_exec require kolab/net_ldap3 # Update or install contextmenu and automatic_addressbook plugins # https://plugins.roundcube.net/packages/sblaisot/automatic_addressbook # 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 \ - sblaisot/automatic_addressbook $automatic_addressbook_version" + sblaisot/automatic_addressbook $automatic_addressbook_version 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" chown -R $app:$app "$install_dir/plugins/enigma/home" # Update or install CardDAV plugin if [ $with_carddav -eq 1 ] 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_server=0 @@ -166,8 +151,8 @@ then 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_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_string --match_string="{${carddav_app}_url}" --replace_string="$carddav_url" --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 --match="{${carddav_app}_url}" --replace="$carddav_url" --file="$install_dir/plugins/carddav/config.inc.php" done done @@ -181,16 +166,16 @@ then #================================================= # 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 pushd "$install_dir" - COMPOSER_ALLOW_SUPERUSER=1 "php$phpversion" ./bin/update.sh --version="?" -y <<< "" + COMPOSER_ALLOW_SUPERUSER=1 "php$php_version" ./bin/update.sh --version="?" -y <<< "" # 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" @@ -198,9 +183,9 @@ then #================================================= # UPDATE ROUNDCUBE CORE #================================================= - ynh_script_progression --message="Updating $app core..." --weight=4 + ynh_script_progression "Updating $app core..." - COMPOSER_ALLOW_SUPERUSER=1 ynh_exec_warn "php$phpversion" ./bin/update.sh --version=$oldversion -y + COMPOSER_ALLOW_SUPERUSER=1 ynh_exec_warn "php$php_version" ./bin/update.sh --version=$oldversion -y popd fi @@ -208,4 +193,4 @@ fi # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of $app completed" --last +ynh_script_progression "Installation of $app completed" From 75abaa231f18422162b2835f538a90321ae631ce Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Thu, 20 Jun 2024 22:15:44 +0200 Subject: [PATCH 2/4] Gotta use cp -a such that composer.json is owned by the app, because now ynh_composer_exec runs as $app --- scripts/install | 2 +- scripts/upgrade | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index f8017b4..c704c1e 100644 --- a/scripts/install +++ b/scripts/install @@ -50,7 +50,7 @@ ynh_config_add_phpfpm ynh_script_progression "Installing Roundcube with Composer..." # Install composer.json -cp "$install_dir/composer.json-dist" "$install_dir/composer.json" +cp -a "$install_dir/composer.json-dist" "$install_dir/composer.json" # Install composer ynh_composer_install diff --git a/scripts/upgrade b/scripts/upgrade index 3cf675f..d0bd0e9 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -90,7 +90,7 @@ then # Upgrade composer itself ynh_composer_install -ynh_composer_exec install --no-dev + ynh_composer_exec install --no-dev # Check if dependencies need to be updated with Composer if [ -f "$install_dir/composer.json" ] @@ -100,7 +100,7 @@ ynh_composer_exec install --no-dev ynh_composer_exec require roundcube/plugin-installer:>=0.2.0 else # Install composer.json - cp "$install_dir/composer.json-dist" "$install_dir/composer.json" + cp -a "$install_dir/composer.json-dist" "$install_dir/composer.json" fi #================================================= From 6a405dd0857bda7790b3824cebeeb27c36ec9a9f Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Thu, 20 Jun 2024 22:27:37 +0200 Subject: [PATCH 3/4] fpm_ settings zzzzz --- scripts/install | 17 ----------------- scripts/upgrade | 18 ------------------ 2 files changed, 35 deletions(-) diff --git a/scripts/install b/scripts/install index c704c1e..7249091 100644 --- a/scripts/install +++ b/scripts/install @@ -3,23 +3,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# RETRIEVE ARGUMENTS FROM THE MANIFEST -#================================================= - -#REMOVEME? fpm_footprint="low" -#REMOVEME? fpm_free_footprint=0 -#REMOVEME? fpm_usage="low" - -#================================================= -# STORE SETTINGS FROM MANIFEST -#================================================= -ynh_script_progression "Storing installation settings..." - -ynh_app_setting_set --key=fpm_footprint --value=$fpm_footprint -ynh_app_setting_set --key=fpm_free_footprint --value=$fpm_free_footprint -ynh_app_setting_set --key=fpm_usage --value=$fpm_usage - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index d0bd0e9..716c79c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -25,24 +25,6 @@ fi ynh_app_setting_set --key=language --value=$language fi -# If fpm_footprint doesn't exist, create it -if [ -z "${fpm_footprint:-}" ]; then - #REMOVEME? fpm_footprint=low - ynh_app_setting_set --key=fpm_footprint --value=$fpm_footprint -fi - -# If fpm_free_footprint doesn't exist, create it -if [ -z "${fpm_free_footprint:-}" ]; then - #REMOVEME? fpm_free_footprint=0 - ynh_app_setting_set --key=fpm_free_footprint --value=$fpm_free_footprint -fi - -# If fpm_usage doesn't exist, create it -if [ -z "${fpm_usage:-}" ]; then - #REMOVEME? fpm_usage=low - ynh_app_setting_set --key=fpm_usage --value=$fpm_usage -fi - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= From da46942f848171e128133331a5636a05dde8dd80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 24 Jun 2024 13:24:58 +0200 Subject: [PATCH 4/4] Update manifest.toml --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 4aa7799..15721df 100644 --- a/manifest.toml +++ b/manifest.toml @@ -18,7 +18,7 @@ admindoc = "https://github.com/roundcube/roundcubemail/wiki" code = "https://github.com/roundcube/roundcubemail" [integration] -yunohost = ">= 11.2" +yunohost = ">= 11.2.16" helpers_version = "2.1" architectures = "all" multi_instance = true