1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/onlyoffice_ynh.git synced 2024-09-03 19:56:11 +02:00

Merge pull request #51 from YunoHost-Apps/enh-testing

New permissions
This commit is contained in:
Éric Gaspar 2021-05-06 18:26:54 +02:00 committed by GitHub
commit b825b8aeac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 47 additions and 96 deletions

View file

@ -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
@ -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

View file

@ -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
@ -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

View file

@ -19,8 +19,6 @@
upgrade=1
backup_restore=1
multi_instance=0
incorrect_path=1
port_already_use=0
change_url=1
;;; Options
Email=

View file

@ -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 !"

View file

@ -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!"*

View file

@ -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

View file

@ -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
#=================================================

View file

@ -50,8 +50,8 @@ 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
#=================================================
# STANDARD MODIFICATIONS
@ -64,6 +64,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
#=================================================
@ -77,7 +85,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
@ -86,20 +94,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
@ -115,14 +112,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
#=================================================
@ -145,7 +134,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
@ -183,13 +172,12 @@ 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
# unprotected_uris allows SSO credentials to be passed anyway.
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
ynh_permission_update --permission="main" --add="visitors"
fi
#=================================================

View file

@ -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
#=================================================

View file

@ -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)
@ -74,7 +73,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
@ -101,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

View file

@ -18,10 +18,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)
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)
@ -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)
@ -51,6 +41,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"
@ -68,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
#=================================================
@ -89,15 +94,7 @@ ynh_add_nginx_config "nextclouddomain"
#=================================================
ynh_script_progression --message="Upgrading dependencies..."
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
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
#=================================================
# SPECIFIC UPGRADE
@ -126,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
@ -149,18 +146,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
#=================================================