From 76d0ed0a809cd019981a4b63cc9c8f2ace2ae913 Mon Sep 17 00:00:00 2001 From: Robles Rodolphe Date: Sat, 17 Apr 2021 15:43:27 +0200 Subject: [PATCH 1/2] make first this branch equal as master branch --- conf/0.9.8.src | 6 ++++ manifest.json | 2 +- scripts/install | 2 +- scripts/upgrade | 79 ++++++++++++++++++++++++++++++++++++++++++++----- 4 files changed, 80 insertions(+), 9 deletions(-) create mode 100644 conf/0.9.8.src diff --git a/conf/0.9.8.src b/conf/0.9.8.src new file mode 100644 index 0000000..0be6dec --- /dev/null +++ b/conf/0.9.8.src @@ -0,0 +1,6 @@ +SOURCE_URL=https://fossil.kd2.org/garradin/uv/garradin-0.9.8.1.tar.bz2 +SOURCE_SUM=7cc64b51c9721c2dd7ee510f245bcfc4693ee07f74581ad74003906eb4716ef1 +SOURCE_SUM_PRG=sha256sum +SOURCE_FORMAT=tar.bz2 +SOURCE_IN_SUBDIR=true +SOURCE_FILENAME= \ No newline at end of file diff --git a/manifest.json b/manifest.json index 0545d5b..2460e78 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.0.7~ynh1", + "version": "1.0.7~ynh2", "url": "http://garradin.eu/a-propos/", "license": "GPL-3.0-or-later", "maintainer": { diff --git a/scripts/install b/scripts/install index 9ff666a..9d138fd 100644 --- a/scripts/install +++ b/scripts/install @@ -130,4 +130,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of Garradin completed" --last +ynh_script_progression --message="Installation of Garradin completed" --last \ No newline at end of file diff --git a/scripts/upgrade b/scripts/upgrade index cb15d46..00e6678 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -24,13 +24,14 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # CHECK VERSION #================================================= + if ynh_compare_current_package_version --comparison lt --version 0.9.8.1~ynh1; then - ynh_print_info --message="Sorry your version is outdated and need first an update to version 0.9.8.1 with the branch 0.9.8, proceed like that: 'sudo yunohost app upgrade garradin -u https://github.com/YunoHost-Apps/garradin_ynh/tree/0.9.8 --debug' and open your admin page to finalize before next update" - ynh_die "Sorry your version is outdated and need first an update to version 0.9.8.1 with the branch 0.9.8, proceed like that: 'sudo yunohost app upgrade garradin -u https://github.com/YunoHost-Apps/garradin_ynh/tree/0.9.8 --debug' and open your admin page to finalize before next update" + upgrade_type="0.9.8" else upgrade_type=$(ynh_check_app_version_changed) fi + #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= @@ -66,17 +67,73 @@ ynh_script_progression --message="Backing up Garradin before upgrading (may take # Backup the current version of the app ynh_backup_before_upgrade ynh_clean_setup () { - # restore it if the upgrade fails - ynh_restore_upgradebackup + # restore it if the upgrade fails + ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script ynh_abort_if_errors + +#================================================= +# UPGRADE TO 0.9.8 if necessary +#================================================= + +if [ "$upgrade_type" == "0.9.8" ] +then + ynh_script_progression --message="Upgrading upgrade to 0.9.8" --weight=5 + # Download, check integrity, uncompress and patch the source from 0.9.8.src + ynh_setup_source --dest_dir="$final_path" --source_id="0.9.8" + # Set permissions on app files + ynh_system_user_create --username=$app + ynh_add_nginx_config + ynh_add_fpm_config --package="$extra_php_dependencies" + phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) + ynh_script_progression --message="restore data..." --weight=10 + + backup_bdd=/tmp/association.sqlite + backup_squelettes=/tmp/squelettes + + if [ -d "$backup_squelettes" ] + then + cp -ar $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 + ynh_secure_remove $backup_bdd + fi + + key=$(ynh_string_random --length=50) + cp -a $final_path/config.dist.php $final_path/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 + chown $app:$app $final_path -R + chmod 755 $final_path -R + # Create the visitors permission if needed + if ! ynh_permission_exists --permission "visitors"; then + ynh_permission_create --permission "visitors" + fi + + ynh_systemd_action --service_name=nginx --action=reload + #finalyse upgrade + ynh_local_curl "/index.php" + sleep 5 + ynh_local_curl "/index.php" + upgrade_type="UPGRADE_APP" +fi + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= 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 @@ -115,7 +172,7 @@ ynh_script_progression --message="restore data..." --weight=10 backup_bdd=/tmp/association.sqlite backup_squelettes=/tmp/squelettes -if [ -d "$backup_squelettes" ] +if [ -d "$backup_squelettes" ] then cp -ar $backup_squelettes $final_path/www/squelettes ynh_secure_remove $backup_squelettes @@ -123,7 +180,7 @@ 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 @@ -161,8 +218,16 @@ ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload +#================================================= +# Finalise Upgrade +#================================================= + +ynh_script_progression --message="Finalise upgrade" --weight=1 + +ynh_local_curl "/admin/index.php" + #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of Garradin completed" --last +ynh_script_progression --message="Upgrade of Garradin completed" --last \ No newline at end of file From f5661c7c5bf4e0d0a783d0105257f9f7e14938ba Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 5 May 2021 09:53:40 +0200 Subject: [PATCH 2/2] upgrades --- README.md | 2 +- README_fr.md | 10 +++++----- check_process | 2 -- manifest.json | 2 +- pull_request_template.md | 4 +--- scripts/change_url | 18 +++++++++++++++++- scripts/install | 15 +++++---------- scripts/upgrade | 35 ++++++++++++++++------------------- 8 files changed, 46 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index eb6ff36..c4a7d30 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Garradin for YunoHost -[![Integration level](https://dash.yunohost.org/integration/garradin.svg)](https://dash.yunohost.org/appci/app/garradin) ![](https://ci-apps.yunohost.org/ci/badges/garradin.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/garradin.maintain.svg) +[![Integration level](https://dash.yunohost.org/integration/garradin.svg)](https://dash.yunohost.org/appci/app/garradin) ![](https://ci-apps.yunohost.org/ci/badges/garradin.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/garradin.maintain.svg) [![Install Garradin with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=garradin) *[Lire ce readme en français.](./README_fr.md)* diff --git a/README_fr.md b/README_fr.md index d472910..1664431 100644 --- a/README_fr.md +++ b/README_fr.md @@ -1,12 +1,12 @@ # Garradin pour YunoHost -[![Niveau d'intégration](https://dash.yunohost.org/integration/garradin.svg)](https://dash.yunohost.org/appci/app/garradin) ![](https://ci-apps.yunohost.org/ci/badges/garradin.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/garradin.maintain.svg) -[![Installer Garradin avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=garradin) +[![Niveau d'intégration](https://dash.yunohost.org/integration/garradin.svg)](https://dash.yunohost.org/appci/app/garradin) ![](https://ci-apps.yunohost.org/ci/badges/garradin.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/garradin.maintain.svg) +[![Installer Garradin avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=garradin) *[Read this readme in english.](./README.md)* > *Ce package vous permet d'installer Garradin 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.* +Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/install) pour apprendre comment l'installer.* ## Vue d'ensemble Garradin est un logiciel libre de gestion associative. il permet de gérer des membres. @@ -37,8 +37,8 @@ Garradin est un logiciel libre de gestion associative. il permet de gérer des m #### Architectures supportées -* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/garradin%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/garradin/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/garradin%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/garradin/) +* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/garradin.svg)](https://ci-apps.yunohost.org/ci/apps/garradin/) +* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/garradin.svg)](https://ci-apps-arm.yunohost.org/ci/apps/garradin/) ## Limitations diff --git a/check_process b/check_process index 0b2b1d0..cc22c57 100644 --- a/check_process +++ b/check_process @@ -13,6 +13,4 @@ upgrade=1 backup_restore=1 multi_instance=1 - incorrect_path=1 - port_already_use=0 change_url=1 diff --git a/manifest.json b/manifest.json index 2460e78..dd7aef1 100644 --- a/manifest.json +++ b/manifest.json @@ -14,7 +14,7 @@ "email": "win10@tutanota.com" }, "requirements": { - "yunohost": ">=4.0" + "yunohost": ">=4.1.7" }, "multi_instance": true, "services": [ diff --git a/pull_request_template.md b/pull_request_template.md index b8b0a14..6c28fc5 100644 --- a/pull_request_template.md +++ b/pull_request_template.md @@ -13,6 +13,4 @@ ## Package_check results --- -*If you have access to [App Continuous Integration for packagers](https://yunohost.org/#/packaging_apps_ci) you can provide a link to the package_check results like below, replacing '-NUM-' in this link by the PR number and USERNAME by your username on the ci-apps-dev. Or you provide a screenshot or a pastebin of the results* - -[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/garradin_ynh%20PR-NUM-%20(USERNAME)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/garradin_ynh%20PR-NUM-%20(USERNAME)/) +* An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"* diff --git a/scripts/change_url b/scripts/change_url index 88940e9..68e37e3 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -8,7 +8,6 @@ source _common.sh source /usr/share/yunohost/helpers -ynh_abort_if_errors #================================================= # RETRIEVE ARGUMENTS @@ -30,6 +29,23 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 # Needed for helper "ynh_add_nginx_config" final_path=$(ynh_app_setting_get --app=$app --key=final_path) +#================================================= +# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP +#================================================= +ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1 + +# Backup the current version of the app +ynh_backup_before_upgrade +ynh_clean_setup () { + # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. + ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" + + # Restore it if the upgrade fails + ynh_restore_upgradebackup +} +# Exit if an error occurs during the execution of the script +ynh_abort_if_errors + #================================================= # CHECK WHICH PARTS SHOULD BE CHANGED #================================================= diff --git a/scripts/install b/scripts/install index 9d138fd..c1d7b78 100644 --- a/scripts/install +++ b/scripts/install @@ -23,6 +23,7 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH is_public=$YNH_APP_ARG_IS_PUBLIC + app=$YNH_APP_INSTANCE_NAME #================================================= @@ -84,11 +85,9 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) # Files owned by user app #================================================= -chown $app:$app $final_path -R -chmod 755 $final_path -R +chown -R $app:$app $final_path +chmod 755 $final_path -# Remove the public access -ynh_app_setting_delete --app=$app --key=skipped_uris #================================================= # SETUP SSOWAT #================================================= @@ -97,12 +96,8 @@ ynh_script_progression --message="Configuring permissions..." --weight=8 # Make app public if necessary if [ $is_public -eq 1 ] then - # Everyone can access the app. - # The "main" permission is automatically created before the install script. - ynh_permission_update --permission "main" --add "visitors" + ynh_permission_update --permission="main" --add="visitors" fi -# Only the users can access to the panel of the app -# ynh_permission_update --permission="main" --add "all_users" #================================================= # MODIFY A CONFIG FILE @@ -130,4 +125,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of Garradin completed" --last \ No newline at end of file +ynh_script_progression --message="Installation of Garradin completed" --last diff --git a/scripts/upgrade b/scripts/upgrade index 00e6678..7084a31 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -31,7 +31,6 @@ else upgrade_type=$(ynh_check_app_version_changed) fi - #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= @@ -43,6 +42,13 @@ if [ -z "$final_path" ]; then ynh_app_setting_set --app=$app --key=final_path --value=$final_path fi +# Cleaning legacy permissions +if ynh_legacy_permissions_exists; then + ynh_legacy_permissions_delete_all + + ynh_app_setting_delete --app=$app --key=is_public +fi + #================================================= # Backup Data #================================================= @@ -113,11 +119,12 @@ 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 - chown $app:$app $final_path -R - chmod 755 $final_path -R + chown -R $app:$app $final_path + chmod 755 $final_path # Create the visitors permission if needed - if ! ynh_permission_exists --permission "visitors"; then - ynh_permission_create --permission "visitors" + if [ $is_public -eq 1 ] + then + ynh_permission_update --permission="main" --add="visitors" fi ynh_systemd_action --service_name=nginx --action=reload @@ -164,6 +171,7 @@ ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2 # Create a dedicated PHP-FPM config ynh_add_fpm_config --package="$extra_php_dependencies" phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) + #======================================================= # backup bdd, squelettes directory and config.local.php #======================================================= @@ -198,18 +206,8 @@ fi #================================================= # Set permissions on app files -chown $app:$app $final_path -R -chmod 755 $final_path -R - -#================================================= -# SETUP SSOWAT -#================================================= -ynh_script_progression --message="Upgrading permissions configuration..." --weight=2 - -# Create the visitors permission if needed -if ! ynh_permission_exists --permission "visitors"; then - ynh_permission_create --permission "visitors" -fi +chown -R $app:$app $final_path +chmod 755 $final_path #================================================= # RELOAD NGINX @@ -221,7 +219,6 @@ ynh_systemd_action --service_name=nginx --action=reload #================================================= # Finalise Upgrade #================================================= - ynh_script_progression --message="Finalise upgrade" --weight=1 ynh_local_curl "/admin/index.php" @@ -230,4 +227,4 @@ ynh_local_curl "/admin/index.php" # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of Garradin completed" --last \ No newline at end of file +ynh_script_progression --message="Upgrade of Garradin completed" --last