From 2c04b6039d1dcd77a0e63c02a80bd10257058003 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 15 Jan 2020 21:40:17 +0100 Subject: [PATCH] Apply example_ynh --- README.md | 5 ++--- scripts/backup | 3 +++ scripts/install | 14 +++++++++----- scripts/remove | 8 +++++--- scripts/restore | 6 +++++- scripts/upgrade | 1 + 6 files changed, 25 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 0f056c0..3074bbb 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,6 @@ How to configure this app: Via the admin panel, a plain file with SSH, or any ot * x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/jitsi%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/jitsi/) * ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/jitsi%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/jitsi/) -* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/jitsi%20%28Apps%29.svg)](https://ci-stretch.nohost.me/ci/apps/jitsi/) ## Links @@ -57,9 +56,9 @@ How to configure this app: Via the admin panel, a plain file with SSH, or any ot Developer info ---------------- -Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/jitsi_ynh/tree/testing). +Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/jitsi_ynh/tree/testing). -To try the testing branch, do this: +To try the testing branch, please proceed like that. ``` sudo yunohost app install https://github.com/YunoHost-Apps/jitsi_ynh/tree/testing --debug or diff --git a/scripts/backup b/scripts/backup index a643a1b..032aea5 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 @@ -76,6 +77,8 @@ ynh_backup --src_path="/usr/lib/metronome/modules/mod_carbons.lua" ynh_backup --src_path="/usr/lib/metronome/modules/mod_http_altconnect.lua" ynh_backup --src_path="/usr/lib/metronome/modules/mod_smacks.lua" +#================================================= +# SPECIFIC BACKUP #================================================= # BACKUP LOGROTATE #================================================= diff --git a/scripts/install b/scripts/install index f4d7fa0..1c9d80b 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="/" @@ -67,19 +69,19 @@ ynh_app_setting_set --app=$app --key=focus_user --value=$focus_user #================================================= ynh_print_info --message="Configuring firewall..." -# Find a free port +# Find an available port port=$(ynh_find_port --port=4443) # Open this port ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port ynh_app_setting_set --app=$app --key=port --value=$port -# Find a free port +# Find an available port port_videobridge=$(ynh_find_port --port=10000) # Open this port ynh_exec_warn_less yunohost firewall allow --no-upnp UDP $port_videobridge ynh_app_setting_set --app=$app --key=port_videobridge --value=$port_videobridge -# Find a free port +# Find an available port port_component=$(ynh_find_port --port=5347) # Open this port ynh_exec_warn_less yunohost firewall allow --no-upnp TCP $port_component @@ -228,6 +230,7 @@ ynh_add_systemd_config --service=$app-jicofo --template="jitsi-jicofo.service" #================================================= # STORE THE CONFIG FILE CHECKSUM #================================================= +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="$config" @@ -237,6 +240,7 @@ ynh_store_file_checksum --file="$config" #================================================= # SECURE FILES AND DIRECTORIES #================================================= +ynh_print_info --message="Securing files and directories..." # Set permissions to app files chown -R $app: $final_path @@ -250,10 +254,10 @@ ynh_print_info --message="Configuring log rotation..." ynh_use_logrotate #================================================= -# ADVERTISE SERVICE IN ADMIN PANEL +# INTEGRATE SERVICE IN YUNOHOST #================================================= +ynh_print_info --message="Integrating service in YunoHost..." -# if using yunohost version 3.2 or more in the 'manifest.json', a description can be added yunohost service add $app-videobridge --description "$app jitsi-videobridge for jitsi" --log "/var/log/$app/$app-videobridge.log" yunohost service add $app-jicofo --description "$app jitsi-jicofo for jitsi" --log "/var/log/$app/$app-jicofo.log" diff --git a/scripts/remove b/scripts/remove index 5e501d7..52cd8b9 100644 --- a/scripts/remove +++ b/scripts/remove @@ -26,10 +26,11 @@ focus_user=$(ynh_app_setting_get --app=$app --key=focus_user) #================================================= # STANDARD REMOVE #================================================= -# REMOVE SERVICE FROM ADMIN PANEL +# REMOVE SERVICE INTEGRATION IN YUNOHOST #================================================= +ynh_print_info --message="Removing service integration in YunoHost..." -# Remove a service from the admin panel, added by `yunohost service add` +# 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-videobridge >/dev/null then ynh_print_info --message="Removing $app-videobridge service..." @@ -88,6 +89,7 @@ ynh_remove_logrotate #================================================= # CLOSE A PORT #================================================= +ynh_print_info --message="Closing a port..." if yunohost firewall list | grep -q "\- $port$" then @@ -149,7 +151,7 @@ if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then fi #================================================= -# REMOVE THE CRON FILE +# REMOVE THE LOG FILES #================================================= # Remove the log files diff --git a/scripts/restore b/scripts/restore index 32e5b88..8a1a456 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 @@ -53,6 +54,7 @@ test ! -d $final_path \ #================================================= # RESTORE THE NGINX CONFIGURATION #================================================= +ynh_print_info --message="Restoring the nginx configuration..." ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" @@ -74,6 +76,7 @@ ynh_system_user_create --username=$app --home_dir=$final_path #================================================= # RESTORE USER RIGHTS #================================================= +ynh_print_info --message="Restoring user rights..." # Restore permissions on app files chown -R root: $final_path @@ -146,8 +149,9 @@ ynh_restore_file --origin_path="/etc/systemd/system/$app-jicofo.service" systemctl enable $app-jicofo.service #================================================= -# ADVERTISE SERVICE IN ADMIN PANEL +# INTEGRATE SERVICE IN YUNOHOST #================================================= +ynh_print_info --message="Integrating service in YunoHost..." yunohost service add $app-videobridge --log "/var/log/$app/$app-videobridge.log" yunohost service add $app-jicofo --log "/var/log/$app/$app-jicofo.log" diff --git a/scripts/upgrade b/scripts/upgrade index 9bfd717..a41d072 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -221,6 +221,7 @@ ynh_add_systemd_config --service=$app-jicofo --template="jitsi-jicofo.service" #================================================= # SECURE FILES AND DIRECTORIES #================================================= +ynh_print_info --message="Securing files and directories..." # Set permissions on app files chown -R root: $final_path