From 7ae2307abf08ab3c0dcef09ea55663b487319461 Mon Sep 17 00:00:00 2001
From: oversu <95a7002b-481b-4ef3-b578-f9c421550aa4@localhost>
Date: Fri, 4 Sep 2026 12:23:03 +0200
Subject: [PATCH] =?UTF-8?q?Aligner=20le=20paquet=20sur=20le=20mod=C3=A8le?=
=?UTF-8?q?=20YunoHost?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.editorconfig | 11 +++++++
.gitattributes | 2 ++
.github/ISSUE_TEMPLATE.md | 55 ++++++++++++++++++++++++++++++++
.github/PULL_REQUEST_TEMPLATE.md | 16 ++++++++++
README.md | 51 ++++++++++++++++++++---------
doc/ADMIN.md | 3 ++
doc/ADMIN_fr.md | 3 ++
manifest.toml | 5 ++-
scripts/_common.sh | 28 ++++++++--------
scripts/backup | 15 +++++++++
scripts/change_url | 19 +++++++++++
scripts/install | 41 ++++++++++++++++++++++--
scripts/remove | 20 +++++++++++-
scripts/restore | 29 ++++++++++++++++-
scripts/upgrade | 37 ++++++++++++++++++++-
tests.toml | 4 +++
16 files changed, 303 insertions(+), 36 deletions(-)
create mode 100644 .editorconfig
create mode 100644 .gitattributes
create mode 100644 .github/ISSUE_TEMPLATE.md
create mode 100644 .github/PULL_REQUEST_TEMPLATE.md
create mode 100644 doc/ADMIN.md
create mode 100644 doc/ADMIN_fr.md
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..43280ce
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,11 @@
+root = true
+
+[*]
+charset = utf-8
+end_of_line = lf
+insert_final_newline = true
+indent_style = space
+indent_size = 4
+
+[*.toml]
+indent_size = 4
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..d0d6371
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,2 @@
+* text=auto eol=lf
+*.png binary
diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md
new file mode 100644
index 0000000..2729a6b
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE.md
@@ -0,0 +1,55 @@
+---
+name: Bug report
+about: When creating a bug report, please use the following template to provide all the relevant information and help debugging efficiently.
+
+---
+
+**How to post a meaningful bug report**
+1. *Read this whole template first.*
+2. *Determine if you are on the right place:*
+ - *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!*
+ - *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.*
+ - *When in doubt, post here and we will figure it out together.*
+3. *Delete the italic comments as you write over them below, and remove this guide.*
+---
+
+### Describe the bug
+
+*A clear and concise description of what the bug is.*
+
+### Context
+
+- Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...*
+- YunoHost version: x.x.x
+- I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...*
+- Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: *no / yes*
+ - If yes, please explain:
+- Using, or trying to install package version/branch:
+- If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`*
+
+### Steps to reproduce
+
+- *If you performed a command from the CLI, the command itself is enough. For example:*
+ ```sh
+ sudo yunohost app install the_app
+ ```
+- *If you used the webadmin, please perform the equivalent command from the CLI first.*
+- *If the error occurs in your browser, explain what you did:*
+ 1. *Go to '...'*
+ 2. *Click on '...'*
+ 3. *Scroll down to '...'*
+ 4. *See error*
+
+### Expected behavior
+
+*A clear and concise description of what you expected to happen. You can remove this section if the command above is enough to understand your intent.*
+
+### Logs
+
+*When an operation fails, YunoHost provides a simple way to share the logs.*
+- *In the webadmin, the error message contains a link to the relevant log page. On that page, you will be able to 'Share with Yunopaste'. If you missed it, the logs of previous operations are also available under Tools > Logs.*
+- *In command line, the command to share the logs is displayed at the end of the operation and looks like `yunohost log display [log name] --share`. If you missed it, you can find the log ID of a previous operation using `yunohost log list`.*
+
+*After sharing the log, please copypaste directly the link provided by YunoHost (to help readability, no need to copypaste the entire content of the log here, just the link is enough...)*
+
+*If applicable and useful, add screenshots to help explain your problem.*
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
new file mode 100644
index 0000000..ef70e18
--- /dev/null
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,16 @@
+## Problem
+
+- *Description of why you made this PR*
+
+## Solution
+
+- *And how do you fix that problem*
+
+## PR Status
+
+- [ ] Code finished and ready to be reviewed/tested
+- [ ] The fix/enhancement were manually tested (if applicable)
+
+## Automatic tests
+
+Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ *after creating the PR*, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization)
diff --git a/README.md b/README.md
index 80ffb64..e87c3ac 100644
--- a/README.md
+++ b/README.md
@@ -1,25 +1,46 @@
-# Globinours pour YunoHost — 1.0.0-rc.3
+
-
-
-
+
+
+ Globinours, packaged for YunoHost
+
-Ce paquet installe Globinours sur un domaine ou sous-domaine dédié. Il télécharge une archive immuable de l’application depuis le dépôt Forgejo officiel, puis vérifie son empreinte SHA-256 avant installation.
+Lightweight animal shelter management
-## Installation de test
+[](https://globinours.fr)
+[](https://demo.globinours.fr)
+[?style=for-the-badge)](https://ci-apps.yunohost.org/ci/apps/globinours/)
-Depuis un clone du paquet présent sur le serveur YunoHost :
+
+

+

+
-```bash
-sudo yunohost app install /root/globinours_ynh --debug --force --no-remove-on-failure
+## 📦 Developer info
+
+[](https://ci-apps.yunohost.org/ci/apps/globinours/)
+
+🛠️ Upstream Globinours repository:
+
+Pull request are welcome and should target the [`testing` branch](https://github.com/YunoHost-Apps/globinours_ynh/tree/testing).
+
+The `testing` branch can be tested using:
+```
+# fresh install:
+sudo yunohost app install https://github.com/YunoHost-Apps/globinours_ynh/tree/testing
+
+# upgrade an existing install:
+sudo yunohost app upgrade globinours -u https://github.com/YunoHost-Apps/globinours_ynh/tree/testing
```
-Choisir un domaine ou sous-domaine libre. Après l’installation, ouvrir son URL et terminer la création du premier administrateur dans l’assistant Globinours.
-
-Pour tester une mise à niveau du paquet :
-
+You can also switch to the testing branch to update from testing by default (as same as for APT when you chose to use a testing repos) with this command:
```bash
-sudo yunohost app upgrade globinours -u /root/globinours_ynh --debug
+sudo yunohost app setting globinours upgrade_channel -v testing
```
-Globinours utilise ses propres comptes applicatifs : l’intégration LDAP et l’authentification SSO YunoHost ne sont donc pas utilisées.
+### 📚 App packaging documentation
+
+Please see for more information.
diff --git a/doc/ADMIN.md b/doc/ADMIN.md
new file mode 100644
index 0000000..edcc857
--- /dev/null
+++ b/doc/ADMIN.md
@@ -0,0 +1,3 @@
+Globinours stores its persistent data in `__DATA_DIR__` and its application files in `__INSTALL_DIR__`.
+
+The application uses its own user accounts. Open the application settings to manage users, backups and maintenance operations.
diff --git a/doc/ADMIN_fr.md b/doc/ADMIN_fr.md
new file mode 100644
index 0000000..ca300ca
--- /dev/null
+++ b/doc/ADMIN_fr.md
@@ -0,0 +1,3 @@
+Globinours conserve ses données persistantes dans `__DATA_DIR__` et ses fichiers applicatifs dans `__INSTALL_DIR__`.
+
+L’application utilise ses propres comptes. Ouvrez ses paramètres pour gérer les utilisateurs, les sauvegardes et les opérations de maintenance.
diff --git a/manifest.toml b/manifest.toml
index a5aa79c..bfd97ec 100644
--- a/manifest.toml
+++ b/manifest.toml
@@ -5,11 +5,13 @@ id = "globinours"
name = "Globinours"
description.en = "Lightweight animal shelter management"
description.fr = "Gestion légère et complète pour refuges animaliers"
-version = "1.0.0-rc.3~ynh10"
+version = "1.0.0-rc.3~ynh11"
maintainers = ["OverSu"]
[upstream]
license = "AGPL-3.0-or-later"
+website = "https://globinours.fr"
+demo = "https://demo.globinours.fr"
code = "https://nnsprod.com/git/oversu/Globinours"
[integration]
@@ -40,6 +42,7 @@ ram.runtime = "100M"
[resources.system_user]
[resources.install_dir]
[resources.data_dir]
+ subdirs = ["association", "grants", "medical-documents", "private-media", "media", "storage/logs", "storage/backups", "storage/releases"]
[resources.permissions]
main.url = "/"
[resources.apt]
diff --git a/scripts/_common.sh b/scripts/_common.sh
index 92baf57..6999d60 100755
--- a/scripts/_common.sh
+++ b/scripts/_common.sh
@@ -1,31 +1,29 @@
#!/bin/bash
+
+#=================================================
+# COMMON VARIABLES AND CUSTOM HELPERS
+#=================================================
+
source /usr/share/yunohost/helpers
php_upload_max_filesize="250M"
-install_yunohost_logo() {
- install -D -m 0644 "$YNH_APP_BASEDIR/logo.png" "/usr/share/yunohost/applogos/$app.png"
- if ! yunohost app config set "$app" _core.permission_main.permission_main_logo \
- --value="$YNH_APP_BASEDIR/logo.png" \
- --core; then
- ynh_print_warn --message="Le logo du portail YunoHost n'a pas pu être enregistré. L'installation de Globinours continue."
- fi
-}
-
prepare_persistent_paths() {
- mkdir -p "$data_dir/association" "$data_dir/grants" "$data_dir/medical-documents" \
- "$data_dir/private-media" "$data_dir/media" "$data_dir/storage/logs" \
- "$data_dir/storage/backups" "$data_dir/storage/releases"
- ynh_safe_rm "$install_dir/data"
- ynh_safe_rm "$install_dir/storage"
- ynh_safe_rm "$install_dir/public/media"
+ for path_to_replace in "$install_dir/data" "$install_dir/storage" "$install_dir/public/media"; do
+ if [[ -e "$path_to_replace" || -L "$path_to_replace" ]]; then
+ ynh_safe_rm "$path_to_replace"
+ fi
+ done
+
ln -s "$data_dir" "$install_dir/data"
ln -s "$data_dir/storage" "$install_dir/storage"
ln -s "$data_dir/media" "$install_dir/public/media"
+
chown -R "$app:www-data" "$install_dir"
chown -R "$app:$app" "$data_dir"
chmod -R u=rwX,g=rX,o= "$install_dir"
chmod -R u=rwX,g=,o= "$data_dir"
+
chown "$app:www-data" "$data_dir"
chmod 0710 "$data_dir"
chown -R "$app:www-data" "$data_dir/media"
diff --git a/scripts/backup b/scripts/backup
index 1fd0bfa..8f41a4b 100755
--- a/scripts/backup
+++ b/scripts/backup
@@ -1,6 +1,21 @@
#!/bin/bash
+
+#=================================================
+# IMPORT GENERIC HELPERS
+#=================================================
+
source ../settings/scripts/_common.sh
+source /usr/share/yunohost/helpers
+
+#=================================================
+# DECLARE DATA TO BACK UP
+#=================================================
+
+ynh_print_info "Declaring files to be backed up..."
+
ynh_backup "$install_dir"
ynh_backup "$data_dir"
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup "/etc/php/$php_version/fpm/pool.d/$app.conf"
+
+ynh_print_info "Backup script completed for $app"
diff --git a/scripts/change_url b/scripts/change_url
index 1dc41ab..484ac86 100755
--- a/scripts/change_url
+++ b/scripts/change_url
@@ -1,4 +1,23 @@
#!/bin/bash
+
+#=================================================
+# IMPORT GENERIC HELPERS
+#=================================================
+
source _common.sh
+source /usr/share/yunohost/helpers
+
+#=================================================
+# MODIFY URL IN NGINX CONF
+#=================================================
+
+ynh_script_progression "Updating NGINX web server configuration..."
+
ynh_config_change_url_nginx
ynh_systemctl --service=nginx --action=reload
+
+#=================================================
+# END OF SCRIPT
+#=================================================
+
+ynh_script_progression "Change of URL completed for $app"
diff --git a/scripts/install b/scripts/install
index 3d92960..af0a8dc 100755
--- a/scripts/install
+++ b/scripts/install
@@ -1,10 +1,47 @@
#!/bin/bash
+
+#=================================================
+# IMPORT GENERIC HELPERS
+#=================================================
+
source _common.sh
-ynh_script_progression --message="Installation de Globinours..."
+source /usr/share/yunohost/helpers
+
+#=================================================
+# DOWNLOAD, CHECK AND UNPACK SOURCE
+#=================================================
+
+ynh_script_progression "Setting up source files..."
+
ynh_setup_source --dest_dir="$install_dir"
+
+#=================================================
+# APP INITIAL CONFIGURATION
+#=================================================
+
prepare_persistent_paths
-install_yunohost_logo
+
+#=================================================
+# SYSTEM CONFIGURATION
+#=================================================
+
+ynh_script_progression "Adding system configurations related to $app..."
+
ynh_config_add_phpfpm
ynh_config_add_nginx
+
+#=================================================
+# INITIALIZE THE APPLICATION
+#=================================================
+
+ynh_script_progression "Initializing the database..."
+
ynh_exec_as_app php "$install_dir/scripts/migrate.php"
+
ynh_systemctl --service="php$php_version-fpm" --action=reload
+
+#=================================================
+# END OF SCRIPT
+#=================================================
+
+ynh_script_progression "Installation of $app completed"
diff --git a/scripts/remove b/scripts/remove
index 509b160..2dedbda 100755
--- a/scripts/remove
+++ b/scripts/remove
@@ -1,5 +1,23 @@
#!/bin/bash
+
+#=================================================
+# IMPORT GENERIC HELPERS
+#=================================================
+
source _common.sh
-ynh_safe_rm "/usr/share/yunohost/applogos/$app.png"
+source /usr/share/yunohost/helpers
+
+#=================================================
+# REMOVE SYSTEM CONFIGURATION
+#=================================================
+
+ynh_script_progression "Removing system configurations related to $app..."
+
ynh_config_remove_nginx
ynh_config_remove_phpfpm
+
+#=================================================
+# END OF SCRIPT
+#=================================================
+
+ynh_script_progression "Removal of $app completed"
diff --git a/scripts/restore b/scripts/restore
index 00185e7..9e78ed5 100755
--- a/scripts/restore
+++ b/scripts/restore
@@ -1,11 +1,38 @@
#!/bin/bash
+
+#=================================================
+# IMPORT GENERIC HELPERS
+#=================================================
+
source ../settings/scripts/_common.sh
+source /usr/share/yunohost/helpers
+
+#=================================================
+# RESTORE FILES AND DATA
+#=================================================
+
+ynh_script_progression "Restoring application files..."
+
ynh_restore "$install_dir"
ynh_restore "$data_dir"
+
+#=================================================
+# RESTORE SYSTEM CONFIGURATION
+#=================================================
+
+ynh_script_progression "Restoring system configurations related to $app..."
+
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore "/etc/php/$php_version/fpm/pool.d/$app.conf"
+
prepare_persistent_paths
-install_yunohost_logo
ynh_exec_as_app php "$install_dir/scripts/migrate.php"
+
ynh_systemctl --service="php$php_version-fpm" --action=reload
ynh_systemctl --service=nginx --action=reload
+
+#=================================================
+# END OF SCRIPT
+#=================================================
+
+ynh_script_progression "Restoration completed for $app"
diff --git a/scripts/upgrade b/scripts/upgrade
index 3e669d1..ec102b1 100755
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -1,19 +1,54 @@
#!/bin/bash
+
+#=================================================
+# IMPORT GENERIC HELPERS
+#=================================================
+
source _common.sh
+source /usr/share/yunohost/helpers
+
+#=================================================
+# CREATE AN APPLICATION BACKUP
+#=================================================
+
if [[ -f "$install_dir/scripts/backup.php" && -f "$data_dir/refuge.sqlite" ]] && \
php -l "$install_dir/app/Services/BackupService.php" >/dev/null 2>&1; then
ynh_exec_as_app php "$install_dir/scripts/backup.php" pre-upgrade-yunohost
elif [[ -f "$data_dir/refuge.sqlite" ]]; then
ynh_print_warn --message="La sauvegarde applicative préalable est ignorée car l'ancienne version n'est pas compatible avec PHP $php_version. La sauvegarde de sécurité YunoHost reste active."
fi
+
+#=================================================
+# ENABLE MAINTENANCE MODE
+#=================================================
+
touch "$data_dir/storage/maintenance.flag"
trap 'rm -f "$data_dir/storage/maintenance.flag"' EXIT
+
+#=================================================
+# DOWNLOAD, CHECK AND UNPACK SOURCE
+#=================================================
+
+ynh_script_progression "Upgrading source files..."
+
ynh_setup_source --dest_dir="$install_dir" --full_replace --keep="data storage public/media"
+
+#=================================================
+# UPDATE APPLICATION AND SYSTEM CONFIGURATION
+#=================================================
+
prepare_persistent_paths
-install_yunohost_logo
ynh_config_add_phpfpm
ynh_config_add_nginx
ynh_exec_as_app php "$install_dir/scripts/migrate.php"
+
rm -f "$data_dir/storage/maintenance.flag"
trap - EXIT
+
ynh_systemctl --service="php$php_version-fpm" --action=reload
+
+#=================================================
+# END OF SCRIPT
+#=================================================
+
+ynh_script_progression "Upgrade of $app completed"
diff --git a/tests.toml b/tests.toml
index 69cf81d..e3d18f7 100644
--- a/tests.toml
+++ b/tests.toml
@@ -1,6 +1,10 @@
test_format = 1.0
+
[default]
args.init_main_permission = "visitors"
+
+ test_upgrade_from.1a45355.name = "Upgrade from 1.0.0-rc.3~ynh10"
+
[default.curl_tests]
home.path = "/"
home.expect_title = "Globinours"