From 8a6c9d275076879536f53bf97621332d884af965 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 13 Nov 2020 21:44:12 +0100 Subject: [PATCH] Testing (#107) - Upgrade to upstream v.1.17.0 - Upgrade to PHP7.3 - Small typo stuff --- README.md | 4 +-- check_process | 6 ++-- conf/app.src | 4 +-- conf/freshrss.cron | 2 +- conf/nginx.conf | 5 ++-- conf/php-fpm.conf | 2 +- manifest.json | 8 ++--- scripts/_common.sh | 8 ++--- scripts/backup | 12 ++++---- scripts/change_url | 14 ++++----- scripts/install | 75 +++++++++++++++++++--------------------------- scripts/remove | 30 ++++++------------- scripts/restore | 32 +++++++++----------- scripts/upgrade | 52 +++++++++++++++----------------- 14 files changed, 107 insertions(+), 147 deletions(-) diff --git a/README.md b/README.md index ce829ab..c53153d 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to An efficient but powerful RSS aggregator with a nice and mobile-friendly design, as well as extension and themes support. -**Shipped version:** 1.16.2 +**Shipped version:** 1.17.0 ## Screenshots @@ -26,7 +26,7 @@ API (mini) How To: * Into your user profile: Settings > profil * Setup an API password * Check the API is working: https://exemple.tld/rss/api/greader.php -* Setup your client with: username: ynh user, password: the password you just setup, url https://exemple.tld/rss/api/greader.php +* Setup your client with: username: ynh user, password: the password you just setup, URL https://exemple.tld/rss/api/greader.php ## Documentation diff --git a/check_process b/check_process index 7494fa0..e2d9c94 100644 --- a/check_process +++ b/check_process @@ -13,7 +13,7 @@ setup_private=0 setup_public=0 upgrade=1 - upgrade=1 from_commit=b89554865459520d7d90a5a666f09f6987f41de6 + upgrade=1 from_commit=0b1c3be0716e4800f2ed6f5b3065f707ed67b6bf backup_restore=1 multi_instance=1 # This test is no longer necessary since the version 2.7 (PR: https://github.com/YunoHost/yunohost/pull/304), you can still do it if your app could be installed with this version. @@ -24,6 +24,6 @@ # If the level 5 (Package linter) is forced to 1. Please add justifications here. Level 5=auto ;;; Upgrade options - ; commit=b89554865459520d7d90a5a666f09f6987f41de6 - name=Tue Jan 29 21:28:14 2019 +0100 update README + ; commit=0b1c3be0716e4800f2ed6f5b3065f707ed67b6bf + name=30 août 2020. Merge pull request #103 from ericgaspar/patch-1 manifest_arg=domain=DOMAIN&path=PATH&admin=USER diff --git a/conf/app.src b/conf/app.src index 779967c..f17562a 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/FreshRSS/FreshRSS/archive/1.16.2.tar.gz -SOURCE_SUM=6b8d87f0e594b4ef33ca3a9f94db3033d9307ae71190a2bfc4fadad432a50776 +SOURCE_URL=https://github.com/FreshRSS/FreshRSS/archive/1.17.0.tar.gz +SOURCE_SUM=57c52a15c5f4739e53db606ad652cd446a244676d2a19b2871fe6bee00b75524 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/conf/freshrss.cron b/conf/freshrss.cron index 659ed47..d028b31 100644 --- a/conf/freshrss.cron +++ b/conf/freshrss.cron @@ -1 +1 @@ -*/10 * * * * __APP__ /usr/bin/php7.0 __FINALPATH__/app/actualize_script.php >/tmp/__APP__.log 2>&1 +*/10 * * * * __APP__ /usr/bin/php__PHPVERSION__ __FINALPATH__/app/actualize_script.php >/tmp/__APP__.log 2>&1 diff --git a/conf/nginx.conf b/conf/nginx.conf index 4cc8174..f1cc745 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -5,12 +5,12 @@ location __PATH__/ { rewrite ^ https://$server_name$request_uri? permanent; } -### Example PHP configuration (remove it if not used) index index.html index.php; + try_files $uri $uri/ /index.php?$args; 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; include fastcgi_params; @@ -18,5 +18,4 @@ location __PATH__/ { fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $request_filename; } -### End of PHP configuration part } diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf index 2052aa6..9b2ecce 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 b8f3cc5..eb4f200 100644 --- a/manifest.json +++ b/manifest.json @@ -3,10 +3,10 @@ "id": "freshrss", "packaging_format": 1, "description": { - "en": "An RSS aggregator with a nice and mobile-friendly design", - "fr": "Un agrégateur de flux RSS avec une interface adaptée au mobile" + "en": "RSS aggregator with a nice and mobile-friendly design", + "fr": "Agrégateur de flux RSS avec une interface adaptée au mobile" }, - "version": "1.16.2~ynh1", + "version": "1.17.0~ynh1", "url": "http://freshrss.org/", "license": "AGPL-3.0-only", "maintainer": { @@ -14,7 +14,7 @@ "email": "plopoyop@gmail.com" }, "requirements": { - "yunohost": ">= 3.5" + "yunohost": ">= 3.8.1" }, "multi_instance": true, "services": [ diff --git a/scripts/_common.sh b/scripts/_common.sh index b1610b5..dae184e 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,11 +4,9 @@ # COMMON VARIABLES #================================================= -if [ "$(lsb_release --codename --short)" == "jessie" ]; then - pkg_dependencies="php5-gd" -else - pkg_dependencies="php-gd php-zip php-dom php-mbstring php-gmp php-sqlite3 php-curl php-intl php-xml" -fi +YNH_PHP_VERSION="7.3" + +extra_php_dependencies="php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-dom php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-gmp php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-xml" #================================================= # PERSONAL HELPERS diff --git a/scripts/backup b/scripts/backup index f957038..6daad65 100755 --- a/scripts/backup +++ b/scripts/backup @@ -26,34 +26,34 @@ 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_print_info --message="Backing up the main app directory..." ynh_backup --src_path="$final_path" #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= -ynh_print_info --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_print_info --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_print_info --message="Backing up the MySQL database..." ynh_mysql_dump_db --database="$db_name" > db.sql diff --git a/scripts/change_url b/scripts/change_url index 40f2601..3494afb 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -21,11 +21,10 @@ new_path=$YNH_APP_NEW_PATH app=$YNH_APP_INSTANCE_NAME - #================================================= # LOAD SETTINGS #================================================= -ynh_print_info --message="Loading installation settings..." +ynh_script_progression --message="Loading installation settings..." # Needed for helper "ynh_add_nginx_config" final_path=$(ynh_app_setting_get --app=$app --key=final_path) @@ -46,7 +45,6 @@ if [ -z $admin ]; then ynh_app_setting_set $app admin $admin fi - #================================================= # CHECK PATHS SYNTAX #================================================= @@ -77,7 +75,7 @@ fi #================================================= # MODIFY URL IN NGINX CONF FILE #================================================= -ynh_print_info --message="Updating nginx web server configuration..." +ynh_script_progression --message="Updating NGINX web server configuration..." nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf @@ -107,19 +105,17 @@ fi $final_path/cli/reconfigure.php --auth_type http_auth --environment production --base_url https://$domain$path_url --title FreshRSS --api_enabled --db-type mysql --db-host localhost --db-user $db_name --db-password $db_pwd --db-base $db_name -#================================================= - - #================================================= # GENERIC FINALIZATION #================================================= # RELOAD NGINX #================================================= -ynh_print_info --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading NGINX web server..." + ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT #================================================= -ynh_print_info --message="Change of URL completed for $app" +ynh_script_progression --message="Change of URL completed for $app" diff --git a/scripts/install b/scripts/install index a271d72..9f66a19 100755 --- a/scripts/install +++ b/scripts/install @@ -30,7 +30,7 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -ynh_print_info --message="Validating installation parameters..." +ynh_script_progression --message="Validating installation parameters..." final_path=/var/www/$app test ! -e "$final_path" || ynh_die --message="This path already contains a folder" @@ -41,28 +41,17 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_print_info --message="Storing installation settings..." +ynh_script_progression --message="Storing installation settings..." ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=admin --value=$admin ynh_app_setting_set --app=$app --key=language --value=$language -#================================================= -# STANDARD MODIFICATIONS -#================================================= - -#================================================= -# INSTALL DEPENDENCIES -#================================================= -ynh_print_info --message="Installing dependencies..." - -ynh_install_app_dependencies $pkg_dependencies - #================================================= # CREATE A MYSQL DATABASE #================================================= -ynh_print_info --message="Creating a MySQL database..." +ynh_script_progression --message="Creating a MySQL database..." db_name=$(ynh_sanitize_dbid --db_name=$app) db_user=$db_name @@ -72,11 +61,7 @@ ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_print_info --message="Setting up source files..." - -### `ynh_setup_source` is used to install an app from a zip or tar.gz file, -### downloaded from an upstream source, like a git repository. -### `ynh_setup_source` use the file conf/app.src +ynh_script_progression --message="Setting up source files..." ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src @@ -85,17 +70,15 @@ ynh_setup_source --dest_dir="$final_path" #================================================= # NGINX CONFIGURATION #================================================= -ynh_print_info --message="Configuring nginx web server..." +ynh_script_progression --message="Configuring NGINX web server..." -### `ynh_add_nginx_config` will use the file conf/nginx.conf - -# Create a dedicated nginx config +# Create a dedicated NGINX config ynh_add_nginx_config #================================================= # CREATE DEDICATED USER #================================================= -ynh_print_info --message="Configuring system user..." +ynh_script_progression --message="Configuring system user..." # Create a system user ynh_system_user_create --username=$app @@ -103,26 +86,32 @@ ynh_system_user_create --username=$app #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_print_info --message="Configuring php-fpm..." +ynh_script_progression --message="Configuring PHP-FPM..." -# Create a dedicated php-fpm config -ynh_add_fpm_config +# Create a dedicated PHP-FPM config +ynh_add_fpm_config --package="$extra_php_dependencies" +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # SPECIFIC SETUP #================================================= -ynh_replace_string "APPNAMETOCHANGE" $app ../hooks/post_app_addaccess -ynh_replace_string "APPNAMETOCHANGE" $app ../hooks/post_user_create -ynh_replace_string "APPNAMETOCHANGE" $app ../hooks/post_user_delete +ynh_replace_string --match_string="APPNAMETOCHANGE" --replace_string=$app --target_file="../hooks/post_app_addaccess" +ynh_replace_string --match_string="APPNAMETOCHANGE" --replace_string=$app --target_file="../hooks/post_user_create" +ynh_replace_string --match_string="APPNAMETOCHANGE" --replace_string=$app --target_file="../hooks/post_user_delete" + +#================================================= # SETUPING FRESHRSS #================================================= -ynh_print_info --message="FreshRSS setup script..." +ynh_script_progression --message="FreshRSS setup script..." $final_path/cli/do-install.php --default_user $admin --auth_type http_auth --environment production --base_url https://$domain$path_url --title FreshRSS --api_enabled --db-type mysql --db-host localhost --db-user $db_name --db-password $db_pwd --db-base $db_name -# Add users -ynh_print_info --message="Creating users..." +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Creating users..." + for myuser in $(ynh_user_list) do user_token=$(ynh_string_random) @@ -132,17 +121,17 @@ done #================================================= # SETUP A CRON #================================================= -ynh_print_info --message="Setting up cron..." +ynh_script_progression --message="Setting up cron..." cron_path="/etc/cron.d/$app" + ynh_replace_string --match_string="__FINALPATH__" --replace_string=$final_path --target_file="../conf/freshrss.cron" ynh_replace_string --match_string="__APP__" --replace_string=$app --target_file="../conf/freshrss.cron" +ynh_replace_string --match_string="__PHPVERSION__" --replace_string=$phpversion --target_file="../conf/freshrss.cron" + cp ../conf/freshrss.cron "$cron_path" chmod 644 "$cron_path" -#================================================= - - #================================================= # GENERIC FINALIZATION #================================================= @@ -151,25 +140,22 @@ chmod 644 "$cron_path" # Set permissions to app files chown -R root: $final_path -chown -R $app: $final_path/data/ -chown -R $app: $final_path/extensions/ - +chown -R $app: $final_path/{data,extensions} #================================================= # SETUP SSOWAT #================================================= -ynh_print_info --message="Configuring SSOwat..." +ynh_script_progression --message="Configuring SSOwat..." #skip api directory ynh_app_setting_set --app="$app" --key=skipped_uris --value="/api/,/scripts/api.js" ynh_app_setting_delete --app="$app" --key=unprotected_regex ynh_app_setting_delete --app="$app" --key=unprotected_uris - #================================================= # RELOAD NGINX #================================================= -ynh_print_info --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading NGINX web server..." ynh_systemd_action --service_name=nginx --action=reload @@ -177,4 +163,5 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_print_info --message="Installation of $app completed" +ynh_script_progression --message="Installation of $app completed" --last + diff --git a/scripts/remove b/scripts/remove index 4b189f5..f699b50 100755 --- a/scripts/remove +++ b/scripts/remove @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_print_info --message="Loading installation settings..." +ynh_script_progression --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -21,30 +21,18 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name final_path=$(ynh_app_setting_get --app=$app --key=final_path) -#================================================= -# STANDARD REMOVE -#================================================= - #================================================= # REMOVE THE MYSQL DATABASE #================================================= -ynh_print_info --message="Removing the MySQL database..." +ynh_script_progression --message="Removing the MySQL database..." # Remove a database if it exists, along with the associated user ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_print_info --message="Removing dependencies..." - -# Remove metapackage and its dependencies -ynh_remove_app_dependencies - #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_print_info --message="Removing app main directory..." +ynh_script_progression --message="Removing $app main directory..." # Remove the app directory securely ynh_secure_remove --file="$final_path" @@ -52,17 +40,17 @@ ynh_secure_remove --file="$final_path" #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_print_info --message="Removing nginx web server configuration..." +ynh_script_progression --message="Removing NGINX web server configuration..." -# Remove the dedicated nginx config +# Remove the dedicated NGINX config ynh_remove_nginx_config #================================================= # REMOVE PHP-FPM CONFIGURATION #================================================= -ynh_print_info --message="Removing php-fpm configuration..." +ynh_script_progression --message="Removing PHP-FPM configuration..." -# Remove the dedicated php-fpm config +# Remove the dedicated PHP-FPM config ynh_remove_fpm_config #================================================= @@ -79,7 +67,7 @@ ynh_secure_remove "/etc/cron.d/$app" #================================================= # REMOVE DEDICATED USER #================================================= -ynh_print_info --message="Removing the dedicated system user..." +ynh_script_progression --message="Removing the dedicated system user..." # Delete a system user ynh_system_user_delete --username=$app @@ -88,4 +76,4 @@ ynh_system_user_delete --username=$app # END OF SCRIPT #================================================= -ynh_print_info --message="Removal of $app completed" +ynh_script_progression --message="Removal of $app completed" diff --git a/scripts/restore b/scripts/restore index a582fe5..fa75827 100644 --- a/scripts/restore +++ b/scripts/restore @@ -19,7 +19,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_print_info --message="Loading settings..." +ynh_script_progression --message="Loading settings..." app=$YNH_APP_INSTANCE_NAME @@ -28,11 +28,12 @@ path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= -ynh_print_info --message="Validating restoration parameters..." +ynh_script_progression --message="Validating restoration parameters..." ynh_webpath_available --domain=$domain --path_url=$path_url \ || ynh_die --message="Path not available: ${domain}${path_url}" @@ -44,21 +45,21 @@ test ! -d $final_path \ #================================================= # RESTORE THE NGINX CONFIGURATION #================================================= -ynh_print_info --message="Restoring nginx configuration..." +ynh_script_progression --message="Restoring NGINX configuration..." ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_print_info --message="Restoring the app main directory..." +ynh_script_progression --message="Restoring the app main directory..." ynh_restore_file --origin_path="$final_path" #================================================= # RECREATE THE DEDICATED USER #================================================= -ynh_print_info --message="Recreating the dedicated system user..." +ynh_script_progression --message="Recreating the dedicated system user..." # Create the dedicated user (if not existing) ynh_system_user_create --username=$app @@ -75,23 +76,18 @@ chown -R $app: $final_path/extensions/ #================================================= # RESTORE THE PHP-FPM CONFIGURATION #================================================= +ynh_script_progression --message="Reconfiguring PHP-FPM..." --weight=5 -ynh_restore_file --origin_path="/etc/php/7.0/fpm/pool.d/$app.conf" +ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" + +ynh_add_fpm_config --package="$extra_php_dependencies" #================================================= # SPECIFIC RESTORATION -#================================================= -# REINSTALL DEPENDENCIES -#================================================= -ynh_print_info --message="Reinstalling dependencies..." - -# Define and install dependencies -ynh_install_app_dependencies $pkg_dependencies - #================================================= # RESTORE THE MYSQL DATABASE #================================================= -ynh_print_info --message="Restoring the MySQL database..." +ynh_script_progression --message="Restoring the MySQL database..." db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd @@ -108,13 +104,13 @@ ynh_restore_file --origin_path="/etc/cron.d/$app" #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -ynh_print_info --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_print_info --message="Restoration completed for $app" +ynh_script_progression --message="Restoration completed for $app" diff --git a/scripts/upgrade b/scripts/upgrade index 886e5c9..c50675e 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_print_info --message="Loading installation settings..." +ynh_script_progression --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -23,6 +23,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) language=$(ynh_app_setting_get --app=$app --key=language) db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # CHECK VERSION @@ -33,7 +34,7 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= -ynh_print_info --message="Ensuring downward compatibility..." +ynh_script_progression --message="Ensuring downward compatibility..." # If db_name doesn't exist, create it if [ -z "$db_name" ]; then @@ -59,7 +60,7 @@ fi #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_print_info --message="Backing up the app before upgrading (may take a while)..." +ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." # Backup the current version of the app ynh_backup_before_upgrade @@ -82,7 +83,7 @@ path_url=$(ynh_normalize_url_path --path_url=$path_url) #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_print_info --message="Upgrading source files..." +ynh_script_progression --message="Upgrading source files..." # Download, check integrity, uncompress and patch the source from app.src # into tmp dir @@ -92,33 +93,26 @@ ynh_setup_source "$tmp_path" #================================================= # NGINX CONFIGURATION #================================================= -ynh_print_info --message="Upgrading nginx web server configuration..." +ynh_script_progression --message="Upgrading NGINX web server configuration..." # Create a dedicated nginx config ynh_add_nginx_config -#================================================= -# UPGRADE DEPENDENCIES -#================================================= -ynh_print_info --message="Upgrading dependencies..." - -ynh_install_app_dependencies $pkg_dependencies - #================================================= # CREATE DEDICATED USER #================================================= -ynh_print_info --message="Making sure dedicated system user exists..." +ynh_script_progression --message="Making sure dedicated system user exists..." # Create a dedicated user (if not existing) -ynh_system_user_create $app +ynh_system_user_create --username=$app #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_print_info --message="Upgrading php-fpm configuration..." +ynh_script_progression --message="Upgrading PHP-FPM configuration..." -# Create a dedicated php-fpm config -ynh_add_fpm_config +# Create a dedicated PHP-FPM config +ynh_add_fpm_config --package="$extra_php_dependencies" #================================================= # SPECIFIC UPGRADE @@ -141,18 +135,21 @@ ynh_secure_remove "$final_path" cp -rp "$tmp_path" "$final_path" #update hook for multi instance -ynh_replace_string "APPNAMETOCHANGE" $app ../hooks/post_app_addaccess -ynh_replace_string "APPNAMETOCHANGE" $app ../hooks/post_user_create -ynh_replace_string "APPNAMETOCHANGE" $app ../hooks/post_user_delete +ynh_replace_string --match_string="APPNAMETOCHANGE" --replace_string=$app --target_file="../hooks/post_app_addaccess" +ynh_replace_string --match_string="APPNAMETOCHANGE" --replace_string=$app --target_file="../hooks/post_user_create" +ynh_replace_string --match_string="APPNAMETOCHANGE" --replace_string=$app --target_file="../hooks/post_user_delete" #================================================= # CRON SETUP #================================================= -ynh_print_info --message="Setting up cron..." +ynh_script_progression --message="Setting up cron..." cron_path="/etc/cron.d/$app" -ynh_replace_string "__FINALPATH__" $final_path ../conf/freshrss.cron -ynh_replace_string "__APP__" $app ../conf/freshrss.cron + +ynh_replace_string --match_string="__FINALPATH__" --replace_string=$final_path --target_file="../conf/freshrss.cron" +ynh_replace_string --match_string="__APP__" --replace_string=$app --target_file="../conf/freshrss.cron" +ynh_replace_string --match_string="__PHPVERSION__" --replace_string=$phpversion --target_file="../conf/freshrss.cron" + cp ../conf/freshrss.cron "$cron_path" chmod 644 "$cron_path" @@ -169,8 +166,7 @@ fi # Set permissions on app files chown -R root: $final_path chmod 755 $final_path -chown -R $app: $final_path/data/ -chown -R $app: $final_path/extensions/ +chown -R $app: $final_path/{data,extensions} # reconfigure application with latest parameters $final_path/cli/reconfigure.php --default_user $admin --auth_type http_auth --environment production --base_url https://$domain$path_url --title FreshRSS --api_enabled --db-type mysql --db-host localhost --db-user $db_name --db-password $db_pwd --db-base $db_name @@ -178,7 +174,7 @@ $final_path/cli/reconfigure.php --default_user $admin --auth_type http_auth --en #================================================= # SETUP SSOWAT #================================================= -ynh_print_info --message="Upgrading SSOwat configuration..." +ynh_script_progression --message="Upgrading SSOwat configuration..." ynh_app_setting_set --app="$app" --key=skipped_uris --value="/api/,/scripts/api.js" ynh_app_setting_delete --app="$app" --key=unprotected_regex @@ -187,7 +183,7 @@ ynh_app_setting_delete --app="$app" --key=unprotected_uris #================================================= # RELOAD NGINX #================================================= -ynh_print_info --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading NGINX web server..." ynh_systemd_action --service_name=nginx --action=reload @@ -195,4 +191,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_print_info --message="Upgrade of $app completed" +ynh_script_progression --message="Upgrade of $app completed"