From fbafc332637e5962881b5f1be7505d342c802ed2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 29 Jan 2024 11:36:53 +0100 Subject: [PATCH] manifestv2 --- check_process | 19 ------ doc/{DISCLAIMER.md => ADMIN.md} | 2 +- doc/{DISCLAIMER_fr.md => ADMIN_fr.md} | 2 +- manifest.json | 50 ---------------- manifest.toml | 75 ++++++++++++++++++++++++ scripts/_common.sh | 3 - scripts/backup | 10 ++-- scripts/install | 84 ++------------------------- scripts/remove | 53 ++++------------- scripts/restore | 14 ++--- scripts/upgrade | 42 +++++++------- tests.toml | 7 +++ 12 files changed, 131 insertions(+), 230 deletions(-) delete mode 100644 check_process rename doc/{DISCLAIMER.md => ADMIN.md} (92%) rename doc/{DISCLAIMER_fr.md => ADMIN_fr.md} (92%) delete mode 100644 manifest.json create mode 100644 manifest.toml create mode 100644 tests.toml diff --git a/check_process b/check_process deleted file mode 100644 index 6cad445..0000000 --- a/check_process +++ /dev/null @@ -1,19 +0,0 @@ -;; Test complet - ; Manifest - domain="domain.tld" - password="1Strong-Password" - nextcloud_domain="nextcloud.tld" - ; Checks - pkg_linter=1 - setup_sub_dir=0 - setup_root=1 - setup_nourl=0 - setup_private=0 - setup_public=1 - upgrade=1 - backup_restore=1 - multi_instance=0 - change_url=0 -;;; Options -Email= -Notification=none diff --git a/doc/DISCLAIMER.md b/doc/ADMIN.md similarity index 92% rename from doc/DISCLAIMER.md rename to doc/ADMIN.md index 94c0f98..2b834ac 100644 --- a/doc/DISCLAIMER.md +++ b/doc/ADMIN.md @@ -1,7 +1,7 @@ ## Configuration **Settings:** -The settings of Collabora are at `https://office.domain.tld/browser/dist/admin/admin.html`. +The settings of Collabora are at `https://__DOMAIN__/browser/dist/admin/admin.html`. - User: admin - Password: The password set during the installation. (If you forgot it, you can find it again in `/etc/coolwsd/coolwsd.xml`). diff --git a/doc/DISCLAIMER_fr.md b/doc/ADMIN_fr.md similarity index 92% rename from doc/DISCLAIMER_fr.md rename to doc/ADMIN_fr.md index ea64e03..cffb337 100644 --- a/doc/DISCLAIMER_fr.md +++ b/doc/ADMIN_fr.md @@ -1,7 +1,7 @@ ## Configuration **Paramètres :** -Les paramètres de Collabora sont à `https://office.domain.tld/browser/dist/admin/admin.html`. +Les paramètres de Collabora sont à `https://__DOMAIN__/browser/dist/admin/admin.html`. - Utilisateur : admin - Mot de passe : Le mot de passe défini lors de l'installation. (Si vous l'avez oublié, vous pouvez le retrouver dans `/etc/coolwsd/coolwsd.xml`). diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 153e1f7..0000000 --- a/manifest.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "Collabora Online", - "id": "collabora", - "packaging_format": 1, - "description": { - "en": "LibreOffice-based online office suite with collaborative editing", - "fr": "Suite office en ligne et collaborative, basée sur LibreOffice" - }, - "version": "22.05.14.3~ynh1", - "url": "https://collaboraoffice.com", - "upstream": { - "license": "MPL-2.0", - "website": "https://collaboraoffice.com", - "admindoc": "https://www.collaboraoffice.com/code/" - }, - "license": "MPL-2.0", - "maintainer": { - "name": "rafi59", - "email": "rafi59_dev@srvmaison.fr.nf" - }, - "requirements": { - "yunohost": ">= 11.2" - }, - "multi_instance": false, - "services": [ - "nginx" - ], - "arguments": { - "install" : [ - { - "name": "domain", - "type": "domain" - }, - { - "name": "password", - "type": "password" - }, - { - "name": "nextcloud_domain", - "type": "string", - "ask": { - "en": "The domain of your Nextcloud instance", - "fr": "Le domain de votre instance Nextcloud" - }, - "example": "example.com/nextcloud", - "default": "" - } - ] - } -} diff --git a/manifest.toml b/manifest.toml new file mode 100644 index 0000000..3ac57ca --- /dev/null +++ b/manifest.toml @@ -0,0 +1,75 @@ +#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json + +packaging_format = 2 + +id = "collabora" +name = "Collabora Online" +description.en = "LibreOffice-based online office suite with collaborative editing" +description.fr = "Suite office en ligne et collaborative, basée sur LibreOffice" + +version = "22.05.14.3~ynh1" + +maintainers = ["rafi59"] + +[upstream] +license = "MPL-2.0" +website = "https://collaboraoffice.com" +admindoc = "https://www.collaboraoffice.com/code/" +cpe = "cpe:2.3:a:collabora:online" + +[integration] +yunohost = ">= 11.2" +architectures = ["amd64", "i386", "arm64"] +multi_instance = false +ldap = "not_relevant" +sso = "not_relevant" +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, ... + +[install] + [install.domain] + type = "domain" + + [install.init_main_permission] + help.en = "You will only be able to connect Collabora to Nextcloud if both apps are public!" + help.fr = "Nextcloud et Collabora doivent être des applications publiques si vous voulez les connecter !" + type = "group" + default = "visitors" + + [install.password] + type = "password" + + [install.nextcloud_domain] + ask.en = "The domain of your Nextcloud instance" + ask.fr = "Le domain de votre instance Nextcloud" + type = "string" + example = "example.com/nextcloud" + default = "" + +[resources] + [resources.system_user] + + [resources.install_dir] + + [resources.permissions] + main.url = "/" + + [resources.ports] + main.default = 9980 + + [resources.apt] + packages = [ + "hunspell-de-de", + "hunspell-en-gb", + "hunspell-fr", + "hunspell", + ] + + [resources.apt.extras.collabora] + repo = "deb https://collaboraoffice.com/repos/CollaboraOnline/CODE-debian${DEBIAN_VERSION_NUMBER} ./ " + key = "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x0C54D189F4BA284D" + packages = [ + "coolwsd", + "code-brand" + ] diff --git a/scripts/_common.sh b/scripts/_common.sh index 94e9d8f..944a65e 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,9 +4,6 @@ # COMMON VARIABLES #================================================= -# dependencies used by the app -pkg_dependencies="coolwsd code-brand hunspell-de-de hunspell-en-gb hunspell-fr hunspell" - #================================================= # PERSONAL HELPERS #================================================= diff --git a/scripts/backup b/scripts/backup index 0884082..32782c7 100644 --- a/scripts/backup +++ b/scripts/backup @@ -14,20 +14,20 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { +#REMOVEME? ynh_clean_setup () { ynh_clean_check_starting } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_print_info --message="Loading installation settings..." +#REMOVEME? ynh_print_info --message="Loading installation settings..." -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get --app=$app --key=domain) +#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 6d59bae..4b22c5a 100644 --- a/scripts/install +++ b/scripts/install @@ -10,59 +10,10 @@ source _common.sh source /usr/share/yunohost/helpers #================================================= -# MANAGE SCRIPT FAILURE +# INITIALIZE AND STORE SETTINGS #================================================= -ynh_clean_setup () { - ynh_clean_check_starting -} -# Exit if an error occurs during the execution of the script -ynh_abort_if_errors - -#================================================= -# RETRIEVE ARGUMENTS FROM THE MANIFEST -#================================================= - -domain=$YNH_APP_ARG_DOMAIN -path_url="/" -password=$YNH_APP_ARG_PASSWORD -nextcloud_domain=$YNH_APP_ARG_NEXTCLOUD_DOMAIN - -app=$YNH_APP_INSTANCE_NAME - -#================================================= -# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS -#================================================= -ynh_script_progression --message="Validating installation parameters..." --weight=1 - -if dpkg-architecture --is armhf -then - ynh_die --message="Sorry, this app can not be installed on an ARM architecture" -fi - -# Register (book) web path -ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url - -#================================================= -# STORE SETTINGS FROM MANIFEST -#================================================= -ynh_script_progression --message="Storing installation settings..." --weight=1 - -ynh_app_setting_set --app=$app --key=domain --value=$domain -ynh_app_setting_set --app=$app --key=path --value=$path_url -ynh_app_setting_set --app=$app --key=password --value=$password -ynh_app_setting_set --app=$app --key=nextcloud_domain --value=$nextcloud_domain - -#================================================= -# STANDARD MODIFICATIONS -#================================================= -# FIND AND OPEN A PORT -#================================================= -ynh_script_progression --message="Finding an available port..." --weight=1 - -# Find a free port -port=$(ynh_find_port --port=9980) -ynh_app_setting_set --app=$app --key=port --value=$port +ynh_app_setting_set --app="$app" --key=password --value="$password" #================================================= # CONFIGURE ONLYOFFICE @@ -78,26 +29,13 @@ ynh_add_config --template="../conf/coolwsd.xml" --destination="/etc/coolwsd/cool chmod 640 "/etc/coolwsd/coolwsd.xml" #================================================= -# INSTALL DEPENDENCIES +# SYSTEM CONFIGURATION #================================================= -ynh_script_progression --message="Installing dependencies..." --weight=10 - -DEBIAN_VERSION_NUMBER=$(cat /etc/debian_version | head -n 1 | cut -f1 -d .) -ynh_install_extra_app_dependencies --repo="deb https://collaboraoffice.com/repos/CollaboraOnline/CODE-debian${DEBIAN_VERSION_NUMBER} ./ " --package="$pkg_dependencies" --key="https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x0C54D189F4BA284D" 2>/dev/null - -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Configuring NGINX web server..." --weight=3 +ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - yunohost service add "coolwsd" --description="Collabora online office suite" --log="/var/log/$app/$app.log" #================================================= @@ -111,20 +49,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=5 # NB. : we need a stupid *re*start because the service is in fact already started during the damn package install ... so it won't find a recent "Ready to accept connection" match ... ynh_systemd_action --service_name="coolwsd" --action="restart" --log_path="systemd" --line_match="Ready to accept connections" -#================================================= -# SETUP SSOWAT -#================================================= -ynh_script_progression --message="Configuring permissions..." --weight=1 - -ynh_permission_update --permission="main" --add="visitors" --show_tile="false" - -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - -ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/remove b/scripts/remove index 588d3ed..777208f 100644 --- a/scripts/remove +++ b/scripts/remove @@ -10,63 +10,30 @@ source _common.sh source /usr/share/yunohost/helpers #================================================= -# LOAD SETTINGS -#================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 - -app=$YNH_APP_INSTANCE_NAME - -domain=$(ynh_app_setting_get --app=$app --key=domain) -port=$(ynh_app_setting_get --app=$app --key=port) - -#================================================= -# 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 "coolwsd" >/dev/null -then - ynh_script_progression --message="Removing coolwsd service integration..." --weight=1 - yunohost service remove "coolwsd" +if ynh_exec_warn_less yunohost service status "coolwsd" >/dev/null; then + yunohost service remove "coolwsd" fi -#================================================= -# STOP AND REMOVE SERVICE -#================================================= -ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1 - # Remove the dedicated systemd config ynh_remove_systemd_config --service="coolwsd" -#================================================= -# STANDARD REMOVE -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_script_progression --message="Removing dependencies..." --weight=1 - -# Fix "rm: cannot remove '/etc/apt/apt.conf.d/25loolwsd': No such file or directory" -# on apt remove -touch /etc/apt/apt.conf.d/25loolwsd - -# Remove metapackage and its dependencies -ynh_remove_app_dependencies - -#================================================= -# REMOVE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 - # Remove the dedicated NGINX config ynh_remove_nginx_config -#================================================= -# SPECIFIC REMOVE -#================================================= - # Remove a directory securely ynh_secure_remove --file="/etc/coolwsd" + +# FIXME: is it still required? +# Fix "rm: cannot remove '/etc/apt/apt.conf.d/25loolwsd': No such file or directory" +# on apt remove +touch /etc/apt/apt.conf.d/25loolwsd + #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index dbf3f14..a358701 100644 --- a/scripts/restore +++ b/scripts/restore @@ -14,21 +14,21 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -ynh_clean_setup () { +#REMOVEME? ynh_clean_setup () { ynh_clean_check_starting } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= ynh_script_progression --message="Loading settings..." --weight=1 -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get --app=$app --key=domain) -path_url=$(ynh_app_setting_get --app=$app --key=path) +#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) +#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) #================================================= # STANDARD RESTORATION STEPS @@ -51,10 +51,10 @@ chmod 640 "/etc/coolwsd/coolwsd.xml" #================================================= # REINSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Reinstalling dependencies..." --weight=10 +#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=10 DEBIAN_VERSION_NUMBER=$(cat /etc/debian_version | head -n 1 | cut -f1 -d .) -ynh_install_extra_app_dependencies --repo="deb https://collaboraoffice.com/repos/CollaboraOnline/CODE-debian${DEBIAN_VERSION_NUMBER} ./ " --package="$pkg_dependencies" --key="https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x0C54D189F4BA284D" 2>/dev/null +#REMOVEME? ynh_install_extra_app_dependencies --repo="deb https://collaboraoffice.com/repos/CollaboraOnline/CODE-debian${DEBIAN_VERSION_NUMBER} ./ " --package="$pkg_dependencies" --key="https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x0C54D189F4BA284D" 2>/dev/null #================================================= # INTEGRATE SERVICE IN YUNOHOST diff --git a/scripts/upgrade b/scripts/upgrade index 78a4120..7762fb3 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,15 +12,15 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 +#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1 -app=$YNH_APP_INSTANCE_NAME +#REMOVEME? app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get --app="$app" --key=domain) -path_url=$(ynh_app_setting_get --app=$app --key=path) -port=$(ynh_app_setting_get --app=$app --key=port) -password=$(ynh_app_setting_get --app="$app" --key=password) -nextcloud_domain=$(ynh_app_setting_get --app="$app" --key=nextcloud_domain) +#REMOVEME? domain=$(ynh_app_setting_get --app="$app" --key=domain) +#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) +#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port) +#REMOVEME? password=$(ynh_app_setting_get --app="$app" --key=password) +#REMOVEME? nextcloud_domain=$(ynh_app_setting_get --app="$app" --key=nextcloud_domain) #================================================= # ENSURE DOWNWARD COMPATIBILITY @@ -33,13 +33,13 @@ then fi # If db_name doesn't exist, create it -if [ -z "$path_url" ]; then - path_url="/" - ynh_app_setting_set --app=$app --key=path_url --value=$path_url +if [ -z "$path" ]; then + path="/" +#REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$path fi -if ynh_legacy_permissions_exists; then - ynh_legacy_permissions_delete_all +#REMOVEME? if ynh_legacy_permissions_exists; then +#REMOVEME? ynh_legacy_permissions_delete_all ynh_app_setting_delete --app=$app --key=is_public fi @@ -47,17 +47,17 @@ fi #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=5 +#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=5 # Backup the current version of the app -ynh_backup_before_upgrade -ynh_clean_setup () { +#REMOVEME? ynh_backup_before_upgrade +#REMOVEME? ynh_clean_setup () { # restore it if the upgrade fails ynh_clean_check_starting - ynh_restore_upgradebackup +#REMOVEME? ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script -ynh_abort_if_errors +#REMOVEME? ynh_abort_if_errors #================================================= # REMOVE OLD SERVICE INTEGRATION IN YUNOHOST @@ -108,10 +108,10 @@ chmod 640 "/etc/coolwsd/coolwsd.xml" #================================================= # UPGRADE DEPENDENCIES #================================================= -ynh_script_progression --message="Upgrading dependencies..." --weight=10 +#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=10 DEBIAN_VERSION_NUMBER=$(cat /etc/debian_version | head -n 1 | cut -f1 -d .) -ynh_install_extra_app_dependencies --repo="deb https://collaboraoffice.com/repos/CollaboraOnline/CODE-debian${DEBIAN_VERSION_NUMBER} ./ " --package="$pkg_dependencies" --key="https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x0C54D189F4BA284D" 2>/dev/null +#REMOVEME? ynh_install_extra_app_dependencies --repo="deb https://collaboraoffice.com/repos/CollaboraOnline/CODE-debian${DEBIAN_VERSION_NUMBER} ./ " --package="$pkg_dependencies" --key="https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x0C54D189F4BA284D" 2>/dev/null #================================================= # INTEGRATE SERVICE IN YUNOHOST @@ -130,9 +130,9 @@ ynh_systemd_action --service_name="coolwsd" --action="restart" --log_path="syste #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 +#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1 -ynh_systemd_action --service_name=nginx --action=reload +#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT diff --git a/tests.toml b/tests.toml new file mode 100644 index 0000000..6a40a92 --- /dev/null +++ b/tests.toml @@ -0,0 +1,7 @@ +#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/tests.v1.schema.json + +test_format = 1.0 + +[default] + + # test_upgrade_from.5725c85c09f1d3b76d12a4dc4d367ec911cd0019.name = "Last packaging v1 version"