From 36c607e9187e3a59b04de2b054467f606b648f64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 1 Jul 2024 15:29:07 +0200 Subject: [PATCH 01/15] Handle bookworm having metronome as an app --- doc/DESCRIPTION.md | 2 +- manifest.toml | 13 ++++++++++++- tests.toml | 10 +++++++++- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md index 4f147e0..b3b4312 100644 --- a/doc/DESCRIPTION.md +++ b/doc/DESCRIPTION.md @@ -1 +1 @@ -XMPP gateway for the IRC network \ No newline at end of file +XMPP gateway for the IRC network. Needs Metronome. diff --git a/manifest.toml b/manifest.toml index c6368a8..33a23f6 100644 --- a/manifest.toml +++ b/manifest.toml @@ -1,3 +1,5 @@ +#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json + packaging_format = 2 id = "biboumi" @@ -45,7 +47,16 @@ ram.runtime = "50M" [resources.install_dir] + [resources.data_dir] + dir = "/var/lib/__APP__" + [resources.permissions] [resources.apt] - packages = "metronome, biboumi" + packages = [ "biboumi", ] + + packages_from_raw_bash = """ + if [[ $YNH_DEBIAN_VERSION == "bullseye" ]]; then + echo "metronome"; + fi + """ diff --git a/tests.toml b/tests.toml index eb73b8d..70ff51b 100644 --- a/tests.toml +++ b/tests.toml @@ -1,3 +1,11 @@ +#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/tests.v1.schema.json + test_format = 1.0 -[default] \ No newline at end of file +[default] + + preinstall = """" + if cat /etc/os-release | grep --quiet bookworm 2>/dev/null; then + yunohost app install --force https://github.com/yunoHost-Apps/metronome_ynh -a 'domain=domain.tld&init_main_permission=visitors' + fi + """ From 066e0e117891dbce21d1f1d7d79f3e5dc17a433e Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Mon, 1 Jul 2024 13:29:45 +0000 Subject: [PATCH 02/15] Auto-update READMEs --- README.md | 3 ++- README_es.md | 3 ++- README_eu.md | 3 ++- README_fr.md | 3 ++- README_gl.md | 3 ++- README_zh_Hans.md | 3 ++- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 4d9c158..154d3d2 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,8 @@ It shall NOT be edited by hand. ## Overview -XMPP gateway for the IRC network +XMPP gateway for the IRC network. Needs Metronome. + **Shipped version:** 8.3~ynh3 ## Documentation and resources diff --git a/README_es.md b/README_es.md index 5be99ef..9bbf03d 100644 --- a/README_es.md +++ b/README_es.md @@ -16,7 +16,8 @@ No se debe editar a mano. ## Descripción general -XMPP gateway for the IRC network +XMPP gateway for the IRC network. Needs Metronome. + **Versión actual:** 8.3~ynh3 ## Documentaciones y recursos diff --git a/README_eu.md b/README_eu.md index f95293d..af4be8e 100644 --- a/README_eu.md +++ b/README_eu.md @@ -16,7 +16,8 @@ EZ editatu eskuz. ## Aurreikuspena -XMPP gateway for the IRC network +XMPP gateway for the IRC network. Needs Metronome. + **Paketatutako bertsioa:** 8.3~ynh3 ## Dokumentazioa eta baliabideak diff --git a/README_fr.md b/README_fr.md index 6daa265..524b417 100644 --- a/README_fr.md +++ b/README_fr.md @@ -16,7 +16,8 @@ Il NE doit PAS être modifié à la main. ## Vue d’ensemble -XMPP gateway for the IRC network +XMPP gateway for the IRC network. Needs Metronome. + **Version incluse :** 8.3~ynh3 ## Documentations et ressources diff --git a/README_gl.md b/README_gl.md index c155820..80c6a48 100644 --- a/README_gl.md +++ b/README_gl.md @@ -16,7 +16,8 @@ NON debe editarse manualmente. ## Vista xeral -XMPP gateway for the IRC network +XMPP gateway for the IRC network. Needs Metronome. + **Versión proporcionada:** 8.3~ynh3 ## Documentación e recursos diff --git a/README_zh_Hans.md b/README_zh_Hans.md index b6c0dcb..3237e7a 100644 --- a/README_zh_Hans.md +++ b/README_zh_Hans.md @@ -16,7 +16,8 @@ ## 概况 -XMPP gateway for the IRC network +XMPP gateway for the IRC network. Needs Metronome. + **分发版本:** 8.3~ynh3 ## 文档与资源 From aeb3d5228e39c28ddfbf35137602ea44d1ab4a1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 1 Jul 2024 15:36:20 +0200 Subject: [PATCH 03/15] Cleanup --- conf/{biboumi.cfg.lua => metronome.cfg.lua} | 0 scripts/backup | 2 - scripts/install | 99 ++++++--------------- scripts/remove | 31 ++----- scripts/restore | 47 ++++------ scripts/upgrade | 70 ++++----------- 6 files changed, 67 insertions(+), 182 deletions(-) rename conf/{biboumi.cfg.lua => metronome.cfg.lua} (100%) diff --git a/conf/biboumi.cfg.lua b/conf/metronome.cfg.lua similarity index 100% rename from conf/biboumi.cfg.lua rename to conf/metronome.cfg.lua diff --git a/scripts/backup b/scripts/backup index 3d5ab08..20cd979 100755 --- a/scripts/backup +++ b/scripts/backup @@ -1,7 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= diff --git a/scripts/install b/scripts/install index a7b1417..73a2757 100755 --- a/scripts/install +++ b/scripts/install @@ -1,7 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= @@ -9,115 +7,70 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# RETRIEVE ARGUMENTS FROM THE MANIFEST -#================================================= - -shared_secret="$(ynh_string_random 25)" -admin_jid="${admin}@$app.${domain}" - #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -#REMOVEME? ynh_script_progression --message="Validating installation parameters..." -if dpkg --compare-versions "$(uname -r)" "<=" "4.0" -then +if dpkg --compare-versions "$(uname -r)" "<=" "4.0"; then ynh_die "Upgrade your kernel first. Unsupported version: $(uname -r)" fi #================================================= -# STORE SETTINGS FROM MANIFEST -#================================================= -ynh_script_progression --message="Storing installation settings..." - -ynh_app_setting_set --app=$app --key=shared_secret --value=$shared_secret -ynh_app_setting_set --app=$app --key=admin_jid --value=$admin_jid - -#================================================= -# INSTALL DEPENDENCIES +# INITIALIZE AND STORE SETTINGS #================================================= -ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" +shared_secret="$(ynh_string_random 25)" +ynh_app_setting_set --app="$app" --key="shared_secret" --value="$shared_secret" -#================================================= -# SPECIFIC SETUP -#================================================= -# CONFIGURE METRONOME -#================================================= -ynh_script_progression --message="Configuring Metronome..." - -# Add metronome component -ynh_add_config --template="../conf/biboumi.cfg.lua" --destination="/etc/metronome/conf.d/$app.cfg.lua" - -chown metronome:metronome "/etc/metronome/conf.d/$app.cfg.lua" - -ynh_systemd_action --service_name=metronome --action="restart" +admin_jid="${admin}@${app}.${domain}" +ynh_app_setting_set --app="$app" --key="admin_jid" --value="$admin_jid" #================================================= # CREATE DATA DIRECTORY #================================================= -ynh_script_progression --message="Creating a data directory..." - -mkdir -p /var/lib/$app +ynh_script_progression --message="Setting up the data directory..." # Set permissions to app files chown -R _biboumi:_biboumi "/var/lib/$app" #================================================= -# ADD A CONFIGURATION +# APP INITIAL CONFIGURATION #================================================= -ynh_script_progression --message="Adding a configuration file..." +ynh_script_progression --message="Adding $app's configuration files..." --weight=1 +# Stop the service started by apt install +ynh_systemd_action --service_name="$app" --action="stop" --log_path="systemd" + +# Add metronome component +ynh_add_config --template="metronome.cfg.lua" --destination="/etc/metronome/conf.d/$app.cfg.lua" +chown metronome:metronome "/etc/metronome/conf.d/$app.cfg.lua" +ynh_systemd_action --service_name="metronome" --action="restart" + +# Add biboumi configuration mkdir -p "/etc/$app/" - -ynh_add_config --template="../conf/biboumi.cfg" --destination="/etc/$app/$app.cfg" - +ynh_add_config --template="biboumi.cfg" --destination="/etc/$app/$app.cfg" chown -R _biboumi:_biboumi "/etc/$app/$app.cfg" #================================================= -# SETUP SYSTEMD +# SYSTEM CONFIGURATION #================================================= -ynh_script_progression --message="Configuring a systemd service..." +ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 # Create a dedicated systemd config -systemctl enable $app.service --quiet - -#================================================= -# GENERIC FINALIZATION -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Configuring log rotation..." - -mkdir -p /var/log/$app -chown -R _biboumi:_biboumi "/var/log/$app" +systemctl enable "$app.service" --quiet +yunohost service add "$app" --description="XMPP gateway for the IRC network" --log="/var/log/$app/$app.log" # Use logrotate to manage application logfile(s) ynh_use_logrotate - -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." - -yunohost service add $app --description="XMPP gateway for the IRC network" --log="/var/log/$app/$app.log" +chown -R _biboumi:_biboumi "/var/log/$app" #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." +ynh_script_progression --message="Starting $app's systemd service..." --weight=1 # Start a systemd service -ynh_systemd_action --service_name=$app --action="start" --line_match="Started Biboumi" --log_path="systemd" - -#================================================= -# SETUP SSOWAT -#================================================= -ynh_script_progression --message="Configuring permissions..." - -# Prevent conflict with other apps on the same domain -ynh_app_setting_set --app=$app --key=no_sso --value=1 +ynh_systemd_action --service_name="$app" --action="start" --line_match="Started Biboumi" --log_path="systemd" #================================================= # END OF SCRIPT diff --git a/scripts/remove b/scripts/remove index 884633d..c64bb88 100755 --- a/scripts/remove +++ b/scripts/remove @@ -1,7 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= @@ -10,37 +8,22 @@ source _common.sh source /usr/share/yunohost/helpers #================================================= -# STANDARD REMOVE -#================================================= -# REMOVE SERVICE INTEGRATION IN YUNOHOST +# REMOVE SYSTEM CONFIGURATIONS #================================================= +ynh_script_progression --message="Removing system configurations related to $app..." --weight=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_script_progression --message="Removing $app service integration..." - yunohost service remove $app +if ynh_exec_warn_less yunohost service status "$app" >/dev/null; then + yunohost service remove "$app" fi -#================================================= -# STOP AND REMOVE SERVICE -#================================================= -ynh_script_progression --message="Stopping and removing the systemd service..." - # Remove the dedicated systemd config -ynh_systemd_action --service_name=$app --action="stop" --line_match="Stopped Biboumi" --log_path="systemd" -systemctl disable $app.service --quiet - -#================================================= -# REMOVE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Removing logrotate configuration..." +ynh_systemd_action --service_name="$app" --action="stop" --line_match="Stopped Biboumi" --log_path="systemd" +systemctl disable "$app.service" --quiet # Remove the app-specific logrotate config ynh_remove_logrotate -#================================================= -# SPECIFIC REMOVE #================================================= # REMOVE VARIOUS FILES #================================================= @@ -52,8 +35,6 @@ ynh_secure_remove --file="/var/lib/$app" # Remove a directory securely ynh_secure_remove --file="/etc/$app" -# Remove the log files - # Remove Metronome component ynh_secure_remove --file="/etc/metronome/conf.d/$app.cfg.lua" ynh_systemd_action --action=restart --service_name=metronome diff --git a/scripts/restore b/scripts/restore index b454958..ac3076c 100755 --- a/scripts/restore +++ b/scripts/restore @@ -1,7 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= @@ -15,56 +13,47 @@ source /usr/share/yunohost/helpers #================================================= ynh_script_progression --message="Validating restoration parameters..." -if dpkg --compare-versions "$(uname -r)" "<=" "4.0" -then +if dpkg --compare-versions "$(uname -r)" "<=" "4.0"; then ynh_die "Upgrade your kernel first. Unsupported version: $(uname -r)" fi +#================================================= +# RESTORE THE DATA DIRECTORY +#================================================= +ynh_script_progression --message="Restoring the data directory..." --weight=1 + +ynh_restore_file --origin_path="/var/lib/$app" +chown -R _biboumi:_biboumi "/var/lib/$app" + #================================================= # RESTORE VARIOUS FILES #================================================= ynh_script_progression --message="Restoring various files..." ynh_restore_file --origin_path="/etc/$app" -chown -R _biboumi:_biboumi /etc/$app - -ynh_restore_file --origin_path="/var/lib/$app" -chown -R _biboumi:_biboumi /var/lib/$app +chown -R _biboumi:_biboumi "/etc/$app" ynh_restore_file --origin_path="/etc/metronome/conf.d/$app.cfg.lua" chown metronome:metronome "/etc/metronome/conf.d/$app.cfg.lua" ynh_systemd_action --service_name=metronome --action="restart" #================================================= -# RESTORE SYSTEMD +# RESTORE SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Restoring the systemd configuration..." +ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 -systemctl enable $app.service --quiet - -#================================================= -# RESTORE THE LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the logrotate configuration..." - -mkdir -p /var/log/$app -chown -R _biboumi:_biboumi "/var/log/$app" +systemctl enable "$app.service" --quiet +yunohost service add "$app" --description="XMPP gateway for the IRC network" --log="/var/log/$app/$app.log" ynh_restore_file --origin_path="/etc/logrotate.d/$app" +chown -R _biboumi:_biboumi "/var/log/$app" #================================================= -# INTEGRATE SERVICE IN YUNOHOST +# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE #================================================= -ynh_script_progression --message="Integrating service in YunoHost..." +ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1 -yunohost service add $app --description="XMPP gateway for the IRC network" --log="/var/log/$app/$app.log" - -#================================================= -# START SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Starting a systemd service..." - -ynh_systemd_action --service_name=$app --action="start" --line_match="Started Biboumi" --log_path="systemd" +ynh_systemd_action --service_name="$app" --action="start" --line_match="Started Biboumi" --log_path="systemd" #================================================= # END OF SCRIPT diff --git a/scripts/upgrade b/scripts/upgrade index 8e2e370..e185eea 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1,7 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= @@ -9,41 +7,17 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# CHECK VERSION -#================================================= - -upgrade_type=$(ynh_check_app_version_changed) - -#================================================= -# STANDARD UPGRADE STEPS #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Stopping a systemd service..." +ynh_script_progression --message="Stopping $app's systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="stop" --line_match="Stopped Biboumi" --log_path="systemd" - -#================================================= -# SPECIFIC UPGRADE -#================================================= -# UPGRADE METRONOME COMPONENT -#================================================= -ynh_script_progression --message="Upgrading Metronome component..." - -# Upgrade metronome component -ynh_add_config --template="../conf/biboumi.cfg.lua" --destination="/etc/metronome/conf.d/$app.cfg.lua" - -chown metronome:metronome "/etc/metronome/conf.d/$app.cfg.lua" - -ynh_systemd_action --service_name=metronome --action="restart" +ynh_systemd_action --service_name="$app" --action="stop" --line_match="Stopped Biboumi" --log_path="systemd" #================================================= # CREATE DIRECTORIES #================================================= -ynh_script_progression --message="Creating a data directory..." - -mkdir -p /var/lib/$app +ynh_script_progression --message="Setting up the data directory..." # Set permissions to app files chown -R _biboumi:_biboumi "/var/lib/$app" @@ -51,46 +25,36 @@ chown -R _biboumi:_biboumi "/var/lib/$app" #================================================= # UPDATE A CONFIG FILE #================================================= -ynh_script_progression --message="Updating a configuration file..." +ynh_script_progression --message="Updating $app's configuration files..." --weight=1 -ynh_add_config --template="../conf/biboumi.cfg" --destination="/etc/$app/$app.cfg" +# Upgrade metronome component +ynh_add_config --template="metronome.cfg.lua" --destination="/etc/metronome/conf.d/$app.cfg.lua" +chown metronome:metronome "/etc/metronome/conf.d/$app.cfg.lua" +ynh_systemd_action --service_name=metronome --action="restart" +# Upgrade biboumi configuration +ynh_add_config --template="biboumi.cfg" --destination="/etc/$app/$app.cfg" chown -R _biboumi:_biboumi "/etc/$app/$app.cfg" #================================================= -# SETUP SYSTEMD +# REAPPLY SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Upgrading systemd configuration..." +ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 # Create a dedicated systemd config -systemctl enable $app.service --quiet - -#================================================= -# GENERIC FINALIZATION -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Upgrading logrotate configuration..." - -mkdir -p /var/log/$app -chown -R _biboumi:_biboumi "/var/log/$app" +systemctl enable "$app.service" --quiet +yunohost service add "$app" --description="XMPP gateway for the IRC network" --log="/var/log/$app/$app.log" # Use logrotate to manage app-specific logfile(s) ynh_use_logrotate --non-append - -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." - -yunohost service add $app --description="XMPP gateway for the IRC network" --log="/var/log/$app/$app.log" +chown -R _biboumi:_biboumi "/var/log/$app" #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." +ynh_script_progression --message="Starting $app's systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" --line_match="Started Biboumi" --log_path="systemd" +ynh_systemd_action --service_name="$app" --action="start" --line_match="Started Biboumi" --log_path="systemd" #================================================= # END OF SCRIPT From 3491d107071a2915cf223fd2adf9c612d25115c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 1 Jul 2024 15:37:20 +0200 Subject: [PATCH 04/15] Fix tests.toml --- tests.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests.toml b/tests.toml index 70ff51b..4ef117b 100644 --- a/tests.toml +++ b/tests.toml @@ -4,7 +4,7 @@ test_format = 1.0 [default] - preinstall = """" + preinstall = """ if cat /etc/os-release | grep --quiet bookworm 2>/dev/null; then yunohost app install --force https://github.com/yunoHost-Apps/metronome_ynh -a 'domain=domain.tld&init_main_permission=visitors' fi From 7e8e6577a39e01a779090dc490bf648c86534a40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 1 Jul 2024 15:38:45 +0200 Subject: [PATCH 05/15] Update upstream urls --- manifest.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manifest.toml b/manifest.toml index 33a23f6..71e6c85 100644 --- a/manifest.toml +++ b/manifest.toml @@ -13,9 +13,9 @@ maintainers = ["pitchum"] [upstream] license = "Zlib" -website = "https://biboumi.louiz.org/" -admindoc = "https://lab.louiz.org/louiz/biboumi/blob/8.3/doc/biboumi.1.rst" -code = "https://lab.louiz.org/louiz/biboumi" +website = "https://biboumi.louiz.org" +admindoc = "https://doc.biboumi.louiz.org" +code = "https://github.com/louiz/biboumi" [integration] yunohost = ">= 11.2" From 793433cc1ad5e896f9806348c069ada6b711ccf5 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Mon, 1 Jul 2024 13:38:50 +0000 Subject: [PATCH 06/15] Auto-update READMEs --- README.md | 6 +++--- README_es.md | 6 +++--- README_eu.md | 6 +++--- README_fr.md | 6 +++--- README_gl.md | 6 +++--- README_zh_Hans.md | 6 +++--- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 154d3d2..e7ba49c 100644 --- a/README.md +++ b/README.md @@ -22,9 +22,9 @@ XMPP gateway for the IRC network. Needs Metronome. **Shipped version:** 8.3~ynh3 ## Documentation and resources -- Official app website: -- Official admin documentation: -- Upstream app code repository: +- Official app website: +- Official admin documentation: +- Upstream app code repository: - YunoHost Store: - Report a bug: diff --git a/README_es.md b/README_es.md index 9bbf03d..d2b2394 100644 --- a/README_es.md +++ b/README_es.md @@ -22,9 +22,9 @@ XMPP gateway for the IRC network. Needs Metronome. **Versión actual:** 8.3~ynh3 ## Documentaciones y recursos -- Sitio web oficial: -- Documentación administrador oficial: -- Repositorio del código fuente oficial de la aplicación : +- Sitio web oficial: +- Documentación administrador oficial: +- Repositorio del código fuente oficial de la aplicación : - Catálogo YunoHost: - Reportar un error: diff --git a/README_eu.md b/README_eu.md index af4be8e..a7ed5fa 100644 --- a/README_eu.md +++ b/README_eu.md @@ -22,9 +22,9 @@ XMPP gateway for the IRC network. Needs Metronome. **Paketatutako bertsioa:** 8.3~ynh3 ## Dokumentazioa eta baliabideak -- Aplikazioaren webgune ofiziala: -- Administratzaileen dokumentazio ofiziala: -- Jatorrizko aplikazioaren kode-gordailua: +- Aplikazioaren webgune ofiziala: +- Administratzaileen dokumentazio ofiziala: +- Jatorrizko aplikazioaren kode-gordailua: - YunoHost Denda: - Eman errore baten berri: diff --git a/README_fr.md b/README_fr.md index 524b417..5ef96ab 100644 --- a/README_fr.md +++ b/README_fr.md @@ -22,9 +22,9 @@ XMPP gateway for the IRC network. Needs Metronome. **Version incluse :** 8.3~ynh3 ## Documentations et ressources -- Site officiel de l’app : -- Documentation officielle de l’admin : -- Dépôt de code officiel de l’app : +- Site officiel de l’app : +- Documentation officielle de l’admin : +- Dépôt de code officiel de l’app : - YunoHost Store : - Signaler un bug : diff --git a/README_gl.md b/README_gl.md index 80c6a48..5f3ad3a 100644 --- a/README_gl.md +++ b/README_gl.md @@ -22,9 +22,9 @@ XMPP gateway for the IRC network. Needs Metronome. **Versión proporcionada:** 8.3~ynh3 ## Documentación e recursos -- Web oficial da app: -- Documentación oficial para admin: -- Repositorio de orixe do código: +- Web oficial da app: +- Documentación oficial para admin: +- Repositorio de orixe do código: - Tenda YunoHost: - Informar dun problema: diff --git a/README_zh_Hans.md b/README_zh_Hans.md index 3237e7a..e4b64a7 100644 --- a/README_zh_Hans.md +++ b/README_zh_Hans.md @@ -22,9 +22,9 @@ XMPP gateway for the IRC network. Needs Metronome. **分发版本:** 8.3~ynh3 ## 文档与资源 -- 官方应用网站: -- 官方管理文档: -- 上游应用代码库: +- 官方应用网站: +- 官方管理文档: +- 上游应用代码库: - YunoHost 商店: - 报告 bug: From 1228758e801f9edcbb5309eeaef03241fa8d678c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 1 Jul 2024 15:51:22 +0200 Subject: [PATCH 07/15] backup/restore logs --- scripts/backup | 2 ++ scripts/restore | 2 ++ 2 files changed, 4 insertions(+) diff --git a/scripts/backup b/scripts/backup index 20cd979..3e18628 100755 --- a/scripts/backup +++ b/scripts/backup @@ -29,6 +29,8 @@ ynh_backup --src_path="/var/lib/$app" ynh_backup --src_path="/etc/metronome/conf.d/$app.cfg.lua" +ynh_backup --src_path="/var/log/$app/" + #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index ac3076c..e8610d7 100755 --- a/scripts/restore +++ b/scripts/restore @@ -46,6 +46,8 @@ systemctl enable "$app.service" --quiet yunohost service add "$app" --description="XMPP gateway for the IRC network" --log="/var/log/$app/$app.log" ynh_restore_file --origin_path="/etc/logrotate.d/$app" + +ynh_restore_file --origin_path="/var/log/$app/" chown -R _biboumi:_biboumi "/var/log/$app" #================================================= From 132c21b35e673106f5e44f7719590afb433e674b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 1 Jul 2024 16:54:41 +0200 Subject: [PATCH 08/15] Programmatic path to the metronome config dir --- scripts/_common.sh | 16 ++++++++++++++++ scripts/backup | 2 +- scripts/install | 5 +++-- scripts/remove | 2 +- scripts/restore | 5 +++-- scripts/upgrade | 5 +++-- 6 files changed, 27 insertions(+), 8 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 944a65e..e999c0a 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -8,6 +8,22 @@ # PERSONAL HELPERS #================================================= +_get_metronome_config_dir() { + if [[ $YNH_DEBIAN_VERSION == "bullseye" ]]; then + echo "/etc/metronome/conf.d" + return 0 + fi + + # multi_instance=false, there's only one + metronome_app=$(yunohost app list --json | jq '.apps[] | select(.id == "metronome")) | .id') + if (( ${#metronome_apps[@]} == 0 )); then + ynh_print_warn --message="Could not find any metronome app!" + return 1 + fi + + echo "$(yunohost app setting "$metronome_app" install_dir)/conf/conf.d" +} + #================================================= # EXPERIMENTAL HELPERS #================================================= diff --git a/scripts/backup b/scripts/backup index 3e18628..3804255 100755 --- a/scripts/backup +++ b/scripts/backup @@ -27,7 +27,7 @@ ynh_backup --src_path="/etc/$app" ynh_backup --src_path="/var/lib/$app" -ynh_backup --src_path="/etc/metronome/conf.d/$app.cfg.lua" +ynh_backup --src_path="$(_get_metronome_config_dir)/$app.cfg.lua" ynh_backup --src_path="/var/log/$app/" diff --git a/scripts/install b/scripts/install index 73a2757..2cb85ca 100755 --- a/scripts/install +++ b/scripts/install @@ -42,8 +42,9 @@ ynh_script_progression --message="Adding $app's configuration files..." --weight ynh_systemd_action --service_name="$app" --action="stop" --log_path="systemd" # Add metronome component -ynh_add_config --template="metronome.cfg.lua" --destination="/etc/metronome/conf.d/$app.cfg.lua" -chown metronome:metronome "/etc/metronome/conf.d/$app.cfg.lua" +metronome_config_dir=$(_get_metronome_config_dir) +ynh_add_config --template="metronome.cfg.lua" --destination="$metronome_config_dir/$app.cfg.lua" +chown metronome:metronome "$metronome_config_dir/$app.cfg.lua" ynh_systemd_action --service_name="metronome" --action="restart" # Add biboumi configuration diff --git a/scripts/remove b/scripts/remove index c64bb88..fb6c978 100755 --- a/scripts/remove +++ b/scripts/remove @@ -36,7 +36,7 @@ ynh_secure_remove --file="/var/lib/$app" ynh_secure_remove --file="/etc/$app" # Remove Metronome component -ynh_secure_remove --file="/etc/metronome/conf.d/$app.cfg.lua" +ynh_secure_remove --file="$(_get_metronome_config_dir)/$app.cfg.lua" ynh_systemd_action --action=restart --service_name=metronome #================================================= diff --git a/scripts/restore b/scripts/restore index e8610d7..05733ac 100755 --- a/scripts/restore +++ b/scripts/restore @@ -33,8 +33,9 @@ ynh_script_progression --message="Restoring various files..." ynh_restore_file --origin_path="/etc/$app" chown -R _biboumi:_biboumi "/etc/$app" -ynh_restore_file --origin_path="/etc/metronome/conf.d/$app.cfg.lua" -chown metronome:metronome "/etc/metronome/conf.d/$app.cfg.lua" +metronome_config_dir=$(_get_metronome_config_dir) +ynh_restore_file --origin_path="$metronome_config_dir/$app.cfg.lua" +chown metronome:metronome "$metronome_config_dir/$app.cfg.lua" ynh_systemd_action --service_name=metronome --action="restart" #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index e185eea..3113718 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -28,8 +28,9 @@ chown -R _biboumi:_biboumi "/var/lib/$app" ynh_script_progression --message="Updating $app's configuration files..." --weight=1 # Upgrade metronome component -ynh_add_config --template="metronome.cfg.lua" --destination="/etc/metronome/conf.d/$app.cfg.lua" -chown metronome:metronome "/etc/metronome/conf.d/$app.cfg.lua" +metronome_config_dir=$(_get_metronome_config_dir) +ynh_add_config --template="metronome.cfg.lua" --destination="$metronome_config_dir/$app.cfg.lua" +chown metronome:metronome "$metronome_config_dir/$app.cfg.lua" ynh_systemd_action --service_name=metronome --action="restart" # Upgrade biboumi configuration From 84669bccee05703bf01b74af061a85bb3f036f61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 1 Jul 2024 16:54:58 +0200 Subject: [PATCH 09/15] Install metronome testing for tests --- tests.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests.toml b/tests.toml index 4ef117b..d4e8ac1 100644 --- a/tests.toml +++ b/tests.toml @@ -6,6 +6,6 @@ test_format = 1.0 preinstall = """ if cat /etc/os-release | grep --quiet bookworm 2>/dev/null; then - yunohost app install --force https://github.com/yunoHost-Apps/metronome_ynh -a 'domain=domain.tld&init_main_permission=visitors' + yunohost app install --force https://github.com/yunoHost-Apps/metronome_ynh/tree/testing -a 'domain=domain.tld&init_main_permission=visitors' fi """ From e21bcfd37cf4eb1f24995c2650e84765a737cc38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 1 Jul 2024 16:57:40 +0200 Subject: [PATCH 10/15] use ynh_app_setting_get --- scripts/_common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index e999c0a..d16fb82 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -21,7 +21,7 @@ _get_metronome_config_dir() { return 1 fi - echo "$(yunohost app setting "$metronome_app" install_dir)/conf/conf.d" + echo "$(ynh_app_setting_get --app="$metronome_app" --key="install_dir")/conf/conf.d" } #================================================= From e40c0aa0ba00ac758f80830404fbf803fe045fbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 1 Jul 2024 17:10:39 +0200 Subject: [PATCH 11/15] Fix jq call --- scripts/_common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index d16fb82..494156f 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -15,7 +15,7 @@ _get_metronome_config_dir() { fi # multi_instance=false, there's only one - metronome_app=$(yunohost app list --json | jq '.apps[] | select(.id == "metronome")) | .id') + metronome_app=$(yunohost app list --json | jq --raw '.apps[] | select(.id == "metronome") | .id') if (( ${#metronome_apps[@]} == 0 )); then ynh_print_warn --message="Could not find any metronome app!" return 1 From f8b6e79711400dd9787a14e9036324f0d5212e5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 1 Jul 2024 17:12:05 +0200 Subject: [PATCH 12/15] Fix jq call --- scripts/_common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 494156f..3924433 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -15,7 +15,7 @@ _get_metronome_config_dir() { fi # multi_instance=false, there's only one - metronome_app=$(yunohost app list --json | jq --raw '.apps[] | select(.id == "metronome") | .id') + metronome_app=$(yunohost app list --json | jq -r '.apps[] | select(.id == "metronome") | .id') if (( ${#metronome_apps[@]} == 0 )); then ynh_print_warn --message="Could not find any metronome app!" return 1 From 8220286b33d6a62567593f90b70227c12dddd04a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 1 Jul 2024 17:12:51 +0200 Subject: [PATCH 13/15] Fix test --- scripts/_common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 3924433..1b0062a 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -16,7 +16,7 @@ _get_metronome_config_dir() { # multi_instance=false, there's only one metronome_app=$(yunohost app list --json | jq -r '.apps[] | select(.id == "metronome") | .id') - if (( ${#metronome_apps[@]} == 0 )); then + if [[ -z "${metronome_app:-}" ]]; then ynh_print_warn --message="Could not find any metronome app!" return 1 fi From 7e2a1bdcc2c4f0c19f497bce02a4a2627dba4957 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 1 Jul 2024 17:14:47 +0200 Subject: [PATCH 14/15] Fix line_match --- 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 2cb85ca..1b6fb56 100755 --- a/scripts/install +++ b/scripts/install @@ -71,7 +71,7 @@ chown -R _biboumi:_biboumi "/var/log/$app" ynh_script_progression --message="Starting $app's systemd service..." --weight=1 # Start a systemd service -ynh_systemd_action --service_name="$app" --action="start" --line_match="Started Biboumi" --log_path="systemd" +ynh_systemd_action --service_name="$app" --action="start" --line_match="Authenticated with the XMPP server" --log_path="/var/log/$app/$app.log" #================================================= # END OF SCRIPT diff --git a/scripts/restore b/scripts/restore index 05733ac..11a6d26 100755 --- a/scripts/restore +++ b/scripts/restore @@ -56,7 +56,7 @@ chown -R _biboumi:_biboumi "/var/log/$app" #================================================= ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1 -ynh_systemd_action --service_name="$app" --action="start" --line_match="Started Biboumi" --log_path="systemd" +ynh_systemd_action --service_name="$app" --action="start" --line_match="Authenticated with the XMPP server" --log_path="/var/log/$app/$app.log" #================================================= # END OF SCRIPT diff --git a/scripts/upgrade b/scripts/upgrade index 3113718..2e9d5fa 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -55,7 +55,7 @@ chown -R _biboumi:_biboumi "/var/log/$app" #================================================= ynh_script_progression --message="Starting $app's systemd service..." --weight=1 -ynh_systemd_action --service_name="$app" --action="start" --line_match="Started Biboumi" --log_path="systemd" +ynh_systemd_action --service_name="$app" --action="start" --line_match="Authenticated with the XMPP server" --log_path="/var/log/$app/$app.log" #================================================= # END OF SCRIPT From 4872f05dc68d3ba3d1b2c5bcbb842f0d2fd7f9e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 1 Jul 2024 17:16:24 +0200 Subject: [PATCH 15/15] Remove stop line_matches --- scripts/remove | 2 +- scripts/upgrade | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/remove b/scripts/remove index fb6c978..7bf9ab5 100755 --- a/scripts/remove +++ b/scripts/remove @@ -18,7 +18,7 @@ if ynh_exec_warn_less yunohost service status "$app" >/dev/null; then fi # Remove the dedicated systemd config -ynh_systemd_action --service_name="$app" --action="stop" --line_match="Stopped Biboumi" --log_path="systemd" +ynh_systemd_action --service_name="$app" --action="stop" --log_path="systemd" systemctl disable "$app.service" --quiet # Remove the app-specific logrotate config diff --git a/scripts/upgrade b/scripts/upgrade index 2e9d5fa..eaa512f 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= ynh_script_progression --message="Stopping $app's systemd service..." --weight=1 -ynh_systemd_action --service_name="$app" --action="stop" --line_match="Stopped Biboumi" --log_path="systemd" +ynh_systemd_action --service_name="$app" --action="stop" --log_path="systemd" #================================================= # CREATE DIRECTORIES