From 1cc52ab7b5771ebcc16b4e8e6fb80f0cc66236ef Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 12 Jan 2021 21:12:34 +0100 Subject: [PATCH 1/7] New permissions --- check_process | 1 - scripts/_common.sh | 2 +- scripts/install | 7 ++++--- scripts/restore | 2 +- scripts/upgrade | 14 +------------- 5 files changed, 7 insertions(+), 19 deletions(-) diff --git a/check_process b/check_process index 0d04182..abb7748 100644 --- a/check_process +++ b/check_process @@ -19,7 +19,6 @@ upgrade=1 backup_restore=1 multi_instance=0 - incorrect_path=1 port_already_use=0 change_url=1 ;;; Options diff --git a/scripts/_common.sh b/scripts/_common.sh index 6003e8f..d556267 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,7 +5,7 @@ #================================================= # dependencies used by the app -pkg_dependencies="postgresql libstdc++6 redis-server rabbitmq-server libcurl4-dev" +pkg_dependencies="postgresql postgresql-contrib libstdc++6 redis-server rabbitmq-server libcurl4-dev" #================================================= # PERSONAL HELPERS diff --git a/scripts/install b/scripts/install index 76817ab..54584de 100644 --- a/scripts/install +++ b/scripts/install @@ -72,7 +72,7 @@ ynh_install_extra_repo --repo="deb http://download.onlyoffice.com/repo/debian sq #================================================= ynh_script_progression --message="Installing dependencies..." -ynh_install_app_dependencies $pkg_dependencies +ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies #================================================= # CREATE A POSTGRESQL DATABASE @@ -183,8 +183,9 @@ ynh_script_progression --message="Configuring SSOwat..." # Make app public if necessary if [ $is_public -eq 1 ] then - # unprotected_uris allows SSO credentials to be passed anyway. - ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" + # Everyone can access the app. + # The "main" permission is automatically created before the install script. + ynh_permission_update --permission="main" --add="visitors" fi #================================================= diff --git a/scripts/restore b/scripts/restore index fe66d64..aca2de5 100644 --- a/scripts/restore +++ b/scripts/restore @@ -74,7 +74,7 @@ ynh_install_extra_repo --repo="deb http://download.onlyoffice.com/repo/debian sq ynh_script_progression --message="Reinstalling dependencies..." # Define and install dependencies -ynh_install_app_dependencies $pkg_dependencies +ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies #================================================= # RESTORE THE POSTGRESQL DATABASE diff --git a/scripts/upgrade b/scripts/upgrade index 7bb238c..8a127ff 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -89,7 +89,7 @@ ynh_add_nginx_config "nextclouddomain" #================================================= ynh_script_progression --message="Upgrading dependencies..." -ynh_install_app_dependencies $pkg_dependencies +ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies #================================================= # CREATE DEDICATED USER @@ -149,18 +149,6 @@ ynh_script_progression --message="Generating fonts..." #================================================= # GENERIC FINALIZATION -#================================================= -# SETUP SSOWAT -#================================================= -ynh_script_progression --message="Upgrading SSOwat configuration..." - -# Make app public if necessary -if [ $is_public -eq 1 ] -then - # unprotected_uris allows SSO credentials to be passed anyway - ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" -fi - #================================================= # RELOAD ONLYOFFICE #================================================= From 68122278fa0e56f59966b56e1cac418919a81707 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 15 Feb 2021 23:55:12 +0100 Subject: [PATCH 2/7] Fix --- pull_request_template.md | 4 +--- scripts/install | 18 +++--------------- scripts/restore | 3 +-- scripts/upgrade | 9 ++++++++- 4 files changed, 13 insertions(+), 21 deletions(-) diff --git a/pull_request_template.md b/pull_request_template.md index faf416b..6c28fc5 100644 --- a/pull_request_template.md +++ b/pull_request_template.md @@ -13,6 +13,4 @@ ## Package_check results --- -*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/onlyoffice_ynh%20PR-NUM-%20(USERNAME)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/onlyoffice_ynh%20PR-NUM-%20(USERNAME)/) +* An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"* diff --git a/scripts/install b/scripts/install index 54584de..1988fdd 100644 --- a/scripts/install +++ b/scripts/install @@ -47,6 +47,7 @@ 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=is_public --value=$is_public ynh_app_setting_set --app=$app --key=nextclouddomain --value=$nextclouddomain +ynh_app_setting_set --app=$app --key=final_path --value=$final_path #================================================= # STANDARD MODIFICATIONS @@ -81,20 +82,9 @@ ynh_script_progression --message="Creating a PostgreSQL database..." db_name=$(ynh_sanitize_dbid --db_name=$app) db_user=$db_name -db_pwd=$(ynh_string_random --length=32) ynh_app_setting_set --app=$app --key=db_name --value=$db_name -ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd ynh_psql_test_if_first_run -ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd - -#================================================= -# DOWNLOAD, CHECK AND UNPACK SOURCE -#================================================= -ynh_script_progression --message="Setting up source files..." - -ynh_app_setting_set --app=$app --key=final_path --value=$final_path -# Download, check integrity, uncompress and patch the source from app.src -#ynh_setup_source --dest_dir="$final_path" +ynh_psql_setup_db --db_user=$db_name --db_name=$db_name #================================================= # NGINX CONFIGURATION @@ -178,13 +168,11 @@ ynh_script_progression --message="Generating fonts..." #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring SSOwat..." +ynh_script_progression --message="Configuring permissions..." # Make app public if necessary if [ $is_public -eq 1 ] then - # Everyone can access the app. - # The "main" permission is automatically created before the install script. ynh_permission_update --permission="main" --add="visitors" fi diff --git a/scripts/restore b/scripts/restore index aca2de5..a77e74a 100644 --- a/scripts/restore +++ b/scripts/restore @@ -26,10 +26,9 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=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) +db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) port=$(ynh_app_setting_get --app=$app --key=port) nextclouddomain=$(ynh_app_setting_get --app=$app --key=nextclouddomain) diff --git a/scripts/upgrade b/scripts/upgrade index 8a127ff..8c4da48 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -21,7 +21,7 @@ path_url=$(ynh_app_setting_get --app=$app --key=path) is_public=$(ynh_app_setting_get --app=$app --key=is_public) 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) +db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) port=$(ynh_app_setting_get --app=$app --key=port) nextclouddomain=$(ynh_app_setting_get --app=$app --key=nextclouddomain) @@ -51,6 +51,13 @@ if [ -z "$final_path" ]; then ynh_app_setting_set --app=$app --key=final_path --value=$final_path fi +# Cleaning legacy permissions +if ynh_legacy_permissions_exists; then + ynh_legacy_permissions_delete_all + + ynh_app_setting_delete --app=$app --key=is_public +fi + ynh_secure_remove --file="/etc/apt/sources.list.d/onlyoffice.list" ynh_secure_remove --file="/etc/apt/sources.list.d/nodesource.list" From b3bf9d85d6a3c110ffd263c263dd011379a441f2 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 25 Feb 2021 13:45:37 +0100 Subject: [PATCH 3/7] Clean legacy permissions --- scripts/install | 4 +--- scripts/upgrade | 7 +++++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index 54584de..4e27b4f 100644 --- a/scripts/install +++ b/scripts/install @@ -178,13 +178,11 @@ ynh_script_progression --message="Generating fonts..." #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring SSOwat..." +ynh_script_progression --message="Configuring permissions..." # Make app public if necessary if [ $is_public -eq 1 ] then - # Everyone can access the app. - # The "main" permission is automatically created before the install script. ynh_permission_update --permission="main" --add="visitors" fi diff --git a/scripts/upgrade b/scripts/upgrade index 8a127ff..29ced64 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -51,6 +51,13 @@ if [ -z "$final_path" ]; then ynh_app_setting_set --app=$app --key=final_path --value=$final_path fi +# Cleaning legacy permissions +if ynh_legacy_permissions_exists; then + ynh_legacy_permissions_delete_all + + ynh_app_setting_delete --app=$app --key=is_public +fi + ynh_secure_remove --file="/etc/apt/sources.list.d/onlyoffice.list" ynh_secure_remove --file="/etc/apt/sources.list.d/nodesource.list" From 742a5e5312fae55cc39d2506a36bf140d3da2ba8 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 12 Apr 2021 09:38:24 +0200 Subject: [PATCH 4/7] Remove is_public --- README.md | 4 ++-- README_fr.md | 4 ++-- check_process | 1 - manifest.json | 16 ++-------------- scripts/install | 1 - scripts/upgrade | 10 ---------- 6 files changed, 6 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 327c313..d0011b1 100644 --- a/README.md +++ b/README.md @@ -88,8 +88,8 @@ Prerequisite: **OnlyOffice should be public**, see previous section. #### Supported architectures -* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/onlyoffice%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/onlyoffice/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/onlyoffice%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/onlyoffice/) +* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/onlyoffice.svg)](https://ci-apps.yunohost.org/ci/apps/onlyoffice/) +* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/onlyoffice.svg)](https://ci-apps-arm.yunohost.org/ci/apps/onlyoffice/) ## Links diff --git a/README_fr.md b/README_fr.md index 48e8340..f34e0b2 100644 --- a/README_fr.md +++ b/README_fr.md @@ -88,8 +88,8 @@ Prérequis : **OnlyOffice doit être public**, voir la section précédente. #### Architectures supportées -* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/onlyoffice%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/onlyoffice/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/onlyoffice%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/onlyoffice/) +* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/onlyoffice.svg)](https://ci-apps.yunohost.org/ci/apps/onlyoffice/) +* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/onlyoffice.svg)](https://ci-apps-arm.yunohost.org/ci/apps/onlyoffice/) ## Liens diff --git a/check_process b/check_process index abb7748..71ee0f4 100644 --- a/check_process +++ b/check_process @@ -19,7 +19,6 @@ upgrade=1 backup_restore=1 multi_instance=0 - port_already_use=0 change_url=1 ;;; Options Email= diff --git a/manifest.json b/manifest.json index 956cd2e..476a129 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Create and edit documents collaboratively", "fr": "Créez et éditer des documents collaborativement" }, - "version": "6.1.0~ynh1", + "version": "6.1.0~ynh2", "url": "https://www.onlyoffice.com", "license": "GPL-3.0-or-later", "maintainer": { @@ -14,7 +14,7 @@ "email": "liberodark@gmail.com" }, "requirements": { - "yunohost": ">= 3.8.4" + "yunohost": ">= 4.1.7" }, "multi_instance": false, "services": [ @@ -25,10 +25,6 @@ { "name": "domain", "type": "domain", - "ask": { - "en": "Choose a domain name for OnlyOffice", - "fr": "Choisissez un nom de domaine pour OnlyOffice" - }, "example": "office.yunohost.domain", "help": { "en": "You should not install OnlyOffice on your main YunoHost domain, especially if you want to use it with a Nextcloud installed on the same domain.", @@ -38,10 +34,6 @@ { "name": "path", "type": "path", - "ask": { - "en": "Choose a path for OnlyOffice", - "fr": "Choisissez un chemin pour OnlyOffice" - }, "example": "/onlyoffice or /", "help": { "en": "Root path / if you chose a subdomain, e.g. office.yunohost.domain.", @@ -66,10 +58,6 @@ { "name": "is_public", "type": "boolean", - "ask": { - "en": "Is it a public application? If you want to connect the app to Nextcloud: check/true!", - "fr": "Est-ce une application publique ? Si vous voulez connecter l'app à Nextcloud : cochez/true!" - }, "help": { "en": "You will only be able to connect OnlyOffice to Nextcloud if both apps are public!", "fr": "Nextcloud et OnlyOffice doivent être des applications publiques si vous voulez les connecter !" diff --git a/scripts/install b/scripts/install index 1988fdd..e698904 100644 --- a/scripts/install +++ b/scripts/install @@ -45,7 +45,6 @@ ynh_script_progression --message="Storing installation settings..." 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=is_public --value=$is_public ynh_app_setting_set --app=$app --key=nextclouddomain --value=$nextclouddomain ynh_app_setting_set --app=$app --key=final_path --value=$final_path diff --git a/scripts/upgrade b/scripts/upgrade index 8c4da48..c16be72 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -18,7 +18,6 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) -is_public=$(ynh_app_setting_get --app=$app --key=is_public) db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) @@ -30,15 +29,6 @@ nextclouddomain=$(ynh_app_setting_get --app=$app --key=nextclouddomain) #================================================= ynh_script_progression --message="Ensuring downward compatibility..." -# Fix is_public as a boolean value -if [ "$is_public" = "Yes" ]; then - ynh_app_setting_set --app=$app --key=is_public --value=1 - is_public=1 -elif [ "$is_public" = "No" ]; then - ynh_app_setting_set --app=$app --key=is_public --value=0 - is_public=0 -fi - # If db_name doesn't exist, create it if [ -z "$db_name" ]; then db_name=$(ynh_sanitize_dbid --db_name=$app) From 6df3db56c86a3b866a98054916e12637668f40ab Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 12 Apr 2021 14:35:41 +0200 Subject: [PATCH 5/7] Fix --- scripts/install | 16 ++++++++-------- scripts/remove | 4 ++-- scripts/upgrade | 16 ++++++++-------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/scripts/install b/scripts/install index e698904..01f6da7 100644 --- a/scripts/install +++ b/scripts/install @@ -59,6 +59,14 @@ ynh_script_progression --message="Finding an available port..." port=$(ynh_find_port --port=8095) ynh_app_setting_set --app=$app --key=port --value=$port +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Configuring system user..." + +# Create a system user +ynh_system_user_create --username=$app + #================================================= # ADD ONLYOFFICE REPOSITORY #================================================= @@ -99,14 +107,6 @@ fi # Create a dedicated NGINX config ynh_add_nginx_config "nextclouddomain" -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Configuring system user..." - -# Create a system user -ynh_system_user_create --username=$app - #================================================= # SPECIFIC SETUP #================================================= diff --git a/scripts/remove b/scripts/remove index 58819b0..bb57f83 100644 --- a/scripts/remove +++ b/scripts/remove @@ -87,7 +87,7 @@ ynh_script_progression --message="Removing file..." # Remove a directory securely ynh_secure_remove --file="/etc/onlyoffice" ynh_secure_remove --file="/var/lib/onlyoffice" -ynh_secure_remove --file="/var/cache/nginx/onlyoffice" +#ynh_secure_remove --file="/var/cache/nginx/onlyoffice" # Remove the log files ynh_secure_remove --file="/var/log/$app" @@ -100,7 +100,7 @@ ynh_secure_remove --file="/var/log/$app" ynh_script_progression --message="Removing the dedicated system user..." # Delete a system user -gpasswd -d www-data onlyoffice +#gpasswd -d www-data onlyoffice ynh_system_user_delete --username=$app #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index c16be72..3f12d43 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -65,6 +65,14 @@ ynh_clean_setup () { # Exit if an error occurs during the execution of the script ynh_abort_if_errors +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Making sure dedicated system user exists..." + +# Create a dedicated user (if not existing) +ynh_system_user_create --username=$app + #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -88,14 +96,6 @@ ynh_script_progression --message="Upgrading dependencies..." ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." - -# Create a dedicated user (if not existing) -ynh_system_user_create --username=$app - #================================================= # SPECIFIC UPGRADE #================================================= From f0351d34bbf4fc6fb551564519dad5931298759d Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 12 Apr 2021 15:13:32 +0200 Subject: [PATCH 6/7] Add Warn_less --- scripts/change_url | 5 ----- scripts/install | 2 +- scripts/restore | 2 +- scripts/upgrade | 2 +- 4 files changed, 3 insertions(+), 8 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index 753d52b..d1742a8 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -30,11 +30,6 @@ ynh_script_progression --message="Loading installation settings..." port=$(ynh_app_setting_get --app=$app --key=port) nextclouddomain=$(ynh_app_setting_get --app=$app --key=nextclouddomain) -# Add settings here as needed by your application -#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) - #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= diff --git a/scripts/install b/scripts/install index 01f6da7..a14114b 100644 --- a/scripts/install +++ b/scripts/install @@ -129,7 +129,7 @@ ynh_script_progression --message="Install OnlyOffice..." # the install/configure of their package, which is awful since that will # restart nginx and the whole webadmin and maybe even the yunohost command # running the install ... -ynh_add_app_dependencies --package="onlyoffice-documentserver" +ynh_exec_warn_less ynh_add_app_dependencies --package="onlyoffice-documentserver" #================================================= # MODIFY A CONFIG FILE diff --git a/scripts/restore b/scripts/restore index a77e74a..7da5c74 100644 --- a/scripts/restore +++ b/scripts/restore @@ -100,7 +100,7 @@ echo onlyoffice-documentserver onlyoffice/db-name string $db_name | debconf-set- #================================================= ynh_script_progression --message="Reinstalling OnlyOffice..." -ynh_add_app_dependencies --package="onlyoffice-documentserver" +ynh_exec_warn_less ynh_add_app_dependencies --package="onlyoffice-documentserver" #================================================= # RESTORE THE CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index 3f12d43..541d80a 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -123,7 +123,7 @@ echo onlyoffice-documentserver onlyoffice/db-name string $db_name | debconf-set- #================================================= ynh_script_progression --message="Upgrading OnlyOffice..." -ynh_add_app_dependencies --package="onlyoffice-documentserver" +ynh_exec_warn_less ynh_add_app_dependencies --package="onlyoffice-documentserver" #================================================= # MODIFY A CONFIG FILE From 4379af4b0b1752157a9ffc08a244e5b2b1735049 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 6 May 2021 18:26:06 +0200 Subject: [PATCH 7/7] Fix link --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d0011b1..27c39b8 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ *[Lire ce readme en français.](./README_fr.md)* > *This package allows you to install OnlyOffice quickly and simply on a YunoHost server. -If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.* +If you don't have YunoHost, please consult [the guide](https://yunohost.org/install) to learn how to install it.* ## Overview diff --git a/README_fr.md b/README_fr.md index f34e0b2..af5dcd0 100644 --- a/README_fr.md +++ b/README_fr.md @@ -6,7 +6,7 @@ *[Read this readme in english.](./README.md)* > *Ce package vous permet d'installer OnlyOffice rapidement et simplement sur un serveur YunoHost. -Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/#/install) pour apprendre comment l'installer.* +Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/install) pour apprendre comment l'installer.* ## Vue d'ensemble