From e1830024d3f0133a1e75f409d229b6becc846084 Mon Sep 17 00:00:00 2001 From: mastereur <22839524+mastereur@users.noreply.github.com> Date: Wed, 30 Nov 2022 08:31:35 +0100 Subject: [PATCH 1/7] Add check for install.lock file #87 --- scripts/install | 6 ++++++ scripts/upgrade | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/scripts/install b/scripts/install index db105ea..5f72bf4 100644 --- a/scripts/install +++ b/scripts/install @@ -250,6 +250,12 @@ ynh_store_file_checksum --file="$final_path/htdocs/conf/conf.php" ynh_script_progression --message="Configuring permissions..." --weight=1 # Set permissions on app files +if [ ! -f $datadir/install.lock ]; then + echo 'This is a lock file to prevent use of install pages (set with permission 440)' > "$datadir/install.lock" + chown $app:$app "$datadir/install.lock" + chmod 440 "$datadir/install.lock" +fi + chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" diff --git a/scripts/upgrade b/scripts/upgrade index cc68717..2d34b7d 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -303,6 +303,12 @@ ynh_use_logrotate --non-append ynh_script_progression --message="Configuring permissions..." --weight=1 # Set permissions on app files +if [ ! -f $datadir/install.lock ]; then + echo 'This is a lock file to prevent use of install pages (set with permission 440)' > "$datadir/install.lock" + chown $app:$app "$datadir/install.lock" + chmod 440 "$datadir/install.lock" +fi + chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" From 20ac11c71be94128d8097079102caaaf1337a17d Mon Sep 17 00:00:00 2001 From: mastereur <22839524+mastereur@users.noreply.github.com> Date: Wed, 7 Dec 2022 17:49:46 +0100 Subject: [PATCH 2/7] Update to 16.0.2 --- README.md | 2 +- README_fr.md | 2 +- manifest.json | 2 +- scripts/upgrade.d/upgrade.last.sh | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index eb3f6c8..a096529 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 Dolibarr ERP & CRM is a modern software for managing your professional or associative activity (contacts, invoices, orders, stocks, agenda, etc.). -**Shipped version:** 16.0.1~ynh1 +**Shipped version:** 16.0.2~ynh1 **Demo:** https://www.dolibarr.org/onlinedemo diff --git a/README_fr.md b/README_fr.md index 2a4a565..60c3c57 100644 --- a/README_fr.md +++ b/README_fr.md @@ -17,7 +17,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour Dolibarr ERP & CRM est un logiciel moderne de gestion de votre activité professionnelle ou associative (contacts, factures, commandes, stocks, agenda, etc.). -**Version incluse :** 16.0.1~ynh1 +**Version incluse :** 16.0.2~ynh1 **Démo :** https://www.dolibarr.org/onlinedemo diff --git a/manifest.json b/manifest.json index 31045d5..cb2043c 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Manage the various aspects of your business or association", "fr": "Gérez les différents aspects de votre activité pro ou associative" }, - "version": "16.0.1~ynh1", + "version": "16.0.2~ynh1", "url": "https://www.dolibarr.org/", "upstream": { "license": "GPL-3.0-or-later", diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index f7a8a92..83d3724 100644 --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -1,7 +1,7 @@ #!/bin/bash # Target version of the Dolibarr update -next_version="16.0.1" +next_version="16.0.2" # Dolibarr tarball checksum -dolibarr_source_sha256="f3614cf7b08c80d1aed4ebe0434008b2b03867d12b85df45b682c217ecb16573" \ No newline at end of file +dolibarr_source_sha256="df627de530c80418b8e1cdce26f7b4f30355646435e2be30a947fcbfb09edb25" \ No newline at end of file From 6c09ca5f0c5c74b2ed0ef26bf63783ee6ed37f3c Mon Sep 17 00:00:00 2001 From: mastereur <22839524+mastereur@users.noreply.github.com> Date: Wed, 7 Dec 2022 17:51:28 +0100 Subject: [PATCH 3/7] Update to 16.0.3 --- README.md | 2 +- README_fr.md | 2 +- manifest.json | 2 +- scripts/upgrade.d/upgrade.last.sh | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a096529..9a777ca 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 Dolibarr ERP & CRM is a modern software for managing your professional or associative activity (contacts, invoices, orders, stocks, agenda, etc.). -**Shipped version:** 16.0.2~ynh1 +**Shipped version:** 16.0.3~ynh1 **Demo:** https://www.dolibarr.org/onlinedemo diff --git a/README_fr.md b/README_fr.md index 60c3c57..ec95764 100644 --- a/README_fr.md +++ b/README_fr.md @@ -17,7 +17,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour Dolibarr ERP & CRM est un logiciel moderne de gestion de votre activité professionnelle ou associative (contacts, factures, commandes, stocks, agenda, etc.). -**Version incluse :** 16.0.2~ynh1 +**Version incluse :** 16.0.3~ynh1 **Démo :** https://www.dolibarr.org/onlinedemo diff --git a/manifest.json b/manifest.json index cb2043c..cd01006 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Manage the various aspects of your business or association", "fr": "Gérez les différents aspects de votre activité pro ou associative" }, - "version": "16.0.2~ynh1", + "version": "16.0.3~ynh1", "url": "https://www.dolibarr.org/", "upstream": { "license": "GPL-3.0-or-later", diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index 83d3724..67585b6 100644 --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -1,7 +1,7 @@ #!/bin/bash # Target version of the Dolibarr update -next_version="16.0.2" +next_version="16.0.3" # Dolibarr tarball checksum -dolibarr_source_sha256="df627de530c80418b8e1cdce26f7b4f30355646435e2be30a947fcbfb09edb25" \ No newline at end of file +dolibarr_source_sha256="52010375412c780b378145633a4e18abf6bde4c8e89a4cc1ad56d98fcd6120fd" \ No newline at end of file From fd6522218a9e481872bb7cd29f44bcfdedc74a86 Mon Sep 17 00:00:00 2001 From: mastereur <22839524+mastereur@users.noreply.github.com> Date: Wed, 7 Dec 2022 17:59:08 +0100 Subject: [PATCH 4/7] Remove last member option in files #88 --- hooks/post_user_create | 18 +++++++++--------- scripts/install | 6 +++--- scripts/upgrade | 1 - 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/hooks/post_user_create b/hooks/post_user_create index c240023..f25b005 100644 --- a/hooks/post_user_create +++ b/hooks/post_user_create @@ -1,7 +1,7 @@ #!/bin/bash app=__APP__ src_path=__FINALPATH__ -member=__MEMBER__ +# member=__MEMBER__ # Sync users if sudo php $src_path/scripts/user/sync_users_ldap2dolibarr.php commitiferror --server=localhost -y; then @@ -11,11 +11,11 @@ else fi # If YNH users should also be members, sync members -if [ $member -eq 1 ]; -then - if sudo php $src_path/scripts/members/sync_members_ldap2dolibarr.php commitiferror 1 --server=localhost -y; then - echo ldap member update ok - else - echo ldap member update ended with error - fi -fi +# if [ $member -eq 1 ]; +# then + # if sudo php $src_path/scripts/members/sync_members_ldap2dolibarr.php commitiferror 1 --server=localhost -y; then + # echo ldap member update ok + # else + # echo ldap member update ended with error + # fi +# fi diff --git a/scripts/install b/scripts/install index 5f72bf4..5d0e122 100644 --- a/scripts/install +++ b/scripts/install @@ -23,7 +23,7 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH admin=$YNH_APP_ARG_ADMIN -member=0 +#member=0 #is_public=0 phpversion=$YNH_PHP_VERSION @@ -49,7 +49,7 @@ 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=is_public --value=$is_public -ynh_app_setting_set --app=$app --key=member --value=$member +#ynh_app_setting_set --app=$app --key=member --value=$member ynh_app_setting_set --app=$app --key=version --value=$(ynh_app_upstream_version "../manifest.json") #================================================= @@ -232,7 +232,7 @@ ynh_replace_string --match_string="dolibarr_main_authentication='dolibarr'" --re #================================================= fhook=../hooks/post_user_create ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$fhook" -ynh_replace_string --match_string="__MEMBER__" --replace_string="$member" --target_file="$fhook" +#ynh_replace_string --match_string="__MEMBER__" --replace_string="$member" --target_file="$fhook" ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$fhook" #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 2d34b7d..bc53361 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -19,7 +19,6 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) admin=$(ynh_app_setting_get --app=$app --key=admin) -member=$(ynh_app_setting_get --app=$app --key=member) 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) From 3ee4187d60ab05f1c4af0cbbf014002cf136b04d Mon Sep 17 00:00:00 2001 From: mastereur <22839524+mastereur@users.noreply.github.com> Date: Wed, 7 Dec 2022 18:07:35 +0100 Subject: [PATCH 5/7] Fix file access --- scripts/install | 4 ++-- scripts/upgrade | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/install b/scripts/install index 5d0e122..b67eb56 100644 --- a/scripts/install +++ b/scripts/install @@ -250,10 +250,10 @@ ynh_store_file_checksum --file="$final_path/htdocs/conf/conf.php" ynh_script_progression --message="Configuring permissions..." --weight=1 # Set permissions on app files -if [ ! -f $datadir/install.lock ]; then +if [ ! -f "$datadir/install.lock" ]; then echo 'This is a lock file to prevent use of install pages (set with permission 440)' > "$datadir/install.lock" chown $app:$app "$datadir/install.lock" - chmod 440 "$datadir/install.lock" + chmod 440 "$datadir/install.lock" fi chmod 750 "$final_path" diff --git a/scripts/upgrade b/scripts/upgrade index bc53361..b825249 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -302,10 +302,10 @@ ynh_use_logrotate --non-append ynh_script_progression --message="Configuring permissions..." --weight=1 # Set permissions on app files -if [ ! -f $datadir/install.lock ]; then +if [ ! -f "$datadir/install.lock" ]; then echo 'This is a lock file to prevent use of install pages (set with permission 440)' > "$datadir/install.lock" chown $app:$app "$datadir/install.lock" - chmod 440 "$datadir/install.lock" + chmod 440 "$datadir/install.lock" fi chmod 750 "$final_path" From 1f96a65017d06e08671549e11058d5aaf4b9edb8 Mon Sep 17 00:00:00 2001 From: mastereur <22839524+mastereur@users.noreply.github.com> Date: Thu, 8 Dec 2022 09:25:17 +0100 Subject: [PATCH 6/7] fix CRC for version 12 upgrade --- scripts/upgrade.d/upgrade.11.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade.d/upgrade.11.sh b/scripts/upgrade.d/upgrade.11.sh index a07f708..b7d4982 100644 --- a/scripts/upgrade.d/upgrade.11.sh +++ b/scripts/upgrade.d/upgrade.11.sh @@ -4,4 +4,4 @@ next_version="12.0.5" # Dolibarr tarball checksum -dolibarr_source_sha256="ba9b636b95caeba72106ae6a61f25654e113817759e69a6a30ed510882d0f309" \ No newline at end of file +dolibarr_source_sha256="b60b124ebcd294375f6200cc0683449e475b5dec687f8317b820fc8ec1413d21" \ No newline at end of file From b4f0edce7c443735dc825c044507a1f327ab42cf Mon Sep 17 00:00:00 2001 From: mastereur <22839524+mastereur@users.noreply.github.com> Date: Thu, 8 Dec 2022 18:44:04 +0100 Subject: [PATCH 7/7] set version upgrade to the last one optimize hook --- hooks/post_user_create | 8 ++++---- scripts/install | 8 -------- scripts/upgrade | 6 ++++++ scripts/upgrade.d/upgrade.15.sh | 4 ++-- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/hooks/post_user_create b/hooks/post_user_create index f25b005..bd9cbd2 100644 --- a/hooks/post_user_create +++ b/hooks/post_user_create @@ -1,10 +1,10 @@ #!/bin/bash -app=__APP__ -src_path=__FINALPATH__ +app="$(basename $0 | cut -d- -f 2-)" # Extract the app name from the script name, which is supposed to be something like "50-app_id" +src_path=$(yunohost app setting $app final_path) # member=__MEMBER__ # Sync users -if sudo php $src_path/scripts/user/sync_users_ldap2dolibarr.php commitiferror --server=localhost -y; then +if sudo php "$src_path/scripts/user/sync_users_ldap2dolibarr.php" commitiferror --server=localhost -y; then echo ldap user update ok else echo ldap user update ended with error @@ -13,7 +13,7 @@ fi # If YNH users should also be members, sync members # if [ $member -eq 1 ]; # then - # if sudo php $src_path/scripts/members/sync_members_ldap2dolibarr.php commitiferror 1 --server=localhost -y; then + # if sudo php "$src_path/scripts/members/sync_members_ldap2dolibarr.php" commitiferror 1 --server=localhost -y; then # echo ldap member update ok # else # echo ldap member update ended with error diff --git a/scripts/install b/scripts/install index b67eb56..7ebde47 100644 --- a/scripts/install +++ b/scripts/install @@ -227,14 +227,6 @@ ynh_permission_update --permission="main" --remove="visitors" ynh_script_progression --message="configuring config file" --weight=1 ynh_replace_string --match_string="dolibarr_main_authentication='dolibarr'" --replace_string="dolibarr_main_authentication='http'" --target_file="$final_path/htdocs/conf/conf.php" -#================================================= -# CONFIGURE THE HOOK FILE FOR USER CREATE -#================================================= -fhook=../hooks/post_user_create -ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$fhook" -#ynh_replace_string --match_string="__MEMBER__" --replace_string="$member" --target_file="$fhook" -ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$fhook" - #================================================= # STORE THE CONFIG FILE CHECKSUM #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index b825249..cdd5f58 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -274,6 +274,12 @@ EOF done + if php$phpversion $final_path/scripts/user/sync_users_ldap2dolibarr.php commitiferror --server=localhost -y; then + ynh_print_info --message="LDAP user update ok" + else + ynh_print_info --message="LDAP user update ended with error" + fi + ynh_app_setting_set --app=$app --key=version --value=$update_version fi diff --git a/scripts/upgrade.d/upgrade.15.sh b/scripts/upgrade.d/upgrade.15.sh index d3ff37a..67585b6 100644 --- a/scripts/upgrade.d/upgrade.15.sh +++ b/scripts/upgrade.d/upgrade.15.sh @@ -1,7 +1,7 @@ #!/bin/bash # Target version of the Dolibarr update -next_version="16.0.0" +next_version="16.0.3" # Dolibarr tarball checksum -dolibarr_source_sha256="76a642d74cd3e4fe86fdeccffacd0fa2b22a398dc03e7ad92edb34d033b17b2f" \ No newline at end of file +dolibarr_source_sha256="52010375412c780b378145633a4e18abf6bde4c8e89a4cc1ad56d98fcd6120fd" \ No newline at end of file