From 2459ba73d0d5c53852d0fba8e1feb0401f1db8ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 16 Nov 2021 10:39:20 +0100 Subject: [PATCH] Testing (#25) * Upgrade to v.3.1.3 --- README.md | 2 +- README_fr.md | 2 +- conf/app.src | 4 ++-- manifest.json | 4 ++-- scripts/_common.sh | 2 +- scripts/backup | 2 +- scripts/install | 13 +++++++++++-- scripts/restore | 13 ++++++++++--- scripts/upgrade | 43 +++++++++++++++++++++++++------------------ 9 files changed, 54 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 54fd7ad..8da0a91 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Web-based groceries & household management solution for your home -**Shipped version:** 3.1.2~ynh2 +**Shipped version:** 3.1.3~ynh1 **Demo:** https://en.demo.grocy.info/stockoverview diff --git a/README_fr.md b/README_fr.md index 6924bd5..c9f491e 100644 --- a/README_fr.md +++ b/README_fr.md @@ -13,7 +13,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour Solution Web de gestion d'épicerie et de gestion de la maison -**Version incluse :** 3.1.2~ynh2 +**Version incluse :** 3.1.3~ynh1 **Démo :** https://en.demo.grocy.info/stockoverview diff --git a/conf/app.src b/conf/app.src index 7054907..9a1bd48 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/grocy/grocy/releases/download/v3.1.2/grocy_3.1.2.zip -SOURCE_SUM=2b0d940378c911f18fafd8cc9c3989e065bcedfc0cf34a50a6a4f3f6e817ce8c +SOURCE_URL=https://github.com/grocy/grocy/releases/download/v3.1.3/grocy_3.1.3.zip +SOURCE_SUM=eaf82757d1d01f02465071b100c5f15d78848f690d4d6a867079e93c7be66bf4 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=false diff --git a/manifest.json b/manifest.json index b02f4f5..44da7f4 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Web-based groceries & household management solution for your home", "fr": "Solution Web de gestion d'épicerie et de gestion de la maison" }, - "version": "3.1.2~ynh2", + "version": "3.1.3~ynh1", "url": "https://grocy.info", "upstream": { "license": "MIT", @@ -20,7 +20,7 @@ "email": "" }, "requirements": { - "yunohost": ">= 4.2.4" + "yunohost": ">= 4.3.0" }, "multi_instance": true, "services": [ diff --git a/scripts/_common.sh b/scripts/_common.sh index 87667cd..f058cd3 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -6,7 +6,7 @@ YNH_PHP_VERSION="8.0" -extra_php_dependencies="php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-fileinfo php${YNH_PHP_VERSION}-sqlite3 php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-intl" +pkg_dependencies="php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-fileinfo php${YNH_PHP_VERSION}-sqlite3 php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-intl" #================================================= # PERSONAL HELPERS diff --git a/scripts/backup b/scripts/backup index 2a2b65e..2d90ed5 100644 --- a/scripts/backup +++ b/scripts/backup @@ -25,7 +25,7 @@ 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) -phpversion=$YNH_PHP_VERSION +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP diff --git a/scripts/install b/scripts/install index 5b5560f..5202159 100644 --- a/scripts/install +++ b/scripts/install @@ -24,6 +24,7 @@ domain=$YNH_APP_ARG_DOMAIN path_url="/" is_public=$YNH_APP_ARG_IS_PUBLIC language=$YNH_APP_ARG_LANGUAGE +phpversion=$YNH_PHP_VERSION app=$YNH_APP_INSTANCE_NAME @@ -47,6 +48,13 @@ 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=language --value=$language +#================================================= +# INSTALL DEPENDENCIES +#================================================= +ynh_script_progression --message="Installing dependencies..." --weight=1 + +ynh_install_app_dependencies $pkg_dependencies + #================================================= # CREATE DEDICATED USER #================================================= @@ -82,12 +90,13 @@ ynh_add_nginx_config ynh_script_progression --message="Configuring PHP-FPM..." --weight=3 # Create a dedicated PHP-FPM config -ynh_add_fpm_config --package="$extra_php_dependencies" -phpversion=$YNH_PHP_VERSION +ynh_add_fpm_config +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # MODIFY A CONFIG FILE #================================================= +ynh_script_progression --message="Adding a configuration file..." --weight=1 ynh_add_config --template="../conf/config-dist.php" --destination="$final_path/data/config.php" diff --git a/scripts/restore b/scripts/restore index f5fd81c..c1a8324 100644 --- a/scripts/restore +++ b/scripts/restore @@ -63,15 +63,22 @@ chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" +#================================================= +# REINSTALL DEPENDENCIES +#================================================= +ynh_script_progression --message="Reinstalling dependencies..." --weight=1 + +# Define and install dependencies +ynh_install_app_dependencies $pkg_dependencies + #================================================= # RESTORE THE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Restoring PHP-FPM configuration..." +ynh_script_progression --message="Restoring PHP-FPM configuration..." --weight=1 ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" - # Recreate a dedicated PHP-FPM config -ynh_add_fpm_config --package="$extra_php_dependencies" +#ynh_add_fpm_config #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index 033dfe7..a17e175 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -28,6 +28,20 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) upgrade_type=$(ynh_check_app_version_changed) +#================================================= +# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +#================================================= +ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=5 + +# Backup the current version of the app +ynh_backup_before_upgrade +ynh_clean_setup () { + # restore it if the upgrade fails + ynh_restore_upgradebackup +} +# Exit if an error occurs during the execution of the script +ynh_abort_if_errors + #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= @@ -47,18 +61,12 @@ if ynh_legacy_permissions_exists; then fi #================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +# CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=5 +ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 -# Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { - # restore it if the upgrade fails - ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors +# Create a dedicated user (if not existing) +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -85,12 +93,11 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." - ynh_add_nginx_config #================================================= -# CREATE DEDICATED USER +# UPGRADE DEPENDENCIES #================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 +ynh_script_progression --message="Upgrading dependencies..." --weight=1 -# Create a dedicated user (if not existing) -ynh_system_user_create --username=$app +ynh_install_app_dependencies $pkg_dependencies #================================================= # PHP-FPM CONFIGURATION @@ -98,16 +105,16 @@ ynh_system_user_create --username=$app ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1 # Create a dedicated php-fpm config -ynh_add_fpm_config --package="$extra_php_dependencies" +ynh_add_fpm_config #================================================= # MODIFY A CONFIG FILE #================================================= -ynh_add_config --template="../conf/config-dist.php" --destination="$final_path/data/config.php" +#ynh_add_config --template="../conf/config-dist.php" --destination="$final_path/data/config.php" -chmod 400 "$final_path/data/config.php" -chown $app "$final_path/data/config.php" +#chmod 400 "$final_path/data/config.php" +#chown $app "$final_path/data/config.php" #================================================= # RELOAD NGINX