From 177acf31f55a767958c40aea2a065d5d3b75c1f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 9 Jul 2023 19:06:26 +0200 Subject: [PATCH] v2 --- check_process | 24 -------------- doc/{DISCLAIMER.md => ADMIN.md} | 0 doc/DESCRIPTION.md | 1 + manifest.json | 41 ------------------------ manifest.toml | 25 ++++++++------- scripts/_common.sh | 3 -- scripts/backup | 16 ---------- scripts/install | 36 ++------------------- scripts/remove | 15 --------- scripts/restore | 32 +------------------ scripts/upgrade | 55 --------------------------------- 11 files changed, 19 insertions(+), 229 deletions(-) delete mode 100644 check_process rename doc/{DISCLAIMER.md => ADMIN.md} (100%) create mode 100644 doc/DESCRIPTION.md delete mode 100644 manifest.json diff --git a/check_process b/check_process deleted file mode 100644 index 55cb156..0000000 --- a/check_process +++ /dev/null @@ -1,24 +0,0 @@ -;; Test complet - ; Manifest - domain="domain.tld" - admin="john" - ; Checks - pkg_linter=1 - setup_sub_dir=0 - setup_root=0 - setup_nourl=1 - setup_private=0 - setup_public=0 - upgrade=1 - # 8.3~ynh1 - upgrade=1 from_commit=6596c7e12e17a2b9149b20739e916184e71fdfbd - backup_restore=1 - multi_instance=0 - port_already_use=1 (113) - change_url=0 -;;; Options -Email=pitchum@gramaton.org -Notification=none -;;; Upgrade options - ; commit=6596c7e12e17a2b9149b20739e916184e71fdfbd - name=8.3~ynh1. diff --git a/doc/DISCLAIMER.md b/doc/ADMIN.md similarity index 100% rename from doc/DISCLAIMER.md rename to doc/ADMIN.md diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md new file mode 100644 index 0000000..4f147e0 --- /dev/null +++ b/doc/DESCRIPTION.md @@ -0,0 +1 @@ +XMPP gateway for the IRC network \ No newline at end of file diff --git a/manifest.json b/manifest.json deleted file mode 100644 index ab356b0..0000000 --- a/manifest.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "Biboumi", - "id": "biboumi", - "packaging_format": 1, - "description": { - "en": "XMPP gateway for the IRC network", - "fr": "Passerelle XMPP pour le réseau IRC" - }, - "version": "8.3~ynh2", - "url": "https://biboumi.louiz.org/", - "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" - }, - "license": "Zlib", - "maintainer": { - "name": "pitchum", - "email": "pitchum@yunohost.org" - }, - "requirements": { - "yunohost": ">= 11.0.9" - }, - "multi_instance": false, - "services": [ - "metronome" - ], - "arguments": { - "install" : [ - { - "name": "domain", - "type": "domain" - }, - { - "name": "admin", - "type": "user" - } - ] - } -} diff --git a/manifest.toml b/manifest.toml index 19841d8..966aca4 100644 --- a/manifest.toml +++ b/manifest.toml @@ -14,32 +14,35 @@ 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" -cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number) -fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin. [integration] -yunohost = ">= 11.0.9" -architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"] +yunohost = ">= 11.1.21" +architectures = "all" multi_instance = false -ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials. -sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal. -disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ... -ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... -ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... +ldap = false +sso = false +disk = "50M" +ram.build = "50M" +ram.runtime = "50M" [install] [install.domain] - # this is a generic question - ask strings are automatically handled by Yunohost's core type = "domain" full_domain = true [install.admin] - # this is a generic question - ask strings are automatically handled by Yunohost's core type = "user" [resources] + + [resources.ports] + main.default = 113 + [resources.system_user] [resources.install_dir] [resources.permissions] + + [resources.apt] + packages = "metronome biboumi" diff --git a/scripts/_common.sh b/scripts/_common.sh index 934fece..944a65e 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,9 +4,6 @@ # COMMON VARIABLES #================================================= -# dependencies used by the app -#REMOVEME? pkg_dependencies="metronome biboumi" - #================================================= # PERSONAL HELPERS #================================================= diff --git a/scripts/backup b/scripts/backup index e6d5b1e..3d5ab08 100755 --- a/scripts/backup +++ b/scripts/backup @@ -10,22 +10,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_print_info --message="Loading installation settings..." - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) - #================================================= # DECLARE DATA AND CONF FILES TO BACKUP #================================================= diff --git a/scripts/install b/scripts/install index ef3278c..a7b1417 100755 --- a/scripts/install +++ b/scripts/install @@ -9,25 +9,10 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -#REMOVEME? ynh_clean_setup () { - ynh_clean_check_starting -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= -#REMOVEME? domain=$YNH_APP_ARG_DOMAIN -#REMOVEME? admin=$YNH_APP_ARG_ADMIN - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - shared_secret="$(ynh_string_random 25)" admin_jid="${admin}@$app.${domain}" @@ -44,30 +29,15 @@ fi #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -#REMOVEME? ynh_script_progression --message="Storing installation settings..." +ynh_script_progression --message="Storing installation settings..." -#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain -#REMOVEME? ynh_app_setting_set --app=$app --key=admin --value=$admin ynh_app_setting_set --app=$app --key=shared_secret --value=$shared_secret -#REMOVEME? ynh_app_setting_set --app=$app --key=admin_jid --value=$admin_jid - -#================================================= -# STANDARD MODIFICATIONS -#================================================= -# FIND AND OPEN A PORT -#================================================= -#REMOVEME? ynh_script_progression --message="Finding an available port..." - -# Find an available port -#REMOVEME? port=$(ynh_find_port --port=113) -#REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$port +ynh_app_setting_set --app=$app --key=admin_jid --value=$admin_jid #================================================= # INSTALL DEPENDENCIES #================================================= -#REMOVEME? ynh_script_progression --message="Installing dependencies..." -#REMOVEME? ynh_install_app_dependencies $pkg_dependencies ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" #================================================= @@ -144,7 +114,7 @@ ynh_systemd_action --service_name=$app --action="start" --line_match="Started Bi #================================================= # SETUP SSOWAT #================================================= -#REMOVEME? ynh_script_progression --message="Configuring permissions..." +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 diff --git a/scripts/remove b/scripts/remove index eb1d13f..4120411 100755 --- a/scripts/remove +++ b/scripts/remove @@ -9,13 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - #================================================= # STANDARD REMOVE #================================================= @@ -46,14 +39,6 @@ ynh_script_progression --message="Removing logrotate configuration..." # Remove the app-specific logrotate config ynh_remove_logrotate -#================================================= -# REMOVE DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Removing dependencies..." - -# Remove metapackage and its dependencies -#REMOVEME? ynh_remove_app_dependencies - #================================================= # SPECIFIC REMOVE #================================================= diff --git a/scripts/restore b/scripts/restore index 16cf79e..b454958 100755 --- a/scripts/restore +++ b/scripts/restore @@ -10,46 +10,16 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -#REMOVEME? ynh_clean_setup () { - ynh_clean_check_starting -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) - #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= -#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." +ynh_script_progression --message="Validating restoration parameters..." if dpkg --compare-versions "$(uname -r)" "<=" "4.0" then ynh_die "Upgrade your kernel first. Unsupported version: $(uname -r)" fi -#================================================= -# SPECIFIC RESTORATION -#================================================= -# REINSTALL DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." - -# Define and install dependencies -#REMOVEME? ynh_install_app_dependencies $pkg_dependencies -ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" - #================================================= # RESTORE VARIOUS FILES #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 1ba48b3..8e2e370 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,41 +9,12 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? admin=$(ynh_app_setting_get --app=$app --key=admin) -#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) -#REMOVEME? shared_secret=$(ynh_app_setting_get --app=$app --key=shared_secret) -#REMOVEME? admin_jid=$(ynh_app_setting_get --app=$app --key=admin_jid) - #================================================= # CHECK VERSION #================================================= -ynh_script_progression --message="Checking version..." upgrade_type=$(ynh_check_app_version_changed) -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." - -# Backup the current version of the app -#REMOVEME? ynh_backup_before_upgrade -#REMOVEME? ynh_clean_setup () { - ynh_clean_check_starting - # Restore it if the upgrade fails -#REMOVEME? ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -53,32 +24,6 @@ ynh_script_progression --message="Stopping a systemd service..." ynh_systemd_action --service_name=$app --action="stop" --line_match="Stopped Biboumi" --log_path="systemd" -#================================================= -# ENSURE DOWNWARD COMPATIBILITY -#================================================= -ynh_script_progression --message="Ensuring downward compatibility..." - -# Prevent conflict with other apps on the same domain -ynh_app_setting_set --app=$app --key=no_sso --value=1 - -if [ -z "$shared_secret" ]; then - shared_secret="$(grep password "/etc/biboumi/biboumi.cfg" | cut -d= -f2)" - ynh_app_setting_set --app=$app --key=shared_secret --value=$shared_secret -fi - -if [ -z "$admin_jid" ]; then - admin_jid="${admin}@$app.${domain}" -#REMOVEME? ynh_app_setting_set --app=$app --key=admin_jid --value=$admin_jid -fi - -#================================================= -# UPGRADE DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." - -#REMOVEME? ynh_install_app_dependencies $pkg_dependencies -ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" - #================================================= # SPECIFIC UPGRADE #=================================================