From 9d8e07831b658271810e613671970e357cbc497b Mon Sep 17 00:00:00 2001 From: Robles Rodolphe Date: Sun, 5 Dec 2021 15:12:31 +0100 Subject: [PATCH 01/21] first try upgrading to 1.1.15 release disabling auto-upgrade need to change the config.local.php file --- README.md | 2 +- README_fr.md | 2 +- conf/app.src | 4 ++-- manifest.json | 2 +- scripts/install | 1 + scripts/upgrade | 15 ++++++++++++++- 6 files changed, 20 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index cb63e86..7304fd2 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 Garradin (word meaning money in an aboriginal dialect of northern Australia, pronounced "gar-a-dine" em) is software for associative management. It is the tool of choice for managing an association, a sports club, an NGO, etc. It is designed to meet the needs of a small to medium-sized structure: management of members, accounting, website, note-taking in meetings, archiving and sharing of the association's operating documents, discussion between members, etc. etc. . -**Shipped version:** 1.1.14~ynh1 +**Shipped version:** 1.1.15~ynh1 **Demo:** https://garradin.eu/essai/ diff --git a/README_fr.md b/README_fr.md index bda5c5d..9a14680 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 Garradin (mot signifiant argent dans un dialecte aborigène du nord de l'Australie, prononcé « gar-a-dine »em) est un logiciel de gestion associative. Il est l'outil de prédilection pour gérer une association, un club sportif, une ONG, etc. Il est conçu pour répondre aux besoins d'une structure de petite à moyenne taille : gestion des adhérents, comptabilité, site web, prise de notes en réunion, archivage et partage des documents de fonctionnement de l'association, discussion entre adhérents, etc etc. -**Version incluse :** 1.1.14~ynh1 +**Version incluse :** 1.1.15~ynh1 **Démo :** https://garradin.eu/essai/ diff --git a/conf/app.src b/conf/app.src index 06e9006..4e6d4f4 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://fossil.kd2.org/garradin/uv/garradin-1.1.14.tar.bz2 -SOURCE_SUM=bd735252540c6d26a1593d61486881a296a9b4a166532083805808b015da33d7 +SOURCE_URL=https://fossil.kd2.org/garradin/uv/garradin-1.1.15.tar.gz +SOURCE_SUM=451c87a356c942ecd2233684faf406d640fca7ca6a65856faf3f341c9941e2f3 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.bz2 SOURCE_IN_SUBDIR=true diff --git a/manifest.json b/manifest.json index 4d599c2..4b85cb0 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Software to manage association", "fr": "Logiciel libre de gestion d'association" }, - "version": "1.1.14~ynh1", + "version": "1.1.15~ynh1", "url": "http://garradin.eu", "upstream": { "license": "GPL-3.0-or-later", diff --git a/scripts/install b/scripts/install index 056bbe3..b187fe1 100644 --- a/scripts/install +++ b/scripts/install @@ -94,6 +94,7 @@ if [ "$path_url" == "/" ]; then else ynh_replace_string --match_string="//const WWW_URI = '/asso/';" --replace_string="const WWW_URI = '$path_url/';" --target_file="$final_path/config.local.php" fi +ynh_replace_string --match_string="//const ENABLE_UPGRADES = true;" --replace_string="//const ENABLE_UPGRADES = false;" --target_file="$final_path/config.local.php" # Permissions on files and directories chmod -R o-rwx "$final_path" diff --git a/scripts/upgrade b/scripts/upgrade index e47b8cf..8906207 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -186,7 +186,7 @@ ynh_script_progression --message="Upgrading source files..." --weight=5 if [ "$upgrade_type" == "UPGRADE_APP" ] then # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --keep="config.local.php" --dest_dir="$final_path" + ynh_setup_source --dest_dir="$final_path" fi #================================================= @@ -230,6 +230,19 @@ fi #================================================= ynh_script_progression --message="Adding a configuration file..." --weight=5 +# copy config.dist.php creating config.local.php +cp -a $final_path/config.dist.php $final_path/config.local.php +# create a key for the secret key CSFR; +key=$(ynh_string_random --length=50) +# edit config.local.php +ynh_replace_string --match_string="const SECRET_KEY = '3xUhIgGwuovRKOjVsVPQ5yUMfXUSIOX2GKzcebsz5OINrYC50r';" --replace_string="const SECRET_KEY = '$key';" --target_file="$final_path/config.local.php" +if [ "$path_url" == "/" ]; then + ynh_replace_string --match_string="//const WWW_URI = '/asso/';" --replace_string="const WWW_URI = '$path_url';" --target_file="$final_path/config.local.php" +else + ynh_replace_string --match_string="//const WWW_URI = '/asso/';" --replace_string="const WWW_URI = '$path_url/';" --target_file="$final_path/config.local.php" +fi +ynh_replace_string --match_string="//const ENABLE_UPGRADES = true;" --replace_string="//const ENABLE_UPGRADES = false;" --target_file="$final_path/config.local.php" + # Permissions on files and directories chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" From 19218f5ed5c0eebfcaf3515f5b35a555f190e122 Mon Sep 17 00:00:00 2001 From: Robles Rodolphe Date: Sun, 5 Dec 2021 15:55:28 +0100 Subject: [PATCH 02/21] disable auto-upgrade --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 8906207..fb81e95 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -241,7 +241,7 @@ if [ "$path_url" == "/" ]; then else ynh_replace_string --match_string="//const WWW_URI = '/asso/';" --replace_string="const WWW_URI = '$path_url/';" --target_file="$final_path/config.local.php" fi -ynh_replace_string --match_string="//const ENABLE_UPGRADES = true;" --replace_string="//const ENABLE_UPGRADES = false;" --target_file="$final_path/config.local.php" +ynh_replace_string --match_string="//const ENABLE_UPGRADES = true;" --replace_string="const ENABLE_UPGRADES = false;" --target_file="$final_path/config.local.php" # Permissions on files and directories chmod -R o-rwx "$final_path" From 4ba25bc0f3e641b1761d62676202173511d21a99 Mon Sep 17 00:00:00 2001 From: Robles Rodolphe Date: Sun, 5 Dec 2021 15:55:58 +0100 Subject: [PATCH 03/21] disable auto-upgrade --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index b187fe1..29a76b9 100644 --- a/scripts/install +++ b/scripts/install @@ -94,7 +94,7 @@ if [ "$path_url" == "/" ]; then else ynh_replace_string --match_string="//const WWW_URI = '/asso/';" --replace_string="const WWW_URI = '$path_url/';" --target_file="$final_path/config.local.php" fi -ynh_replace_string --match_string="//const ENABLE_UPGRADES = true;" --replace_string="//const ENABLE_UPGRADES = false;" --target_file="$final_path/config.local.php" +ynh_replace_string --match_string="//const ENABLE_UPGRADES = true;" --replace_string="const ENABLE_UPGRADES = false;" --target_file="$final_path/config.local.php" # Permissions on files and directories chmod -R o-rwx "$final_path" From f07d49d5cc012fc01cd2a02f51ec352ba285911a Mon Sep 17 00:00:00 2001 From: Robles Rodolphe Date: Sun, 12 Dec 2021 21:56:09 +0100 Subject: [PATCH 04/21] keep the config.local.php file when updating and add the lines commented whith the new constant for enabling upgrades to false --- scripts/upgrade | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index fb81e95..d5c76db 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -186,7 +186,7 @@ ynh_script_progression --message="Upgrading source files..." --weight=5 if [ "$upgrade_type" == "UPGRADE_APP" ] then # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$final_path" + ynh_setup_source --keep="config.local.php" --dest_dir="$final_path" fi #================================================= @@ -230,18 +230,7 @@ fi #================================================= ynh_script_progression --message="Adding a configuration file..." --weight=5 -# copy config.dist.php creating config.local.php -cp -a $final_path/config.dist.php $final_path/config.local.php -# create a key for the secret key CSFR; -key=$(ynh_string_random --length=50) -# edit config.local.php -ynh_replace_string --match_string="const SECRET_KEY = '3xUhIgGwuovRKOjVsVPQ5yUMfXUSIOX2GKzcebsz5OINrYC50r';" --replace_string="const SECRET_KEY = '$key';" --target_file="$final_path/config.local.php" -if [ "$path_url" == "/" ]; then - ynh_replace_string --match_string="//const WWW_URI = '/asso/';" --replace_string="const WWW_URI = '$path_url';" --target_file="$final_path/config.local.php" -else - ynh_replace_string --match_string="//const WWW_URI = '/asso/';" --replace_string="const WWW_URI = '$path_url/';" --target_file="$final_path/config.local.php" -fi -ynh_replace_string --match_string="//const ENABLE_UPGRADES = true;" --replace_string="const ENABLE_UPGRADES = false;" --target_file="$final_path/config.local.php" +echo -e "\n /** \n * Activer la possibilité de faire une mise à jour semi-automatisée \n * depuis fossil.kd2.org. \n * \n * Si mis à TRUE, alors un bouton sera accessible depuis le menu "Configuration" \n * pour faire une mise à jour en deux clics. \n * \n * Il est conseillé de désactiver cette fonctionnalité si vous ne voulez pas \n * permettre à un utilisateur de casser l'installation ! \n * \n * Défaut : true \n * \n * @var bool \n */ \n \nconst ENABLE_UPGRADES = false;" >> $final_path/config.local.php # Permissions on files and directories chmod -R o-rwx "$final_path" From 738a270d5faadbec410f6647413fc29bfb5b622e Mon Sep 17 00:00:00 2001 From: Robles Rodolphe Date: Sat, 18 Dec 2021 22:01:09 +0100 Subject: [PATCH 05/21] try use ynh_add_config to replace cp -a --- scripts/install | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 29a76b9..2399a2f 100644 --- a/scripts/install +++ b/scripts/install @@ -83,8 +83,8 @@ ynh_add_fpm_config --package="$extra_php_dependencies" #================================================= ynh_script_progression --message="Adding a configuration file..." --weight=5 -# copy config.dist.php creating config.local.php -cp -a $final_path/config.dist.php $final_path/config.local.php +# copy config.dist.php create config.local.php +ynh_add_config --template="config.dist.php" --destination="$final_path/config.local.php" # create a key for the secret key CSFR; key=$(ynh_string_random --length=50) # edit config.local.php From f8774da26a6522a9d2f1d9df74906efc915a7e34 Mon Sep 17 00:00:00 2001 From: Robles Rodolphe Date: Sun, 19 Dec 2021 15:19:24 +0100 Subject: [PATCH 06/21] back to correct code --- scripts/install | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 2399a2f..29a76b9 100644 --- a/scripts/install +++ b/scripts/install @@ -83,8 +83,8 @@ ynh_add_fpm_config --package="$extra_php_dependencies" #================================================= ynh_script_progression --message="Adding a configuration file..." --weight=5 -# copy config.dist.php create config.local.php -ynh_add_config --template="config.dist.php" --destination="$final_path/config.local.php" +# copy config.dist.php creating config.local.php +cp -a $final_path/config.dist.php $final_path/config.local.php # create a key for the secret key CSFR; key=$(ynh_string_random --length=50) # edit config.local.php From e40888d2e49efc0ccce7bff0bb4889833ecc5e05 Mon Sep 17 00:00:00 2001 From: Robles Rodolphe Date: Sun, 19 Dec 2021 16:42:52 +0100 Subject: [PATCH 07/21] change the request test from last commit in stable --- check_process | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/check_process b/check_process index c6f654f..6d24bc6 100644 --- a/check_process +++ b/check_process @@ -11,7 +11,7 @@ setup_private=1 setup_public=1 upgrade=1 - upgrade=1 from_commit=2be21892a9b479710405a6ecd74ffb0541e0d202 + upgrade=1 from_commit=7205455e0a806a49c48c6d2f005d80d1b74a3355 backup_restore=1 multi_instance=1 change_url=1 @@ -19,6 +19,6 @@ Email= Notification=none ;;; Upgrade options - ; commit=2be21892a9b479710405a6ecd74ffb0541e0d202 + ; commit=7205455e0a806a49c48c6d2f005d80d1b74a3355 name=Merge pull request #55 from yunohost-bot/issue-and-pr-template manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666& From fe30b3310802a6d023bfc8c6e55c601b447faeea Mon Sep 17 00:00:00 2001 From: Robles Rodolphe Date: Sun, 19 Dec 2021 19:17:01 +0100 Subject: [PATCH 08/21] try change in remove script how remove dependencies to remove tge message 'Unable to locate package garradin-ynh-deps' --- scripts/remove | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/remove b/scripts/remove index 57814f7..222ce56 100644 --- a/scripts/remove +++ b/scripts/remove @@ -41,10 +41,10 @@ ynh_remove_nginx_config ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=2 # Remove the app dependencies installed along with php-fpm -ynh_remove_app_dependencies +# ynh_remove_app_dependencies # Remove the dedicated PHP-FPM config -ynh_remove_fpm_config +ynh_remove_fpm_config --package="$extra_php_dependencies" #================================================= # GENERIC FINALIZATION From ce4fccfd27289c7fe99d7ddd5ca806dc1cfed508 Mon Sep 17 00:00:00 2001 From: Robles Rodolphe Date: Tue, 28 Dec 2021 10:21:55 +0100 Subject: [PATCH 09/21] add some new directories in the releases to keep datas on upgrade --- scripts/upgrade | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index d5c76db..cee28e6 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -66,6 +66,8 @@ ynh_script_progression --message="Backing up the data before upgrading (may take bdd=$final_path/association.sqlite squelettes=$final_path/www/squelettes +data=$final_path/data +skel_dist=$final_path/www/skel-dist if [ -d "$squelettes" ]; then cp -ar $squelettes /tmp/squelettes @@ -75,6 +77,14 @@ if [ -e "$bdd" ]; then cp -a $bdd /tmp/association.sqlite fi +if [ -d "$data" ]; then + cp -ar $data /tmp/data +fi + +if [ -d "$skel_dist" ]; then + cp -ar $skel_dist /tmp/skel-dist +fi + #================================================= # UPGRADE TO 0.9.8 if necessary #================================================= @@ -212,6 +222,8 @@ ynh_script_progression --message="restore data..." --weight=10 backup_bdd=/tmp/association.sqlite backup_squelettes=/tmp/squelettes +backup_data=/tmp/data +backup_skel_dist=/tmp/skel-dist if [ -d "$backup_squelettes" ] then @@ -225,6 +237,19 @@ then ynh_secure_remove $backup_bdd fi +if [ -d "$backup_data" ] +then + cp -ar $backup_data $final_path/data + ynh_secure_remove $backup_data +fi + +if [ -d "$backup_skel_dist" ] +then + cp -ar $backup_skel_dist $final_path/www/skel-dist + ynh_secure_remove $backup_skel_dist +fi + + #================================================= # ADD A CONFIGURATION #================================================= From 58e2a40af035ffec33da102ef38625d2b18af0e9 Mon Sep 17 00:00:00 2001 From: Robles Rodolphe Date: Tue, 28 Dec 2021 23:35:38 +0100 Subject: [PATCH 10/21] cleaning the commands cp on upgrade script --- scripts/upgrade | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index cee28e6..3068eee 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -70,19 +70,19 @@ data=$final_path/data skel_dist=$final_path/www/skel-dist if [ -d "$squelettes" ]; then - cp -ar $squelettes /tmp/squelettes + cp -a "$squelettes" /tmp/squelettes fi if [ -e "$bdd" ]; then - cp -a $bdd /tmp/association.sqlite + cp -a "$bdd" /tmp/association.sqlite fi if [ -d "$data" ]; then - cp -ar $data /tmp/data + cp -a "$data" /tmp/data fi if [ -d "$skel_dist" ]; then - cp -ar $skel_dist /tmp/skel-dist + cp -a "$skel_dist" /tmp/skel-dist fi #================================================= @@ -106,12 +106,12 @@ then if [ -d "$backup_squelettes" ] then - cp -ar $backup_squelettes $final_path/www/squelettes + cp -a "$backup_squelettes" $final_path/www/squelettes fi if [ -e "$backup_bdd" ] then - cp -a $backup_bdd $final_path/association.sqlite + cp -a "$backup_bdd" $final_path/association.sqlite fi chown -R $app:$app $final_path @@ -153,12 +153,12 @@ then if [ -d "$backup_squelettes" ] then - cp -ar $backup_squelettes $final_path/www/squelettes + cp -a "$backup_squelettes" $final_path/www/squelettes fi if [ -e "$backup_bdd" ] then - cp -a $backup_bdd $final_path/association.sqlite + cp -a "$backup_bdd" $final_path/association.sqlite fi chown -R $app:$app $final_path @@ -227,25 +227,25 @@ backup_skel_dist=/tmp/skel-dist if [ -d "$backup_squelettes" ] then - cp -ar $backup_squelettes $final_path/www/squelettes + cp -a "$backup_squelettes" $final_path/www/squelettes ynh_secure_remove $backup_squelettes fi if [ -e "$backup_bdd" ] then - cp -a $backup_bdd $final_path/association.sqlite + cp -a "$backup_bdd" $final_path/association.sqlite ynh_secure_remove $backup_bdd fi if [ -d "$backup_data" ] then - cp -ar $backup_data $final_path/data + cp -a "$backup_data" $final_path/data ynh_secure_remove $backup_data fi if [ -d "$backup_skel_dist" ] then - cp -ar $backup_skel_dist $final_path/www/skel-dist + cp -a "$backup_skel_dist" $final_path/www/skel-dist ynh_secure_remove $backup_skel_dist fi From be89f0e28029d2e8dec9fd42e764a75c3e6a88a1 Mon Sep 17 00:00:00 2001 From: Robles Rodolphe Date: Wed, 29 Dec 2021 00:21:55 +0100 Subject: [PATCH 11/21] try add a file with the new constant and add a call with require in the config.local.php --- conf/config.local.release.php | 51 +++++++++++++++++++++++++++++++++++ scripts/upgrade | 5 +++- 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 conf/config.local.release.php diff --git a/conf/config.local.release.php b/conf/config.local.release.php new file mode 100644 index 0000000..510ec8f --- /dev/null +++ b/conf/config.local.release.php @@ -0,0 +1,51 @@ +> $final_path/config.local.php +ynh_add_config --template="config.local.release.php" --destination="$final_path/config.local.release.php" + +echo -e "\n require 'config.local.release.php'" >> $final_path/config.local.php # Permissions on files and directories chmod -R o-rwx "$final_path" @@ -265,6 +267,7 @@ find "$final_path" -type f -exec chmod 440 {} + find "$final_path/data" -type d -exec chmod 770 {} + find "$final_path/data" -type f -exec chmod 660 {} + chmod 660 "$final_path/config.local.php" +chmod 660 "$final_path/config.local.release.php" #================================================= # RELOAD NGINX From 73e4aaba5c9a3dca3a83cfc253774d1ea5511bb2 Mon Sep 17 00:00:00 2001 From: Robles Rodolphe Date: Wed, 29 Dec 2021 00:31:22 +0100 Subject: [PATCH 12/21] syntax errors in the config.local.release.php --- conf/config.local.release.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/config.local.release.php b/conf/config.local.release.php index 510ec8f..cd0cf1d 100644 --- a/conf/config.local.release.php +++ b/conf/config.local.release.php @@ -15,9 +15,9 @@ * @var bool */ -const ENABLE_UPGRADES = false +const ENABLE_UPGRADES = false; -** +/** * Commande de création de PDF * * Commande qui sera exécutée pour créer un fichier PDF à partir d'un HTML. From 3d4f19bc77925ef4734630485213620c5f913a8c Mon Sep 17 00:00:00 2001 From: Robles Rodolphe Date: Wed, 29 Dec 2021 13:08:49 +0100 Subject: [PATCH 13/21] syntax php --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 89c7aaa..98e376a 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -257,7 +257,7 @@ ynh_script_progression --message="Adding a configuration file..." --weight=5 ynh_add_config --template="config.local.release.php" --destination="$final_path/config.local.release.php" -echo -e "\n require 'config.local.release.php'" >> $final_path/config.local.php +echo -e "\n require 'config.local.release.php;'" >> $final_path/config.local.php # Permissions on files and directories chmod -R o-rwx "$final_path" From 2e7cced587a7cc8390e68e232cd4f6bfff2d33e8 Mon Sep 17 00:00:00 2001 From: Florent Date: Thu, 30 Dec 2021 07:31:27 +0100 Subject: [PATCH 14/21] Use ynh_install_app_dependencies for cleaner installation / removal Also don't output warning about package not being found on removal it is a normal case: running ynh_remove_app_dependencies produces it --- scripts/install | 3 ++- scripts/remove | 7 +++++-- scripts/upgrade | 9 ++++++--- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/scripts/install b/scripts/install index 29a76b9..8fa2f6d 100644 --- a/scripts/install +++ b/scripts/install @@ -76,7 +76,8 @@ ynh_add_nginx_config ynh_script_progression --message="Configuring PHP-FPM..." --weight=5 # Create a dedicated PHP-FPM config -ynh_add_fpm_config --package="$extra_php_dependencies" +ynh_install_app_dependencies "$extra_php_dependencies" +ynh_add_fpm_config #================================================= # ADD A CONFIGURATION diff --git a/scripts/remove b/scripts/remove index 222ce56..8c4ebd5 100644 --- a/scripts/remove +++ b/scripts/remove @@ -41,10 +41,13 @@ ynh_remove_nginx_config ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=2 # Remove the app dependencies installed along with php-fpm -# ynh_remove_app_dependencies +ynh_remove_app_dependencies # Remove the dedicated PHP-FPM config -ynh_remove_fpm_config --package="$extra_php_dependencies" +# NB: If there is a warning because it cannot locate the garradin-ynh-deps package, ignore +# It's just it has been removed before. +# https://github.com/YunoHost/yunohost/blob/509ba1e8a28e0be598aa0617eda06669b7b0f1d8/data/helpers.d/php#L284-L287 +ynh_remove_fpm_config 2> >(grep -v 'WARNING E: Unable to locate package') #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index 98e376a..d2ec51c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -97,7 +97,8 @@ then # Set permissions on app files ynh_system_user_create --username=$app ynh_add_nginx_config - ynh_add_fpm_config --package="$extra_php_dependencies" + ynh_install_app_dependencies "$extra_php_dependencies" + ynh_add_fpm_config phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) ynh_script_progression --message="restore data..." --weight=10 @@ -144,7 +145,8 @@ then # Set permissions on app files ynh_system_user_create --username=$app ynh_add_nginx_config - ynh_add_fpm_config --package="$extra_php_dependencies" + ynh_install_app_dependencies "$extra_php_dependencies" + ynh_add_fpm_config phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) ynh_script_progression --message="restore data..." --weight=10 @@ -213,7 +215,8 @@ ynh_add_nginx_config ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2 # Create a dedicated PHP-FPM config -ynh_add_fpm_config --package="$extra_php_dependencies" +ynh_install_app_dependencies "$extra_php_dependencies" +ynh_add_fpm_config #======================================================= # backup bdd, squelettes directory and config.local.php From 92b105e43db05dc912e5a9877096abeb785577a7 Mon Sep 17 00:00:00 2001 From: Florent Date: Thu, 30 Dec 2021 14:12:37 +0100 Subject: [PATCH 15/21] Split config into several files --- conf/config.local.php | 9 ++++++ conf/config.local.release.php | 51 ------------------------------ conf/config.local.user.php | 13 ++++++++ conf/config.local.yunohost.php | 58 ++++++++++++++++++++++++++++++++++ scripts/_common.sh | 2 +- scripts/install | 23 ++++++-------- scripts/upgrade | 19 +++++------ 7 files changed, 101 insertions(+), 74 deletions(-) create mode 100644 conf/config.local.php delete mode 100644 conf/config.local.release.php create mode 100644 conf/config.local.user.php create mode 100644 conf/config.local.yunohost.php diff --git a/conf/config.local.php b/conf/config.local.php new file mode 100644 index 0000000..82b5400 --- /dev/null +++ b/conf/config.local.php @@ -0,0 +1,9 @@ +> $final_path/config.local.php +ynh_add_config --template="config.local.php" --destination="$final_path/config.local.php" +ynh_add_config --template="config.local.yunohost.php" --destination="$final_path/config.local.yunohost.php" +# NOTE: Don't overwrite config.local.user.php # Permissions on files and directories chmod -R o-rwx "$final_path" @@ -269,8 +270,9 @@ find "$final_path" -type d -exec chmod 550 {} + find "$final_path" -type f -exec chmod 440 {} + find "$final_path/data" -type d -exec chmod 770 {} + find "$final_path/data" -type f -exec chmod 660 {} + -chmod 660 "$final_path/config.local.php" -chmod 660 "$final_path/config.local.release.php" +chmod 440 "$final_path/config.local.php" +chmod 440 "$final_path/config.local.yunohost.php" +chmod 660 "$final_path/config.local.user.php" #================================================= # RELOAD NGINX @@ -285,7 +287,6 @@ ynh_systemd_action --service_name=nginx --action=reload ynh_script_progression --message="Finalise upgrade" --weight=1 ynh_local_curl "/admin/index.php" -chmod 440 "$final_path/config.local.php" #================================================= # END OF SCRIPT From 441755d9fbab98975f69d68ef74a87063dd13ed9 Mon Sep 17 00:00:00 2001 From: Florent Date: Thu, 30 Dec 2021 16:00:13 +0100 Subject: [PATCH 16/21] Fix change_url and add test cases for upgrade --- check_process | 10 +++++++++- scripts/change_url | 11 ++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/check_process b/check_process index 6d24bc6..87a0cef 100644 --- a/check_process +++ b/check_process @@ -12,6 +12,8 @@ setup_public=1 upgrade=1 upgrade=1 from_commit=7205455e0a806a49c48c6d2f005d80d1b74a3355 + upgrade=1 from_commit=fc55308f7521310d5c339139339896bb59bd73cd + upgrade=1 from_commit=e5dd30afa6a618344c9e7b927839d4e9ac8bfc56 backup_restore=1 multi_instance=1 change_url=1 @@ -20,5 +22,11 @@ Email= Notification=none ;;; Upgrade options ; commit=7205455e0a806a49c48c6d2f005d80d1b74a3355 - name=Merge pull request #55 from yunohost-bot/issue-and-pr-template + name=Previous version + manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666& + ; commit=fc55308f7521310d5c339139339896bb59bd73cd + name=Version 0.9.5 + manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666& + ; commit=e5dd30afa6a618344c9e7b927839d4e9ac8bfc56 + name=Version 1.0.3~ynh2 manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666& diff --git a/scripts/change_url b/scripts/change_url index 594268b..0035ee1 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -20,6 +20,7 @@ new_domain=$YNH_APP_NEW_DOMAIN new_path=$YNH_APP_NEW_PATH app=$YNH_APP_INSTANCE_NAME +secret_key=$(ynh_string_random --length=50) #================================================= # LOAD SETTINGS @@ -81,15 +82,7 @@ then path_url="$new_path" # Create a dedicated NGINX config ynh_add_nginx_config -fi - -# change the config.local.conf -if [ $change_path -eq 1 ] && [ "$new_path" == "/" ]; then - ynh_replace_string --match_string="const WWW_URI = '$old_path/';" --replace_string="const WWW_URI = '$new_path';" --target_file="$final_path/config.local.php" -elif [ $change_path -eq 1 ] && [ "$old_path" == "/" ]; then - ynh_replace_string --match_string="const WWW_URI = '$old_path';" --replace_string="const WWW_URI = '$new_path/';" --target_file="$final_path/config.local.php" -elif [ $change_path -eq 1 ]; then - ynh_replace_string --match_string="const WWW_URI = '$old_path/';" --replace_string="const WWW_URI = '$new_path/';" --target_file="$final_path/config.local.php" + ynh_add_config --template="config.local.yunohost.php" --destination="$final_path/config.local.yunohost.php" fi # Change the domain for NGINX From 8366a5fa240d9bf1f5d973cdf1a249b0c09a1c8d Mon Sep 17 00:00:00 2001 From: Florent Date: Thu, 30 Dec 2021 20:14:13 +0100 Subject: [PATCH 17/21] Pre-upgrade script for chown + fixes --- check_process | 14 +++++++------- scripts/restore | 4 +++- scripts/upgrade | 4 ++++ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/check_process b/check_process index 87a0cef..89a9335 100644 --- a/check_process +++ b/check_process @@ -1,4 +1,8 @@ ; Test complet + ; pre-upgrade + if [ "$FROM_COMMIT" == "04e1730ff642a2e48dfb533b2136fe90f9eaf133" ]; then + chmod -R o-rwx /var/www/garradin + fi ; Manifest domain="domain.tld" path="/path" @@ -12,8 +16,7 @@ setup_public=1 upgrade=1 upgrade=1 from_commit=7205455e0a806a49c48c6d2f005d80d1b74a3355 - upgrade=1 from_commit=fc55308f7521310d5c339139339896bb59bd73cd - upgrade=1 from_commit=e5dd30afa6a618344c9e7b927839d4e9ac8bfc56 + upgrade=1 from_commit=04e1730ff642a2e48dfb533b2136fe90f9eaf133 backup_restore=1 multi_instance=1 change_url=1 @@ -24,9 +27,6 @@ Notification=none ; commit=7205455e0a806a49c48c6d2f005d80d1b74a3355 name=Previous version manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666& - ; commit=fc55308f7521310d5c339139339896bb59bd73cd - name=Version 0.9.5 - manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666& - ; commit=e5dd30afa6a618344c9e7b927839d4e9ac8bfc56 - name=Version 1.0.3~ynh2 + ; commit=04e1730ff642a2e48dfb533b2136fe90f9eaf133 + name=Version 1.0.6~ynh1 manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666& diff --git a/scripts/restore b/scripts/restore index d702b05..a4dfe8a 100644 --- a/scripts/restore +++ b/scripts/restore @@ -71,7 +71,9 @@ find "$final_path" -type d -exec chmod 550 {} + find "$final_path" -type f -exec chmod 440 {} + find "$final_path/data" -type d -exec chmod 770 {} + find "$final_path/data" -type f -exec chmod 660 {} + -chmod 660 "$final_path/config.local.php" +chmod 440 "$final_path/config.local.php" +chmod 440 "$final_path/config.local.yunohost.php" +chmod 660 "$final_path/config.local.user.php" #================================================= # RESTORE THE PHP-FPM CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index 5e9f4b2..dedde73 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -259,6 +259,10 @@ fi #================================================= ynh_script_progression --message="Adding a configuration file..." --weight=5 +if ynh_compare_current_package_version --comparison lt --version 1.1.15~ynh1; then + ynh_add_config --template="config.local.user.php" --destination="$final_path/config.local.user.php" +fi + ynh_add_config --template="config.local.php" --destination="$final_path/config.local.php" ynh_add_config --template="config.local.yunohost.php" --destination="$final_path/config.local.yunohost.php" # NOTE: Don't overwrite config.local.user.php From 866b07346053be4b378553ae9ba8045ddf0633e8 Mon Sep 17 00:00:00 2001 From: Florent Date: Thu, 30 Dec 2021 22:22:08 +0100 Subject: [PATCH 18/21] Update comments --- conf/config.local.php | 4 ++-- conf/config.local.yunohost.php | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/conf/config.local.php b/conf/config.local.php index 82b5400..e9b8a71 100644 --- a/conf/config.local.php +++ b/conf/config.local.php @@ -1,9 +1,9 @@ Date: Sun, 2 Jan 2022 12:54:08 +0100 Subject: [PATCH 19/21] Don't use legacy signature for ynh_die --- scripts/install | 2 +- scripts/restore | 2 +- scripts/upgrade | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index ca0d5a1..9964cf1 100644 --- a/scripts/install +++ b/scripts/install @@ -32,7 +32,7 @@ app=$YNH_APP_INSTANCE_NAME ynh_script_progression --message="Validating installation parameters..." --weight=1 final_path=/var/www/$app -test ! -e "$final_path" || ynh_die "This path already contains a folder" +test ! -e "$final_path" || ynh_die --message="This path already contains a folder" # Register (book) web path ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url diff --git a/scripts/restore b/scripts/restore index a4dfe8a..f63a66d 100644 --- a/scripts/restore +++ b/scripts/restore @@ -35,7 +35,7 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) ynh_script_progression --message="Validating restoration parameters..." --weight=4 test ! -d $final_path \ - || ynh_die "There is already a directory: $final_path " + || ynh_die --message="There is already a directory: $final_path " #================================================= # STANDARD RESTORATION STEPS diff --git a/scripts/upgrade b/scripts/upgrade index dedde73..accbb30 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -18,7 +18,7 @@ app=$YNH_APP_INSTANCE_NAME 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) || ynh_die "This path already contains a folder" +final_path=$(ynh_app_setting_get --app=$app --key=final_path) || ynh_die --message="This path already contains a folder" phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) secret_key=$(ynh_string_random --length=50) From 535464fcdd6fd22a88b8a1d348079459b54336a2 Mon Sep 17 00:00:00 2001 From: Florent Date: Sun, 2 Jan 2022 13:01:17 +0100 Subject: [PATCH 20/21] Update restoration script with the use of ynh_install_app_dependencies --- scripts/restore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/restore b/scripts/restore index f63a66d..d712603 100644 --- a/scripts/restore +++ b/scripts/restore @@ -82,7 +82,8 @@ ynh_script_progression --message="Reconfiguring PHP-FPM..." --weight=6 ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" -ynh_add_fpm_config --package="$extra_php_dependencies" +ynh_install_app_dependencies "$extra_php_dependencies" +ynh_add_fpm_config #================================================= # GENERIC FINALIZATION From c8a4e71393cca123f62c7349192077f604911018 Mon Sep 17 00:00:00 2001 From: Florent Date: Sun, 2 Jan 2022 15:04:58 +0100 Subject: [PATCH 21/21] Upgrade to version 1.1.17 --- README.md | 2 +- README_fr.md | 2 +- conf/app.src | 4 ++-- manifest.json | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 7304fd2..bff78f6 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 Garradin (word meaning money in an aboriginal dialect of northern Australia, pronounced "gar-a-dine" em) is software for associative management. It is the tool of choice for managing an association, a sports club, an NGO, etc. It is designed to meet the needs of a small to medium-sized structure: management of members, accounting, website, note-taking in meetings, archiving and sharing of the association's operating documents, discussion between members, etc. etc. . -**Shipped version:** 1.1.15~ynh1 +**Shipped version:** 1.1.17~ynh1 **Demo:** https://garradin.eu/essai/ diff --git a/README_fr.md b/README_fr.md index 9a14680..9580d82 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 Garradin (mot signifiant argent dans un dialecte aborigène du nord de l'Australie, prononcé « gar-a-dine »em) est un logiciel de gestion associative. Il est l'outil de prédilection pour gérer une association, un club sportif, une ONG, etc. Il est conçu pour répondre aux besoins d'une structure de petite à moyenne taille : gestion des adhérents, comptabilité, site web, prise de notes en réunion, archivage et partage des documents de fonctionnement de l'association, discussion entre adhérents, etc etc. -**Version incluse :** 1.1.15~ynh1 +**Version incluse :** 1.1.17~ynh1 **Démo :** https://garradin.eu/essai/ diff --git a/conf/app.src b/conf/app.src index 4e6d4f4..8ea6329 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://fossil.kd2.org/garradin/uv/garradin-1.1.15.tar.gz -SOURCE_SUM=451c87a356c942ecd2233684faf406d640fca7ca6a65856faf3f341c9941e2f3 +SOURCE_URL=https://fossil.kd2.org/garradin/uv/garradin-1.1.17.tar.gz +SOURCE_SUM=7eb9e66dabb2a57d55dd74ebdc54ad40850b5e6f98d260b63faeafabf8ef6687 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.bz2 SOURCE_IN_SUBDIR=true diff --git a/manifest.json b/manifest.json index 4b85cb0..6d9b34c 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Software to manage association", "fr": "Logiciel libre de gestion d'association" }, - "version": "1.1.15~ynh1", + "version": "1.1.17~ynh1", "url": "http://garradin.eu", "upstream": { "license": "GPL-3.0-or-later",