From 004f5d6764e9e3bae2df9c0405d01cfa399e29fc Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 1 Jun 2019 06:55:42 +0200 Subject: [PATCH 01/10] backup config before upgrade --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 3e3b9c8..1986a42 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -153,6 +153,7 @@ popd #================================================= ynh_print_info --message="Modifying config file..." +ynh_backup_if_checksum_is_different --file="$final_path/.env" cp "../conf/.env" "$final_path/.env" if [ "$path_url" == "/" ] @@ -172,7 +173,6 @@ ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" #================================================= ynh_print_info --message="Storing the config file checksum..." -ynh_backup_if_checksum_is_different --file="$final_path/.env" # Recalculate and store the checksum of the file for the next upgrade. ynh_store_file_checksum --file="$final_path/.env" From 43d33d0096f9cb9257cbf977aa66392117e09c0c Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 13 Jun 2019 23:50:29 +0200 Subject: [PATCH 02/10] Update pull_request_template.md --- pull_request_template.md | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/pull_request_template.md b/pull_request_template.md index eaf5ac2..166771a 100644 --- a/pull_request_template.md +++ b/pull_request_template.md @@ -11,13 +11,8 @@ - [ ] Upgrade from last version tested. - [ ] Can be reviewed and tested. -## Validation +## Package_check results --- -- [ ] **Code review** -- [ ] **Approval (LGTM)** -*Code review and approval have to be from a member of @YunoHost/apps group* -- **CI succeeded** : -[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/distbin_ynh%20-BRANCH-/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/distbin_ynh%20-BRANCH-/) -*Please replace '-BRANCH-' in this link by the name of the branch used.* -*If the PR is from a forked repository. Please provide public results from package_check.* -When the PR is marked as ready to merge, you have to wait for 3 days before really merging it. +*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/distbin_ynh%20PR-NUM-%20(USERNAME)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/distbin_ynh%20PR-NUM-%20(USERNAME)/) From 935aab3510a45a4a52e6214696aee66990e8810d Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 16 Jun 2019 15:58:12 +0200 Subject: [PATCH 03/10] Update check_process --- check_process | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/check_process b/check_process index 1be4578..ed670d6 100644 --- a/check_process +++ b/check_process @@ -19,23 +19,13 @@ upgrade=1 from_commit=b01da8e6f8d621a1b9c7aec4b82bbe96c0e7cc03 backup_restore=1 multi_instance=1 - incorrect_path=1 + # This test is no longer necessary since the version 2.7 (PR: https://github.com/YunoHost/yunohost/pull/304), you can still do it if your app could be installed with this version. + # incorrect_path=1 port_already_use=0 change_url=1 ;;; Levels - Level 1=auto - Level 2=auto - Level 3=auto -# Level 4: If the app supports LDAP and SSOwat, turn level 4 to '1' and add a link to an issue or a part of your code to show it. -# If the app does not use LDAP nor SSOwat, and can't use them, turn level 4 to 'na' and explain as well. - # https://github.com/YunoHost-Apps/distbin_ynh/issues/18 - Level 4=na + # If the level 5 (Package linter) is forced to 1. Please add justifications here. Level 5=auto - Level 6=auto - Level 7=auto - Level 8=0 - Level 9=0 - Level 10=0 ;;; Options Email=yalh@yahoo.com Notification=all From 60112062ba064730d79d6488cfabe88ae433db60 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 13 Jul 2019 15:24:19 +0200 Subject: [PATCH 04/10] Update README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index c7e171a..aeaa0f5 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,6 @@ The app can be used by multiple users, anonymously. Developers info ---------------- -**Only if you want to use a testing branch for coding, instead of merging directly into master.** Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/distbin_ynh/tree/testing). To try the testing branch, please proceed like that. From cc0c9d0df11872d753a87411de8725eb366217b4 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 29 Dec 2019 17:43:56 +0100 Subject: [PATCH 05/10] Applu example_ynh --- scripts/backup | 14 ++++++++++++++ scripts/change_url | 30 +++++++++++++++++++++++++----- scripts/install | 31 +++++++++++++++++++------------ scripts/remove | 8 ++++---- scripts/restore | 6 ++---- scripts/upgrade | 26 +++++++++++++------------- 6 files changed, 77 insertions(+), 38 deletions(-) diff --git a/scripts/backup b/scripts/backup index fd087db..12c2189 100644 --- a/scripts/backup +++ b/scripts/backup @@ -32,6 +32,13 @@ domain=$(ynh_app_setting_get --app=$app --key=domain) #================================================= # STANDARD BACKUP STEPS +#================================================= +# STOP SYSTEMD SERVICE +#================================================= +ynh_print_info --message="Stopping a systemd service..." + +ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped Distbin Service" + #================================================= # BACKUP THE APP MAIN DIR #================================================= @@ -62,6 +69,13 @@ ynh_print_info --message="Backing up systemd configuration..." ynh_backup --src_path="/etc/systemd/system/$app.service" +#================================================= +# START SYSTEMD SERVICE +#================================================= +ynh_script_progression --message="Starting a systemd service..." --time --weight=1 + +ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Started Distbin Service" + #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/change_url b/scripts/change_url index 5ab9bed..bf2597a 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -35,6 +35,23 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) port=$(ynh_app_setting_get --app=$app --key=port) +#================================================= +# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +#================================================= +ynh_script_progression --message="Backing up the app before changing its url (may take a while)..." --time --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 #================================================= @@ -58,7 +75,7 @@ fi #================================================= ynh_print_info --message="Stopping a systemd service..." -ynh_systemd_action --service_name=$app --action=stop --log_path=systemd --line_match="Stopped Distbin Service" +ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped Distbin Service" #================================================= # MODIFY URL IN NGINX CONF @@ -96,6 +113,9 @@ fi #================================================= ynh_print_info --message="Modifying config file..." +config="$final_path/.env" +ynh_backup_if_checksum_is_different --file="$config" + # Change the URL in the configuration file if [ "$new_path" == "/" ] @@ -105,16 +125,16 @@ else new_domain_uri="$new_domain$new_path" fi -ynh_replace_string --match_string="EXTERNAL_URL=.*" --replace_string="EXTERNAL_URL=https://$new_domain_uri/" --target_file="$final_path/.env" +ynh_replace_string --match_string="EXTERNAL_URL=.*" --replace_string="EXTERNAL_URL=https://$new_domain_uri/" --target_file="$config" #================================================= # STORE THE CONFIG FILE CHECKSUM #================================================= ynh_print_info --message="Storing the config file checksum..." -ynh_backup_if_checksum_is_different --file="$final_path/.env" + # Recalculate and store the checksum of the file for the next upgrade. -ynh_store_file_checksum --file="$final_path/.env" +ynh_store_file_checksum --file="$config" #================================================= # GENERIC FINALISATION @@ -131,7 +151,7 @@ sleep 10 #================================================= ynh_print_info --message="Reloading nginx web server..." -systemctl reload nginx +ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index 899e2b7..2905392 100644 --- a/scripts/install +++ b/scripts/install @@ -56,10 +56,17 @@ ynh_app_setting_set --app=$app --key=is_public --value=$is_public #================================================= ynh_print_info --message="Configuring firewall..." -# Find a free port +# Find an available port port=$(ynh_find_port --port=8095) ynh_app_setting_set --app=$app --key=port --value=$port +# Optional: Expose this port publicly +# (N.B. : you only need to do this if the app actually needs to expose the port publicly. +# If you do this and the app doesn't actually need you are CREATING SECURITY HOLES IN THE SERVER !) + +# Open the port +# ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port + #================================================= # INSTALL DEPENDENCIES #================================================= @@ -143,7 +150,8 @@ ynh_add_systemd_config #================================================= ynh_print_info --message="Modifying a config file..." -cp "../conf/.env" "$final_path/.env" +config="$final_path/.env" +cp "../conf/.env" "$config" if [ "$path_url" == "/" ] then @@ -152,10 +160,10 @@ else domain_uri="$domain$path_url" fi -ynh_replace_string --match_string="__NODEJS_PATH__" --replace_string="$nodejs_path" --target_file="$final_path/.env" -ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/.env" -ynh_replace_string --match_string="__DOMAIN_URI__" --replace_string="$domain_uri" --target_file="$final_path/.env" -ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$final_path/.env" +ynh_replace_string --match_string="__NODEJS_PATH__" --replace_string="$nodejs_path" --target_file="$config" +ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$config" +ynh_replace_string --match_string="__DOMAIN_URI__" --replace_string="$domain_uri" --target_file="$config" +ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$config" #================================================= # STORE THE CONFIG FILE CHECKSUM @@ -163,7 +171,7 @@ ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" ynh_print_info --message="Storing the config file checksum..." # Calculate and store the config file checksum into the app settings -ynh_store_file_checksum --file="$final_path/.env" +ynh_store_file_checksum --file="$config" #================================================= # GENERIC FINALIZATION @@ -184,12 +192,10 @@ ynh_print_info --message="Configuring log rotation..." ynh_use_logrotate #================================================= -# ADVERTISE SERVICE IN ADMIN PANEL +# INTEGRATE SERVICE IN YUNOHOST #================================================= -ynh_print_info --message="Advertising service in admin panel..." +ynh_print_info --message="Integrate service in YunoHost..." -#yunohost service add $app --log "/var/log/$app/$app.log" -# if using yunohost version 3.2 or more in the 'manifest.json', a description can be added yunohost service add $app --description "$app daemon for distbin" --log "/var/log/$app/$app.log" #================================================= @@ -197,7 +203,8 @@ yunohost service add $app --description "$app daemon for distbin" --log "/var/lo #================================================= ynh_print_info --message="Starting a systemd service..." -ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="Started Distbin Service" +# Start a systemd service +ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Started Distbin Service" sleep 10 #================================================= diff --git a/scripts/remove b/scripts/remove index e1a3a52..5bd9758 100644 --- a/scripts/remove +++ b/scripts/remove @@ -23,11 +23,11 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # STANDARD REMOVE #================================================= -# REMOVE SERVICE FROM ADMIN PANEL +# REMOVE SERVICE INTEGRATION IN YUNOHOST #================================================= -# Remove a service from the admin panel, added by `yunohost service add` -if yunohost service status $app >/dev/null 2>&1 +# Remove the service from the list of services known by Yunohost (added from `yunohost service add`) +if ynh_exec_warn_less yunohost service status $app >/dev/null then ynh_print_info --message="Removing $app service..." yunohost service remove $app @@ -87,7 +87,7 @@ fi #================================================= # SPECIFIC REMOVE #================================================= -# REMOVE FILE +# REMOVE THE LOG FILES #================================================= # Remove the log files diff --git a/scripts/restore b/scripts/restore index 55505bd..3530d57 100644 --- a/scripts/restore +++ b/scripts/restore @@ -8,7 +8,6 @@ #Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh -source ../settings/scripts/ynh_systemd_action source /usr/share/yunohost/helpers #================================================= @@ -99,10 +98,9 @@ ynh_print_info --message="Restoring the systemd configuration..." ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service -systemctl daemon-reload #================================================= -# ADVERTISE SERVICE IN ADMIN PANEL +# INTEGRATE SERVICE IN YUNOHOST #================================================= ynh_print_info --message="Advertising service in admin panel..." @@ -113,7 +111,7 @@ yunohost service add $app --log "/var/log/$app/$app.log" #================================================= ynh_print_info --message="Starting a systemd service..." -ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="Started Distbin Service" +ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Started Distbin Service" sleep 10 #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 1986a42..d14e122 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -70,17 +70,16 @@ ynh_abort_if_errors #================================================= ynh_print_info --message="Stopping a systemd service..." -ynh_systemd_action --service_name=$app --action=stop +ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped Distbin Service" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_print_info --message="Upgrading source files..." -# Download, check integrity, uncompress and patch the source from app.src# if [ "$upgrade_type" == "UPGRADE_APP" ] then - ynh_script_progression --message="Upgrading source files..." --time --weight=1 + ynh_print_info --message="Upgrading source files..." # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" @@ -132,9 +131,9 @@ if [ -d "$DIRECTORY" ]; then fi #================================================= -# MAKE INSTALL +# MAKE UPGRADE #================================================= -ynh_print_info --message="Making install..." +ynh_print_info --message="Making upgrade..." chown -R "$app":"$app" "$final_path" pushd $final_path @@ -153,8 +152,9 @@ popd #================================================= ynh_print_info --message="Modifying config file..." -ynh_backup_if_checksum_is_different --file="$final_path/.env" -cp "../conf/.env" "$final_path/.env" +config="$final_path/.env" +ynh_backup_if_checksum_is_different --file="$config" +cp -f "../conf/.env" "$config" if [ "$path_url" == "/" ] then @@ -163,10 +163,10 @@ else domain_uri="$domain$path_url" fi -ynh_replace_string --match_string="__NODEJS_PATH__" --replace_string="$nodejs_path" --target_file="$final_path/.env" -ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/.env" -ynh_replace_string --match_string="__DOMAIN_URI__" --replace_string="$domain_uri" --target_file="$final_path/.env" -ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$final_path/.env" +ynh_replace_string --match_string="__NODEJS_PATH__" --replace_string="$nodejs_path" --target_file="$config" +ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$config" +ynh_replace_string --match_string="__DOMAIN_URI__" --replace_string="$domain_uri" --target_file="$config" +ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$config" #================================================= # STORE THE CONFIG FILE CHECKSUM @@ -174,7 +174,7 @@ ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" ynh_print_info --message="Storing the config file checksum..." # Recalculate and store the checksum of the file for the next upgrade. -ynh_store_file_checksum --file="$final_path/.env" +ynh_store_file_checksum --file="$config" #================================================= # SETUP LOGROTATE @@ -219,7 +219,7 @@ fi #================================================= ynh_print_info --message="Starting a systemd service..." -ynh_systemd_action --action=start --service_name=$app --log_path=systemd --line_match="Started Distbin Service" +ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Started Distbin Service" sleep 10 #================================================= From 7093d3484cdd6fd5f64104bfeb79c4a7a796c390 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 29 Dec 2019 17:46:00 +0100 Subject: [PATCH 06/10] Update README.md --- README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index aeaa0f5..6fddd7e 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ A networked place to store posted web documents. This is meant to allow for dist ## Configuration -No configuration parameter available for now. +No configuration parameters available for now. ## YunoHost specific features @@ -37,17 +37,16 @@ The app can be used by multiple users, anonymously. * x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/distbin%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/distbin/) * ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/distbin%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/distbin/) -* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/distbin%20%28Apps%29.svg)](https://ci-stretch.nohost.me/ci/apps/distbin/) ## Limitations -* No known limitations. But still developping. +* No known limitations. ## Links * Report a bug: https://github.com/YunoHost-Apps/distbin_ynh/issues * App website: https://distbin.com/about - * GitHub website: https://github.com/gobengo/distbin + * Upstream app repository: https://github.com/gobengo/distbin * YunoHost website: https://yunohost.org/ --- From c0bb9919d83c9c6394453d16cf7f2bc7788c9d2d Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 29 Dec 2019 17:49:45 +0100 Subject: [PATCH 07/10] remove ynh_script_progression --- scripts/backup | 2 +- scripts/change_url | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/backup b/scripts/backup index 12c2189..93bad30 100644 --- a/scripts/backup +++ b/scripts/backup @@ -72,7 +72,7 @@ ynh_backup --src_path="/etc/systemd/system/$app.service" #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --time --weight=1 +ynh_print_info --message="Starting a systemd service..." ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Started Distbin Service" diff --git a/scripts/change_url b/scripts/change_url index bf2597a..b71033e 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -38,7 +38,7 @@ port=$(ynh_app_setting_get --app=$app --key=port) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before changing its url (may take a while)..." --time --weight=1 +ynh_print_info --message="Backing up the app before changing its url (may take a while)..." # Backup the current version of the app ynh_backup_before_upgrade From 9c37d1d8deb0318311eb907c02cbcdedd8fff014 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 29 Dec 2019 22:13:51 +0100 Subject: [PATCH 08/10] Adding time for package_check --- scripts/backup | 3 +++ scripts/install | 4 +++- scripts/restore | 4 +++- scripts/upgrade | 4 +++- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/scripts/backup b/scripts/backup index 93bad30..839de19 100644 --- a/scripts/backup +++ b/scripts/backup @@ -75,6 +75,9 @@ ynh_backup --src_path="/etc/systemd/system/$app.service" ynh_print_info --message="Starting a systemd service..." ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Started Distbin Service" +if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then + sleep 60 +fi #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index 2905392..31e0d95 100644 --- a/scripts/install +++ b/scripts/install @@ -205,7 +205,9 @@ ynh_print_info --message="Starting a systemd service..." # Start a systemd service ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Started Distbin Service" -sleep 10 +if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then + sleep 60 +fi #================================================= # SETUP SSOWAT diff --git a/scripts/restore b/scripts/restore index 3530d57..8666c8a 100644 --- a/scripts/restore +++ b/scripts/restore @@ -112,7 +112,9 @@ yunohost service add $app --log "/var/log/$app/$app.log" ynh_print_info --message="Starting a systemd service..." ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Started Distbin Service" -sleep 10 +if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then + sleep 60 +fi #================================================= # RESTORE THE LOGROTATE CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index d14e122..b0ee263 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -220,7 +220,9 @@ fi ynh_print_info --message="Starting a systemd service..." ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Started Distbin Service" -sleep 10 +if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then + sleep 60 +fi #================================================= # RELOAD NGINX From 00d62f142415d5a86a0316d4d376ac2f32298841 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 29 Dec 2019 22:58:21 +0100 Subject: [PATCH 09/10] Applying example_ynh --- scripts/backup | 1 + scripts/change_url | 7 ++++--- scripts/install | 4 +++- scripts/remove | 1 + scripts/restore | 7 ++++--- scripts/upgrade | 4 +++- 6 files changed, 16 insertions(+), 8 deletions(-) diff --git a/scripts/backup b/scripts/backup index 839de19..0f1ed89 100644 --- a/scripts/backup +++ b/scripts/backup @@ -13,6 +13,7 @@ source /usr/share/yunohost/helpers #================================================= # MANAGE SCRIPT FAILURE #================================================= +ynh_print_info --message="Managing script failure..." ynh_clean_setup () { ynh_clean_check_starting diff --git a/scripts/change_url b/scripts/change_url index b71033e..19f83af 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -33,7 +33,6 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #db_name=$(ynh_app_setting_get --app=$app --key=db_name) #db_user=$db_name #db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) -port=$(ynh_app_setting_get --app=$app --key=port) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP @@ -143,8 +142,10 @@ ynh_store_file_checksum --file="$config" #================================================= ynh_print_info --message="Starting a systemd service..." -ynh_systemd_action --action=start --service_name=$app --log_path=systemd --line_match="Started Distbin Service" -sleep 10 +ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Started Distbin Service" +if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then + sleep 60 +fi #================================================= # RELOAD NGINX diff --git a/scripts/install b/scripts/install index 31e0d95..b5ec2b6 100644 --- a/scripts/install +++ b/scripts/install @@ -12,6 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # MANAGE SCRIPT FAILURE #================================================= +ynh_print_info --message="Managing script failure..." ynh_clean_setup () { ynh_clean_check_starting @@ -22,6 +23,7 @@ ynh_abort_if_errors #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= +ynh_print_info --message="Retrieving arguments from the manifest..." domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH @@ -194,7 +196,7 @@ ynh_use_logrotate #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= -ynh_print_info --message="Integrate service in YunoHost..." +ynh_print_info --message="Integrating service in YunoHost..." yunohost service add $app --description "$app daemon for distbin" --log "/var/log/$app/$app.log" diff --git a/scripts/remove b/scripts/remove index 5bd9758..58f38a3 100644 --- a/scripts/remove +++ b/scripts/remove @@ -25,6 +25,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # REMOVE SERVICE INTEGRATION IN YUNOHOST #================================================= +ynh_print_info --message="Removing service integration in YunoHost..." # Remove the service from the list of services known by Yunohost (added from `yunohost service add`) if ynh_exec_warn_less yunohost service status $app >/dev/null diff --git a/scripts/restore b/scripts/restore index 8666c8a..a6045d8 100644 --- a/scripts/restore +++ b/scripts/restore @@ -13,6 +13,7 @@ source /usr/share/yunohost/helpers #================================================= # MANAGE SCRIPT FAILURE #================================================= +ynh_print_info --message="Managing script failure..." ynh_clean_setup () { ynh_clean_check_starting @@ -67,7 +68,7 @@ ynh_system_user_create --username=$app --home_dir=$final_path #================================================= # RESTORE USER RIGHTS #================================================= -ynh_print_info --message="Securing files and directories..." +ynh_print_info --message="Restoring user rights..." # Restore permissions on app files chown -R "$app":"$app" "$final_path" @@ -102,9 +103,9 @@ systemctl enable $app.service #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= -ynh_print_info --message="Advertising service in admin panel..." +ynh_print_info --message="Integrating service in YunoHost..." -yunohost service add $app --log "/var/log/$app/$app.log" +yunohost service add $app --description "$app daemon for distbin" --log "/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE diff --git a/scripts/upgrade b/scripts/upgrade index b0ee263..744f2ba 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -98,8 +98,9 @@ ynh_add_nginx_config #================================================= ynh_print_info --message="Upgrading dependencies..." -ynh_install_app_dependencies $pkg_dependencies +ynh_remove_nodejs ynh_install_nodejs --nodejs_version="10" +ynh_install_app_dependencies $pkg_dependencies #================================================= # CREATE DEDICATED USER @@ -136,6 +137,7 @@ fi ynh_print_info --message="Making upgrade..." chown -R "$app":"$app" "$final_path" + pushd $final_path ynh_use_nodejs sudo -u $app env PATH=$PATH npm install --ignore-scripts From d6ab90413fee2f1866bf9e55ee78990da502be93 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Mon, 30 Dec 2019 21:20:46 +0100 Subject: [PATCH 10/10] Fix missing port --- scripts/change_url | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/change_url b/scripts/change_url index 19f83af..11f0468 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -33,6 +33,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #db_name=$(ynh_app_setting_get --app=$app --key=db_name) #db_user=$db_name #db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) +port=$(ynh_app_setting_get --app=$app --key=port) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP