From 5ef91a8bc5d2e45460fb7577699f0336982e41f9 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 27 Sep 2020 22:39:12 +0200 Subject: [PATCH] Upgrade to 7.3 --- check_process | 3 --- conf/nginx.conf | 2 +- conf/php-fpm.conf | 2 +- manifest.json | 2 +- scripts/_common.sh | 8 +++++--- scripts/backup | 17 +++++++++-------- scripts/change_url | 18 +++++++++--------- scripts/install | 32 +++++++++++++------------------- scripts/remove | 12 ++++++------ scripts/restore | 21 ++++++++------------- scripts/upgrade | 40 +++++++++++++++++----------------------- 11 files changed, 70 insertions(+), 87 deletions(-) diff --git a/check_process b/check_process index b7c4303..0c08fcd 100644 --- a/check_process +++ b/check_process @@ -12,7 +12,6 @@ setup_private=0 setup_public=0 upgrade=1 - upgrade=1 from_commit=8d0acb6953a4c4c2206985c7d9881c5b7b637ebd backup_restore=1 multi_instance=1 incorrect_path=1 @@ -24,6 +23,4 @@ Email= Notification=none ;;; Upgrade options - ; commit=269500433bdbce3b477fa84d0af0db3ac466244d - name=Fix install+upgrade and refactoring manifest_arg=domain=DOMAIN&path=PATH&with_carddav=1&with_enigma=1& diff --git a/conf/nginx.conf b/conf/nginx.conf index 5dc0acc..bf1893d 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -17,7 +17,7 @@ location __PATH__/ { location ~ [^/]\.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_param REMOTE_USER $remote_user; fastcgi_param PATH_INFO $fastcgi_path_info; diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf index 2b5d7b2..61b251f 100644 --- a/conf/php-fpm.conf +++ b/conf/php-fpm.conf @@ -33,7 +33,7 @@ group = __USER__ ; (IPv6 and IPv4-mapped) on a specific port; ; '/path/to/unix/socket' - to listen on a unix socket. ; 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. ; Default Value: 511 (-1 on FreeBSD and OpenBSD) diff --git a/manifest.json b/manifest.json index 502b8cb..9fce200 100644 --- a/manifest.json +++ b/manifest.json @@ -14,7 +14,7 @@ "email": "apps@yunohost.org" }, "requirements": { - "yunohost": ">= 3.5.0" + "yunohost": ">= 4.0.8" }, "multi_instance": true, "services": [ diff --git a/scripts/_common.sh b/scripts/_common.sh index 16d78b9..fb9c9c1 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,8 +4,10 @@ # COMMON VARIABLES #================================================= +YNH_PHP_VERSION="7.3" + # 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${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-common php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-pear php${YNH_PHP_VERSION}-auth-sasl php${YNH_PHP_VERSION}-mail-mime php${YNH_PHP_VERSION}-patchwork-utf8 php${YNH_PHP_VERSION}-net-smtp php${YNH_PHP_VERSION}-net-socket php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-curl" # Plugins version contextmenu_version=2.3 @@ -31,7 +33,7 @@ ynh_composer_exec () { # Manage arguments with getopts ynh_handle_getopts_args "$@" workdir="${workdir:-$final_path}" - phpversion="${phpversion:-7.0}" + phpversion="${phpversion:-7.3}" COMPOSER_HOME="$workdir/.composer" \ php${phpversion} "$workdir/composer.phar" $commands \ @@ -51,7 +53,7 @@ ynh_install_composer () { # Manage arguments with getopts ynh_handle_getopts_args "$@" workdir="${workdir:-$final_path}" - phpversion="${phpversion:-7.0}" + phpversion="${phpversion:-7.3}" curl -sS https://getcomposer.org/installer \ | COMPOSER_HOME="$workdir/.composer" \ diff --git a/scripts/backup b/scripts/backup index a1d85d7..0310c8b 100644 --- a/scripts/backup +++ b/scripts/backup @@ -19,41 +19,42 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." +ynh_print_info --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME final_path=$(ynh_app_setting_get --app=$app --key=final_path) domain=$(ynh_app_setting_get --app=$app --key=domain) db_name=$(ynh_app_setting_get --app=$app --key=db_name) +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= -# 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 #================================================= -ynh_script_progression --message="Backing up the main app directory..." ynh_backup --src_path="$final_path" #================================================= # 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" #================================================= # 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 #================================================= -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 @@ -61,4 +62,4 @@ ynh_mysql_dump_db --database="$db_name" > db.sql # 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 Roundcube. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/change_url b/scripts/change_url index 14c221d..e7b7425 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -24,7 +24,7 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # 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" final_path=$(ynh_app_setting_get --app=$app --key=final_path) @@ -50,23 +50,23 @@ fi #================================================= # 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 -# Change the path in the nginx config file +# Change the path in the NGINX config file if [ $change_path -eq 1 ] 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" - # Set global variables for nginx helper + # Set global variables for NGINX helper domain="$old_domain" path_url="$new_path" - # Create a dedicated nginx config + # Create a dedicated NGINX config ynh_add_nginx_config fi -# Change the domain for nginx +# Change the domain for NGINX if [ $change_domain -eq 1 ] then # Delete file checksum for the old conf file location @@ -81,7 +81,7 @@ fi #================================================= # 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 @@ -89,4 +89,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Change of URL completed for $app" --last +ynh_script_progression --message="Change of URL completed for Roundcube" --last diff --git a/scripts/install b/scripts/install index 38d9854..c94866e 100644 --- a/scripts/install +++ b/scripts/install @@ -50,13 +50,6 @@ ynh_app_setting_set --app=$app --key=with_enigma --value=$with_enigma #================================================= # STANDARD MODIFICATIONS -#================================================= -# INSTALL DEPENDENCIES -#================================================= -ynh_script_progression --message="Installing dependencies..." - -ynh_install_app_dependencies "$pkg_dependencies" - #================================================= # CREATE A MYSQL DATABASE #================================================= @@ -78,9 +71,9 @@ ynh_setup_source --dest_dir="$final_path" #================================================= # 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 #================================================= @@ -94,17 +87,18 @@ ynh_system_user_create --username=$app #================================================= # 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 -ynh_add_fpm_config +# Create a dedicated PHP-FPM config +ynh_add_fpm_config --phpversion=$YNH_PHP_VERSION --package="$extra_php_dependencies" +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # SPECIFIC SETUP #================================================= # 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 cp "$final_path/composer.json-dist" "$final_path/composer.json" @@ -123,7 +117,7 @@ ynh_mysql_connect_as --user="$db_name" --password="$db_pwd" --database="$db_name #================================================= # CONFIGURE ROUNDCUBE #================================================= -ynh_script_progression --message="Configuring roundcube..." +ynh_script_progression --message="Configuring Roundcube..." rc_conf="$final_path/config/config.inc.php" @@ -163,7 +157,7 @@ then carddav_server=0 # Look for installed and supported CardDAV servers - for carddav_app in "owncloud" "nextcloud" "baikal" + for carddav_app in "nextcloud" "baikal" do carddav_app_id=$(yunohost app list --installed -f $carddav_app \ --output-as json | grep -Po '"id":[ ]?"\K.*?(?=")' | head -1) @@ -183,7 +177,7 @@ then # 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 ] then installed_plugins+=" 'carddav'," @@ -205,7 +199,7 @@ fi #================================================= # 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" @@ -230,7 +224,7 @@ chown -R $app: "$final_path/"{temp,logs,plugins/enigma/home} #================================================= # 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 @@ -238,4 +232,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of $app completed" --last +ynh_script_progression --message="Installation of Roundcube completed" --last diff --git a/scripts/remove b/scripts/remove index f01641b..579a922 100644 --- a/scripts/remove +++ b/scripts/remove @@ -41,7 +41,7 @@ ynh_mysql_remove_db --db_user=$db_name --db_name=$db_name #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_script_progression --message="Removing app main directory..." --weight=3 +ynh_script_progression --message="Removing Roundcube main directory..." --weight=3 # Remove the app directory securely ynh_secure_remove --file="$final_path" @@ -49,17 +49,17 @@ ynh_secure_remove --file="$final_path" #================================================= # 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 #================================================= # 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 #================================================= @@ -76,4 +76,4 @@ ynh_system_user_delete --username=$app # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of $app completed" --last +ynh_script_progression --message="Removal of Roundcube completed" --last diff --git a/scripts/restore b/scripts/restore index 7fa57b8..84b89a9 100644 --- a/scripts/restore +++ b/scripts/restore @@ -27,6 +27,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) db_name=$(ynh_app_setting_get --app=$app --key=db_name) +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # 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 #================================================= -ynh_script_progression --message="Restoring the app main directory..." +ynh_script_progression --message="Restoring Roundcube main directory..." 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 #================================================= -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 --phpversion=$YNH_PHP_VERSION --package="$extra_php_dependencies" #================================================= # 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 #================================================= @@ -100,13 +95,13 @@ ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ./ #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -ynh_script_progression --message="Reloading nginx web server and php-fpm..." +ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." -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 #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for $app" --last +ynh_script_progression --message="Restoration completed for Roundcube" --last diff --git a/scripts/upgrade b/scripts/upgrade index 748deb0..fb49838 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -22,6 +22,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) db_name=$(ynh_app_setting_get --app=$app --key=db_name) with_carddav=$(ynh_app_setting_get --app=$app --key=with_carddav) with_enigma=$(ynh_app_setting_get --app=$app --key=with_enigma) +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # CHECK VERSION @@ -71,7 +72,7 @@ fi #================================================= # 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 Roundcube before upgrading (may take a while)..." --weight=30 # Backup the current version of the app ynh_backup_before_upgrade @@ -109,18 +110,11 @@ fi #================================================= # 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 -#================================================= -# UPGRADE DEPENDENCIES -#================================================= -ynh_script_progression --message="Upgrading dependencies..." --weight=25 - -ynh_install_app_dependencies "$pkg_dependencies" - #================================================= # CREATE DEDICATED USER #================================================= @@ -132,10 +126,10 @@ ynh_system_user_create --username=$app #================================================= # 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 -ynh_add_fpm_config +# Create a dedicated PHP-FPM config +ynh_add_fpm_config --phpversion=$YNH_PHP_VERSION --package="$extra_php_dependencies" #================================================= # SPECIFIC UPGRADE @@ -145,7 +139,7 @@ ynh_add_fpm_config if [ "$upgrade_type" == "UPGRADE_APP" ] then - ynh_script_progression --message="Reconfiguring roundcube..." + ynh_script_progression --message="Reconfiguring Roundcube..." rc_conf="$final_path/config/config.inc.php" @@ -163,12 +157,12 @@ then #================================================= # 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 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" ] then ynh_exec_warn_less ynh_composer_exec --commands=\"update --no-dev --prefer-dist\" @@ -205,7 +199,7 @@ then carddav_server=0 # Look for installed and supported CardDAV servers - for carddav_app in "owncloud" "nextcloud" "baikal" + for carddav_app in "nextcloud" "baikal" do carddav_app_id=$(yunohost app list --installed -f $carddav_app \ --output-as json | grep -Po '"id":[ ]?"\K.*?(?=")' | head -1) @@ -225,7 +219,7 @@ then # 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 ] then installed_plugins+=" 'carddav'," @@ -247,11 +241,11 @@ then #================================================= # UPDATE ROUNDCUBE CONFIGURATION #================================================= - ynh_script_progression --message="Updating roundcube configuration..." --weight=4 + ynh_script_progression --message="Updating Roundcube configuration..." --weight=4 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" /usr/bin/php -q ./bin/install-jsdeps.sh) @@ -261,7 +255,7 @@ then #================================================= # UPDATE ROUNDCUBE CORE #================================================= - ynh_script_progression --message="Updating roundcube core..." --weight=4 + ynh_script_progression --message="Updating Roundcube core..." --weight=4 ( cd "$final_path" ynh_exec_warn ./bin/update.sh --version=$oldversion -y) @@ -281,7 +275,7 @@ chown -R $app: "$final_path/"{temp,logs,plugins/enigma/home} #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading NGINX web server..." ynh_systemd_action --service_name=nginx --action=reload @@ -289,4 +283,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of $app completed" --last +ynh_script_progression --message="Installation of Roundcube completed" --last