From c016b7ce3146659870bd357e20428a2c7bf28ff3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 26 Dec 2020 19:51:35 +0100 Subject: [PATCH] Testing (#3) * Upgrade to v.3.0.0 --- README.md | 4 +-- README_fr.md | 73 +++++++++++++++++++++++++++++++++++++++++++++++++ check_process | 2 +- conf/app.src | 4 +-- conf/nginx.conf | 2 +- manifest.json | 12 +++++--- scripts/install | 4 +-- scripts/remove | 18 ------------ scripts/restore | 19 +++++++------ scripts/upgrade | 50 ++++++++++++++++++--------------- 10 files changed, 126 insertions(+), 62 deletions(-) create mode 100644 README_fr.md diff --git a/README.md b/README.md index 531ad06..b7a1033 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Grocy for YunoHost [![Integration level](https://dash.yunohost.org/integration/grocy.svg)](https://dash.yunohost.org/appci/app/grocy) ![](https://ci-apps.yunohost.org/ci/badges/grocy.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/grocy.maintain.svg) -[![Install Mantis with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=grocy) +[![Install Grocy with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=grocy) *[Lire ce readme en français.](./README_fr.md)* @@ -11,7 +11,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in ## Overview Grocy is a web-based self-hosted groceries & household management solution for your home. -**Shipped version:** 2.7.1 +**Shipped version:** 3.0.0 ## Screenshots diff --git a/README_fr.md b/README_fr.md new file mode 100644 index 0000000..3287b27 --- /dev/null +++ b/README_fr.md @@ -0,0 +1,73 @@ +# Grocy pour YunoHost + +[![Niveau d'intégration](https://dash.yunohost.org/integration/grocy.svg)](https://dash.yunohost.org/appci/app/grocy) ![](https://ci-apps.yunohost.org/ci/badges/grocy.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/grocy.maintain.svg) +[![Install Grocy with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=grocy) + +*[Read this readme in english.](./README.md)* + +> *Ce package vous permet d'installer Grocy rapidement et simplement sur un serveur YunoHost. +Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/#/install) pour apprendre comment l'installer.* + +## Vue d'ensemble +Grocy is a web-based self-hosted groceries & household management solution for your home. + +**Version incluse :** 3.0.0 + +## Captures d'écran + +![](https://grocy.info/img/grocy-desktop-en.png) + +## Démo + +* [Démo officielle](https://en.demo.grocy.info/stockoverview) + +## Configuration + + Default login + user: **admin** + password: **admin** + +## Documentation + + * Documentation officielle : Lien vers la documentation officielle de cette application. + * Documentation YunoHost : Si une documentation spécifique est nécessaire, n'hésitez pas à contribuer. + +## Caractéristiques spécifiques YunoHost + +#### Support multi-utilisateur + +* L'authentification LDAP et HTTP est-elle prise en charge ? +* L'application peut-elle être utilisée par plusieurs utilisateurs ? + +#### Supported architectures + +* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/grocy%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/grocy/) +* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/grocy%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/grocy/) + +## Limitations + +* Limitations connues. + +## Informations additionnelles + +* Autres informations que vous souhaitez ajouter sur cette application. + +## Liens + + * Signaler un bug : https://github.com/YunoHost-Apps/grocy_ynh/issues + * Site de l'application : https://grocy.info/ + * Dépôt de l'application principale : https://github.com/grocy/grocy + * Site web YunoHost : https://yunohost.org/ + +--- + +## Informations pour les développeurs + +Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/grocy_ynh/tree/testing). + +Pour essayer la branche testing, procédez comme suit. +``` +sudo yunohost app install https://github.com/YunoHost-Apps/grocy_ynh/tree/testing --debug +or +sudo yunohost app upgrade grocy -u https://github.com/YunoHost-Apps/grocy_ynh/tree/testing --debug +``` diff --git a/check_process b/check_process index c309eb9..f22c51d 100644 --- a/check_process +++ b/check_process @@ -12,7 +12,7 @@ is_public=1 (PUBLIC|public=1|private=0) ; Checks pkg_linter=1 - setup_sub_dir=1 + setup_sub_dir=0 setup_root=1 setup_nourl=0 setup_private=1 diff --git a/conf/app.src b/conf/app.src index c73adaa..0174290 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/grocy/grocy/releases/download/v2.7.1/grocy_2.7.1.zip -SOURCE_SUM=f95cc2cc279a6445738ef9b5cc05a8cee438348d343081a76a6aa74464f76129 +SOURCE_URL=https://github.com/grocy/grocy/releases/download/v3.0.0/grocy_3.0.0.zip +SOURCE_SUM=3bb0e4b1f03de481ef2c9c91ad61bc88409c5140ec3adcad77bf24a0d65d4331 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=false diff --git a/conf/nginx.conf b/conf/nginx.conf index 0ab9560..8cb9e61 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -11,7 +11,7 @@ location / { index index.php; try_files $uri __PATH__/index.php; - + location ~ [^/]\.php(/|$) { fastcgi_split_path_info ^(.+?\.php)(/.*)$; fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock; diff --git a/manifest.json b/manifest.json index 6303a02..44e66c0 100644 --- a/manifest.json +++ b/manifest.json @@ -3,10 +3,10 @@ "id": "grocy", "packaging_format": 1, "description": { - "en": "Issue tracker that provides a balance between simplicity and power", - "fr": "Gestionnaire de ticket avec un équilibre entre simplicité et puissance" + "en": "Web-based self-hosted groceries & household management solution for your home", + "fr": "Solution Web auto-hébergée de gestion d'épicerie et de gestion de la maison" }, - "version": "2.7.1~ynh1", + "version": "3.0.0~ynh1", "url": "https://github.com/grocy/grocy", "license": "MIT", "maintainer": { @@ -48,7 +48,7 @@ "en": "Choose the application language", "fr": "Choisissez la langue de l'application" }, - "choices": ["fr", "en"], + "choices": ["de", "en", "es", "fr", "it", "pt"], "default": "fr" }, { @@ -58,6 +58,10 @@ "en": "Is it a public site?", "fr": "Est-ce un site public ?" }, + "help": { + "en": "If enabled, Grocy will be accessible by people who do not have an account. This can be changed later via the webadmin.", + "fr": "Si cette case est cochée, Grocy sera accessible aux personnes n’ayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin." + }, "default": true } ] diff --git a/scripts/install b/scripts/install index d666990..f5646f2 100644 --- a/scripts/install +++ b/scripts/install @@ -88,10 +88,7 @@ phpversion=$(ynh_app_setting_get --app="$app" --key=phpversion) cp -a ../conf/config-dist.php "$final_path/data/config.php" -#ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/data/config.php" -#ynh_replace_string --match_string="__PATH_URL__" --replace_string="$path_url" --target_file="$final_path/data/config.php" ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" --target_file="$final_path/data/config.php" -#ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$final_path/data/config.php" #================================================= # STORE THE CONFIG FILE CHECKSUM @@ -107,6 +104,7 @@ ynh_store_file_checksum --file="$final_path/data/config.php" # Set permissions to app files chown -R $app: $final_path +chmod -R 755 $final_path/data #================================================= # SETUP SSOWAT diff --git a/scripts/remove b/scripts/remove index 220a43d..7ee6368 100644 --- a/scripts/remove +++ b/scripts/remove @@ -19,24 +19,6 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) final_path=$(ynh_app_setting_get --app=$app --key=final_path) -#================================================= -# STANDARD REMOVE -#================================================= -# STOP AND REMOVE SERVICE -#================================================= -ynh_script_progression --message="Stopping and removing the systemd service" --weight=1 - -# Remove the dedicated systemd config -ynh_remove_systemd_config - -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_script_progression --message="Removing dependencies..." --weight=1 - -# Remove metapackage and its dependencies -ynh_remove_app_dependencies - #================================================= # REMOVE APP MAIN DIR #================================================= diff --git a/scripts/restore b/scripts/restore index 0c671a5..afccc7e 100644 --- a/scripts/restore +++ b/scripts/restore @@ -61,13 +61,6 @@ ynh_script_progression --message="Recreating the dedicated system user..." --wei # Create the dedicated user (if not existing) ynh_system_user_create --username=$app -#================================================= -# RESTORE USER RIGHTS -#================================================= - -# Restore permissions on app files -chown -R $app: $final_path - #================================================= # RESTORE THE PHP-FPM CONFIGURATION #================================================= @@ -75,8 +68,16 @@ ynh_script_progression --message="Restoring PHP-FPM configuration..." ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" -# Recreate a dedicated php-fpm config -ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencies" +# Recreate a dedicated PHP-FPM config +ynh_add_fpm_config --package="$extra_php_dependencies" + +#================================================= +# RESTORE USER RIGHTS +#================================================= + +# Restore permissions on app files +chown -R $app: $final_path +chmod -R 755 $final_path/data #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index d9f323f..ad4ccf2 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -21,7 +21,7 @@ path_url=$(ynh_app_setting_get --app=$app --key=path) is_public=$(ynh_app_setting_get --app=$app --key=is_public) final_path=$(ynh_app_setting_get --app=$app --key=final_path) language=$(ynh_app_setting_get --app=$app --key=language) -phpversion=$(ynh_app_setting_get --app="$app" --key=phpversion) +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # CHECK VERSION @@ -34,15 +34,6 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 -# Fix is_public as a boolean value -if [ "$is_public" = "Yes" ]; then - ynh_app_setting_set --app=$app --key=is_public --value=1 - is_public=1 -elif [ "$is_public" = "No" ]; then - ynh_app_setting_set --app=$app --key=is_public --value=0 - is_public=0 -fi - # If final_path doesn't exist, create it if [ -z "$final_path" ]; then final_path=/var/www/$app @@ -71,8 +62,23 @@ if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading source files..." --weight=5 - # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$final_path" + # Create a temporary directory + tmpdir="$(mktemp -d)" + + # Backup the config file in the temp dir + cp -R "$final_path/data" "$tmpdir/data" + + # Remove the app directory securely + ynh_secure_remove --file="$final_path" + + # Download, check integrity, uncompress and patch the source from app.src + ynh_setup_source --dest_dir="$final_path" + + # Copy the admin saved settings from tmp directory to final path + cp -RT "$tmpdir/data" "$final_path/data" + + # Remove the tmp directory securely + ynh_secure_remove --file="$tmpdir" fi #================================================= @@ -91,13 +97,6 @@ ynh_script_progression --message="Making sure dedicated system user exists..." - # Create a dedicated user (if not existing) ynh_system_user_create --username=$app -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= - -# Set permissions to app files -chown -R $app: $final_path - #================================================= # PHP-FPM CONFIGURATION #================================================= @@ -110,12 +109,19 @@ ynh_add_fpm_config --package="$extra_php_dependencies" # MODIFY A CONFIG FILE #================================================= -cp -a ../conf/config-dist.php "$final_path/config-dist.php" +cp -a ../conf/config-dist.php "$final_path/data/config.php" -#ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/data/config.php" -#ynh_replace_string --match_string="__PATH_URL__" --replace_string="$path_url" --target_file="$final_path/data/config.php" ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" --target_file="$final_path/data/config.php" + +#================================================= +# SECURE FILES AND DIRECTORIES +#================================================= + +# Set permissions to app files +chown -R $app: $final_path +chmod -R 755 $final_path/data + #================================================= # RELOAD NGINX #=================================================