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 #72 from YunoHost-Apps/testing

Upgrade
This commit is contained in:
yalh76 2022-08-15 14:35:46 +02:00 committed by GitHub
commit 2be500cb42
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 329 additions and 140 deletions

65
.github/workflows/updater.sh vendored Normal file
View file

@ -0,0 +1,65 @@
#!/bin/bash
#=================================================
# PACKAGE UPDATING HELPER
#=================================================
# This script is meant to be run by GitHub Actions
# The YunoHost-Apps organisation offers a template Action to run this script periodically
# Since each app is different, maintainers can adapt its contents so as to perform
# automatic actions when a new upstream release is detected.
#=================================================
# FETCHING LATEST RELEASE AND ITS ASSETS
#=================================================
# Fetching information
current_version=$(cat manifest.json | jq -j '.version|split("~")[0]')
repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]')
# Some jq magic is needed, because the latest upstream release is not always the latest version (e.g. security patches for older versions)
version=$(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '.[] | select( .prerelease != true ) | .tag_name' | sort -V | tail -1)
# Later down the script, we assume the version has only digits and dots
# Sometimes the release name starts with a "v", so let's filter it out.
# You may need more tweaks here if the upstream repository has different naming conventions.
if [[ ${version:0:1} == "v" || ${version:0:1} == "V" ]]; then
version=${version:1}
fi
# Setting up the environment variables
echo "Current version: $current_version"
echo "Latest release from upstream: $version"
echo "VERSION=$version" >> $GITHUB_ENV
echo "REPO=$repo" >> $GITHUB_ENV
# For the time being, let's assume the script will fail
echo "PROCEED=false" >> $GITHUB_ENV
# Proceed only if the retrieved version is greater than the current one
if ! dpkg --compare-versions "$current_version" "lt" "$version" ; then
echo "::warning ::No new version available"
exit 0
# Proceed only if a PR for this new version does not already exist
elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.git ci-auto-update-v$version ; then
echo "::warning ::A branch already exists for this update"
exit 0
fi
#=================================================
# SPECIFIC UPDATE STEPS
#=================================================
# Any action on the app's source code can be done.
# The GitHub Action workflow takes care of committing all changes after this script ends.
#=================================================
# GENERIC FINALIZATION
#=================================================
# Replace new version in manifest
echo "$(jq -s --indent 4 ".[] | .version = \"$version~ynh1\"" manifest.json)" > manifest.json
# No need to update the README, yunohost-bot takes care of it
# The Action will proceed only if the PROCEED environment variable is set to true
echo "PROCEED=true" >> $GITHUB_ENV
exit 0

49
.github/workflows/updater.yml vendored Normal file
View file

@ -0,0 +1,49 @@
# This workflow allows GitHub Actions to automagically update your app whenever a new upstream release is detected.
# You need to enable Actions in your repository settings, and fetch this Action from the YunoHost-Apps organization.
# This file should be enough by itself, but feel free to tune it to your needs.
# It calls updater.sh, which is where you should put the app-specific update steps.
name: Check for new upstream releases
on:
# Allow to manually trigger the workflow
workflow_dispatch:
# Run it every day at 6:00 UTC
schedule:
- cron: '0 6 * * *'
jobs:
updater:
runs-on: ubuntu-latest
steps:
- name: Fetch the source code
uses: actions/checkout@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run the updater script
id: run_updater
run: |
# Setting up Git user
git config --global user.name 'yunohost-bot'
git config --global user.email 'yunohost-bot@users.noreply.github.com'
# Run the updater script
/bin/bash .github/workflows/updater.sh
- name: Commit changes
id: commit
if: ${{ env.PROCEED == 'true' }}
run: |
git commit -am "Upgrade to v$VERSION"
- name: Create Pull Request
id: cpr
if: ${{ env.PROCEED == 'true' }}
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update to version ${{ env.VERSION }}
committer: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
author: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
signoff: false
base: testing
branch: ci-auto-update-v${{ env.VERSION }}
delete-branch: true
title: 'Upgrade to version ${{ env.VERSION }}'
body: |
Upgrade to v${{ env.VERSION }}
draft: false

View file

@ -5,7 +5,7 @@ It shall NOT be edited by hand.
# OnlyOffice for YunoHost # OnlyOffice for YunoHost
[![Integration level](https://dash.yunohost.org/integration/onlyoffice.svg)](https://dash.yunohost.org/appci/app/onlyoffice) ![](https://ci-apps.yunohost.org/ci/badges/onlyoffice.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/onlyoffice.maintain.svg) [![Integration level](https://dash.yunohost.org/integration/onlyoffice.svg)](https://dash.yunohost.org/appci/app/onlyoffice) ![Working status](https://ci-apps.yunohost.org/ci/badges/onlyoffice.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/onlyoffice.maintain.svg)
[![Install OnlyOffice with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=onlyoffice) [![Install OnlyOffice with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=onlyoffice)
*[Lire ce readme en français.](./README_fr.md)* *[Lire ce readme en français.](./README_fr.md)*
@ -15,16 +15,28 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
## Overview ## Overview
Create and edit documents collaboratively OnlyOffice Document Server is an online office suite comprising viewers and editors for texts, spreadsheets and presentations, fully compatible with Office Open XML formats: .docx, .xlsx, .pptx and enabling collaborative editing in real time.
**Shipped version:** 6.4.0~ynh2 Online collaborative edition of OnlyOffice documents requires:
1. a server part, with two installation options:
1. OnlyOffice Document Server packaged for YunoHost.
2. The [Community Document Server for Nextcloud](https://apps.nextcloud.com/apps/documentserver_community)
2. a client part, such as:
1. The [ONLYOFFICE connector for Nextcloud](https://apps.nextcloud.com/apps/onlyoffice)
2. The [ONLYOFFICE Desktop Editors](https://www.onlyoffice.com/fr/download-desktop.aspx)
The Nextcloud addicts may follow [this tutorial](https://github.com/YunoHost-Apps/nextcloud_ynh#configure-onlyoffice-integration) to install (1.ii) and (2.i) on one Nextcloud instance. However, performance and architecture are limited.
**Shipped version:** 7.1.0~ynh1
**Demo:** https://www.onlyoffice.com/fr/download-desktop.aspx **Demo:** https://www.onlyoffice.com/fr/download-desktop.aspx
## Screenshots ## Screenshots
![](./doc/screenshots/.DS_Store) ![Screenshot of OnlyOffice](./doc/screenshots/.DS_Store)
![](./doc/screenshots/document-short.png) ![Screenshot of OnlyOffice](./doc/screenshots/document-short.png)
## Disclaimers / important information ## Disclaimers / important information
@ -78,20 +90,21 @@ Prerequisite: **OnlyOffice should be public**, see previous section.
## Documentation and resources ## Documentation and resources
* Official app website: https://www.onlyoffice.com * Official app website: <https://www.onlyoffice.com>
* Upstream app code repository: https://github.com/ONLYOFFICE/DocumentServer * Upstream app code repository: <https://github.com/ONLYOFFICE/DocumentServer>
* YunoHost documentation for this app: https://yunohost.org/app_onlyoffice * YunoHost documentation for this app: <https://yunohost.org/app_onlyoffice>
* Report a bug: https://github.com/YunoHost-Apps/onlyoffice_ynh/issues * Report a bug: <https://github.com/YunoHost-Apps/onlyoffice_ynh/issues>
## Developer info ## Developer info
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/onlyoffice_ynh/tree/testing). Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/onlyoffice_ynh/tree/testing).
To try the testing branch, please proceed like that. To try the testing branch, please proceed like that.
```
``` bash
sudo yunohost app install https://github.com/YunoHost-Apps/onlyoffice_ynh/tree/testing --debug sudo yunohost app install https://github.com/YunoHost-Apps/onlyoffice_ynh/tree/testing --debug
or or
sudo yunohost app upgrade onlyoffice -u https://github.com/YunoHost-Apps/onlyoffice_ynh/tree/testing --debug sudo yunohost app upgrade onlyoffice -u https://github.com/YunoHost-Apps/onlyoffice_ynh/tree/testing --debug
``` ```
**More info regarding app packaging:** https://yunohost.org/packaging_apps **More info regarding app packaging:** <https://yunohost.org/packaging_apps>

View file

@ -1,26 +1,42 @@
<!--
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
It shall NOT be edited by hand.
-->
# OnlyOffice pour YunoHost # OnlyOffice pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/onlyoffice.svg)](https://dash.yunohost.org/appci/app/onlyoffice) ![](https://ci-apps.yunohost.org/ci/badges/onlyoffice.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/onlyoffice.maintain.svg) [![Niveau d'intégration](https://dash.yunohost.org/integration/onlyoffice.svg)](https://dash.yunohost.org/appci/app/onlyoffice) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/onlyoffice.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/onlyoffice.maintain.svg)
[![Installer OnlyOffice avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=onlyoffice) [![Installer OnlyOffice avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=onlyoffice)
*[Read this readme in english.](./README.md)* *[Read this readme in english.](./README.md)*
*[Lire ce readme en français.](./README_fr.md)*
> *Ce package vous permet d'installer OnlyOffice rapidement et simplement sur un serveur YunoHost. > *Ce package vous permet d'installer OnlyOffice rapidement et simplement sur un serveur YunoHost.
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.* Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
## Vue d'ensemble ## Vue d'ensemble
Créez et éditer des documents collaborativement OnlyOffice Document Server est une suite bureautique en ligne comprenant des visualiseurs et des éditeurs de textes, feuilles de calcul et présentations, entièrement compatible avec les formats Office Open XML: .docx, .xlsx, .pptx et permettant l'édition collaborative en temps réel.
**Version incluse :** 6.4.0~ynh2 L'édition collaborative en ligne des documents OnlyOffice nécessite :
1. une partie serveur, avec deux options d'installation :
1. OnlyOffice Document Server packagé pour YunoHost.
2. Le [Community Document Server pour Nextcloud](https://apps.nextcloud.com/apps/documentserver_community).
2. une partie client, telle que :
1. [ONLYOFFICE connector pour Nextcloud](https://apps.nextcloud.com/apps/onlyoffice)
2. [ONLYOFFICE Desktop Editors](https://www.onlyoffice.com/fr/download-desktop.aspx)
Les utilisateurs de Nextcloud peuvent suivre [ce tutoriel](https://github.com/YunoHost-Apps/nextcloud_ynh/blob/testing/README_fr.md#configurer-lint%C3%A9gration-donlyoffice) pour installer le Community Document Server (1.ii) et ONLYOFFICE connector (2.i) sur une instance Nextcloud. Cependant, les performances et l'architecture sont limitées.
**Version incluse :** 7.1.0~ynh1
**Démo :** https://www.onlyoffice.com/fr/download-desktop.aspx **Démo :** https://www.onlyoffice.com/fr/download-desktop.aspx
## Captures d'écran ## Captures d'écran
![](./doc/screenshots/.DS_Store) ![Capture d'écran de OnlyOffice](./doc/screenshots/.DS_Store)
![](./doc/screenshots/document-short.png) ![Capture d'écran de OnlyOffice](./doc/screenshots/document-short.png)
## Avertissements / informations importantes ## Avertissements / informations importantes
@ -74,20 +90,21 @@ Prérequis : **OnlyOffice doit être public**, voir la section précédente.
## Documentations et ressources ## Documentations et ressources
* Site officiel de l'app : https://www.onlyoffice.com * Site officiel de l'app : <https://www.onlyoffice.com>
* Dépôt de code officiel de l'app : https://github.com/ONLYOFFICE/DocumentServer * Dépôt de code officiel de l'app : <https://github.com/ONLYOFFICE/DocumentServer>
* Documentation YunoHost pour cette app : https://yunohost.org/app_onlyoffice * Documentation YunoHost pour cette app : <https://yunohost.org/app_onlyoffice>
* Signaler un bug : https://github.com/YunoHost-Apps/onlyoffice_ynh/issues * Signaler un bug : <https://github.com/YunoHost-Apps/onlyoffice_ynh/issues>
## Informations pour les développeurs ## Informations pour les développeurs
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/onlyoffice_ynh/tree/testing). Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/onlyoffice_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit. Pour essayer la branche testing, procédez comme suit.
```
``` bash
sudo yunohost app install https://github.com/YunoHost-Apps/onlyoffice_ynh/tree/testing --debug sudo yunohost app install https://github.com/YunoHost-Apps/onlyoffice_ynh/tree/testing --debug
ou ou
sudo yunohost app upgrade onlyoffice -u https://github.com/YunoHost-Apps/onlyoffice_ynh/tree/testing --debug sudo yunohost app upgrade onlyoffice -u https://github.com/YunoHost-Apps/onlyoffice_ynh/tree/testing --debug
``` ```
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps **Plus d'infos sur le packaging d'applications :** <https://yunohost.org/packaging_apps>

View file

@ -2,8 +2,8 @@
; Manifest ; Manifest
domain="domain.tld" domain="domain.tld"
path="/path" path="/path"
nextclouddomain="domain.tld"
is_public=1 is_public=1
nextclouddomain="domain.tld"
; Checks ; Checks
pkg_linter=1 pkg_linter=1
setup_sub_dir=1 setup_sub_dir=1
@ -15,6 +15,7 @@
upgrade=1 from_commit=eca1121ff00c59325227163109d11c46bbff8e03 upgrade=1 from_commit=eca1121ff00c59325227163109d11c46bbff8e03
backup_restore=1 backup_restore=1
multi_instance=0 multi_instance=0
port_already_use=0
change_url=1 change_url=1
;;; Options ;;; Options
Email= Email=

BIN
doc/.DS_Store vendored

Binary file not shown.

12
doc/DESCRIPTION.md Normal file
View file

@ -0,0 +1,12 @@
OnlyOffice Document Server is an online office suite comprising viewers and editors for texts, spreadsheets and presentations, fully compatible with Office Open XML formats: .docx, .xlsx, .pptx and enabling collaborative editing in real time.
Online collaborative edition of OnlyOffice documents requires:
1. a server part, with two installation options:
1. OnlyOffice Document Server packaged for YunoHost.
2. The [Community Document Server for Nextcloud](https://apps.nextcloud.com/apps/documentserver_community)
2. a client part, such as:
1. The [ONLYOFFICE connector for Nextcloud](https://apps.nextcloud.com/apps/onlyoffice)
2. The [ONLYOFFICE Desktop Editors](https://www.onlyoffice.com/fr/download-desktop.aspx)
The Nextcloud addicts may follow [this tutorial](https://github.com/YunoHost-Apps/nextcloud_ynh#configure-onlyoffice-integration) to install (1.ii) and (2.i) on one Nextcloud instance. However, performance and architecture are limited.

12
doc/DESCRIPTION_fr.md Normal file
View file

@ -0,0 +1,12 @@
OnlyOffice Document Server est une suite bureautique en ligne comprenant des visualiseurs et des éditeurs de textes, feuilles de calcul et présentations, entièrement compatible avec les formats Office Open XML: .docx, .xlsx, .pptx et permettant l'édition collaborative en temps réel.
L'édition collaborative en ligne des documents OnlyOffice nécessite :
1. une partie serveur, avec deux options d'installation :
1. OnlyOffice Document Server packagé pour YunoHost.
2. Le [Community Document Server pour Nextcloud](https://apps.nextcloud.com/apps/documentserver_community).
2. une partie client, telle que :
1. [ONLYOFFICE connector pour Nextcloud](https://apps.nextcloud.com/apps/onlyoffice)
2. [ONLYOFFICE Desktop Editors](https://www.onlyoffice.com/fr/download-desktop.aspx)
Les utilisateurs de Nextcloud peuvent suivre [ce tutoriel](https://github.com/YunoHost-Apps/nextcloud_ynh/blob/testing/README_fr.md#configurer-lint%C3%A9gration-donlyoffice) pour installer le Community Document Server (1.ii) et ONLYOFFICE connector (2.i) sur une instance Nextcloud. Cependant, les performances et l'architecture sont limitées.

View file

@ -6,7 +6,7 @@
"en": "Create and edit documents collaboratively", "en": "Create and edit documents collaboratively",
"fr": "Créez et éditer des documents collaborativement" "fr": "Créez et éditer des documents collaborativement"
}, },
"version": "6.4.0~ynh2", "version": "7.1.0~ynh1",
"url": "https://www.onlyoffice.com", "url": "https://www.onlyoffice.com",
"upstream": { "upstream": {
"license": "GPL-3.0-or-later", "license": "GPL-3.0-or-later",
@ -16,18 +16,18 @@
}, },
"license": "GPL-3.0-or-later", "license": "GPL-3.0-or-later",
"maintainer": { "maintainer": {
"name": "liberodark", "name": "",
"email": "liberodark@gmail.com" "email": ""
}, },
"requirements": { "requirements": {
"yunohost": ">= 4.2.0" "yunohost": ">= 4.3.0"
}, },
"multi_instance": false, "multi_instance": false,
"services": [ "services": [
"nginx" "nginx"
], ],
"arguments": { "arguments": {
"install" : [ "install": [
{ {
"name": "domain", "name": "domain",
"type": "domain", "type": "domain",
@ -47,6 +47,15 @@
}, },
"default": "/onlyoffice" "default": "/onlyoffice"
}, },
{
"name": "is_public",
"type": "boolean",
"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 !"
},
"default": true
},
{ {
"name": "nextclouddomain", "name": "nextclouddomain",
"type": "string", "type": "string",
@ -60,15 +69,6 @@
"fr": "Installez le connecteur OnlyOffice pour éditer des documents dans Nextcloud." "fr": "Installez le connecteur OnlyOffice pour éditer des documents dans Nextcloud."
}, },
"default": "yunohost.domain/nextcloud" "default": "yunohost.domain/nextcloud"
},
{
"name": "is_public",
"type": "boolean",
"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 !"
},
"default": true
} }
] ]
} }

View file

@ -6,6 +6,8 @@
# dependencies used by the app # dependencies used by the app
pkg_dependencies="postgresql postgresql-contrib libstdc++6 rabbitmq-server libcurl4-dev" pkg_dependencies="postgresql postgresql-contrib libstdc++6 rabbitmq-server libcurl4-dev"
contrib_dependencies="ttf-mscorefonts-installer"
extra_dependencies="onlyoffice-documentserver"
#================================================= #=================================================
# PERSONAL HELPERS # PERSONAL HELPERS

View file

@ -6,7 +6,7 @@
# IMPORT GENERIC HELPERS # IMPORT GENERIC HELPERS
#================================================= #=================================================
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts # Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
@ -33,14 +33,6 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#================================================= #=================================================
ynh_print_info --message="Declaring files to be backed up..." ynh_print_info --message="Declaring files to be backed up..."
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================
ynh_backup --src_path="$final_path"
#=================================================
# STANDARD BACKUP STEPS
#================================================= #=================================================
# BACKUP THE NGINX CONFIGURATION # BACKUP THE NGINX CONFIGURATION
#================================================= #=================================================
@ -52,6 +44,7 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
ynh_backup --src_path="/etc/onlyoffice" ynh_backup --src_path="/etc/onlyoffice"
ynh_backup --src_path="/var/lib/onlyoffice/documentserver/App_Data/cache/files" --not_mandatory
#================================================= #=================================================
# BACKUP THE POSTGRESQL DATABASE # BACKUP THE POSTGRESQL DATABASE
@ -64,4 +57,4 @@ ynh_psql_dump_db --database="$db_name" > db.sql
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_print_info --message="Backup script completed for OnlyOffice. (YunoHost will then actually copy those files to the archive)." ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

View file

@ -27,13 +27,16 @@ app=$YNH_APP_INSTANCE_NAME
ynh_script_progression --message="Loading installation settings..." ynh_script_progression --message="Loading installation settings..."
# Needed for helper "ynh_add_nginx_config" # Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
# Add settings here as needed by your application
port=$(ynh_app_setting_get --app=$app --key=port) port=$(ynh_app_setting_get --app=$app --key=port)
nextclouddomain=$(ynh_app_setting_get --app=$app --key=nextclouddomain) nextclouddomain=$(ynh_app_setting_get --app=$app --key=nextclouddomain)
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
#================================================= #=================================================
ynh_script_progression --message="Backing up OnlyOffice before changing its URL (may take a while)..." ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..."
# Backup the current version of the app # Backup the current version of the app
ynh_backup_before_upgrade ynh_backup_before_upgrade
@ -41,7 +44,7 @@ ynh_clean_setup () {
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
# restore it if the upgrade fails # Restore it if the upgrade fails
ynh_restore_upgradebackup ynh_restore_upgradebackup
} }
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
@ -114,4 +117,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Change of URL completed for OnlyOffice" ynh_script_progression --message="Change of URL completed for $app"

View file

@ -64,28 +64,21 @@ ynh_script_progression --message="Finding an available port..."
port=$(ynh_find_port --port=8095) port=$(ynh_find_port --port=8095)
ynh_app_setting_set --app=$app --key=port --value=$port 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
#=================================================
ynh_script_progression --message="Add OnlyOffice repository..."
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CB2DE8E5
ynh_install_extra_repo --repo="deb http://download.onlyoffice.com/repo/debian squeeze main" --append
#================================================= #=================================================
# INSTALL DEPENDENCIES # INSTALL DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Installing dependencies..." ynh_script_progression --message="Installing dependencies..."
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="deb http://deb.debian.org/debian/ buster main contrib" --package=$contrib_dependencies --key="https://ftp-master.debian.org/keys/release-$(lsb_release --release --short).asc"
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..."
# Create a system user
ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# CREATE A POSTGRESQL DATABASE # CREATE A POSTGRESQL DATABASE
@ -96,7 +89,7 @@ db_name=$(ynh_sanitize_dbid --db_name=$app)
db_user=$db_name db_user=$db_name
ynh_app_setting_set --app=$app --key=db_name --value=$db_name ynh_app_setting_set --app=$app --key=db_name --value=$db_name
ynh_psql_test_if_first_run ynh_psql_test_if_first_run
ynh_psql_setup_db --db_user=$db_name --db_name=$db_name ynh_psql_setup_db --db_user=$db_user --db_name=$db_name
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
@ -130,31 +123,38 @@ echo onlyoffice-documentserver onlyoffice/db-name string $db_name | debconf-set-
#================================================= #=================================================
ynh_script_progression --message="Install OnlyOffice..." ynh_script_progression --message="Install OnlyOffice..."
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CB2DE8E5 2>/dev/null
# The onlyoffice dev had the magnificent idea to add a "nginx restart" during # The onlyoffice dev had the magnificent idea to add a "nginx restart" during
# the install/configure of their package, which is awful since that will # the install/configure of their package, which is awful since that will
# restart nginx and the whole webadmin and maybe even the yunohost command # restart nginx and the whole webadmin and maybe even the yunohost command
# running the install ... # running the install ...
ynh_exec_warn_less ynh_add_app_dependencies --package="onlyoffice-documentserver"
ynh_install_extra_app_dependencies --repo="https://download.onlyoffice.com/repo/debian squeeze main" --package=$extra_dependencies --key="https://ftp-master.debian.org/keys/release-$(lsb_release --release --short).asc"
#================================================= #=================================================
# MODIFY A CONFIG FILE # ADD A CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Modifying a config file..." ynh_script_progression --message="Adding a configuration file..."
ynh_replace_string --match_string="\"rejectUnauthorized\": true" --replace_string="\"rejectUnauthorized\": false" --target_file="/etc/onlyoffice/documentserver/default.json" ynh_replace_string --match_string="\"rejectUnauthorized\": true" --replace_string="\"rejectUnauthorized\": false" --target_file="/etc/onlyoffice/documentserver/default.json"
#=================================================
# STORE THE CONFIG FILE CHECKSUM
#=================================================
ynh_script_progression --message="Storing the config file checksum..."
# Calculate and store the config file checksum into the app settings
ynh_store_file_checksum --file="/etc/onlyoffice/documentserver/default.json" ynh_store_file_checksum --file="/etc/onlyoffice/documentserver/default.json"
#================================================= #=================================================
# RELOAD ONLYOFFICE # SECURE FILES AND DIRECTORIES
#================================================= #=================================================
ynh_script_progression --message="Reloading OnlyOffice..."
# Set permissions to app files
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R ds:ds "$final_path"
#=================================================
# GENERIC FINALIZATION
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..."
supervisorctl reload supervisorctl reload
@ -167,8 +167,6 @@ ynh_script_progression --message="Generating fonts..."
/usr/bin/documentserver-generate-allfonts.sh /usr/bin/documentserver-generate-allfonts.sh
#=================================================
# GENERIC FINALIZATION
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT
#================================================= #=================================================
@ -177,6 +175,8 @@ ynh_script_progression --message="Configuring permissions..."
# Make app public if necessary # Make app public if necessary
if [ $is_public -eq 1 ] if [ $is_public -eq 1 ]
then then
# Everyone can access the app.
# The "main" permission is automatically created before the install script.
ynh_permission_update --permission="main" --add="visitors" ynh_permission_update --permission="main" --add="visitors"
fi fi
@ -191,4 +191,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Installation of OnlyOffice completed" ynh_script_progression --message="Installation of $app completed"

View file

@ -37,7 +37,7 @@ ynh_secure_remove --file=/var/lib/dpkg/info/onlyoffice-documentserver.prerm
# already removed ... so their removal fails which breaks dpkg. # already removed ... so their removal fails which breaks dpkg.
# So instead, we trick it with this stupid link to /bin/true which is removed # So instead, we trick it with this stupid link to /bin/true which is removed
# right after. # right after.
ln -s /bin/true /usr/local/bin/supervisorctl #ln -s /bin/true /usr/local/bin/supervisorctl
ynh_package_autopurge onlyoffice-documentserver ynh_package_autopurge onlyoffice-documentserver
#================================================= #=================================================
@ -55,16 +55,15 @@ ynh_script_progression --message="Removing dependencies..."
# Remove metapackage and its dependencies # Remove metapackage and its dependencies
ynh_remove_app_dependencies ynh_remove_app_dependencies
ynh_remove_extra_repo
dpkg --configure -a dpkg --configure -a
apt-key del "E09C A29F 6E17 8040 EF22 B409 8320 CA65 CB2D E8E5" apt-key del "E09C A29F 6E17 8040 EF22 B409 8320 CA65 CB2D E8E5" 2>/dev/null
#================================================= #=================================================
# REMOVE APP MAIN DIR # REMOVE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Removing OnlyOffice main directory..." ynh_script_progression --message="Removing app main directory..."
# Remove the app directory securely # Remove the app directory securely
ynh_secure_remove --file="$final_path" ynh_secure_remove --file="$final_path"
@ -80,14 +79,13 @@ ynh_remove_nginx_config
#================================================= #=================================================
# SPECIFIC REMOVE # SPECIFIC REMOVE
#================================================= #=================================================
# REMOVE FILE # REMOVE VARIOUS FILES
#================================================= #=================================================
ynh_script_progression --message="Removing file..." ynh_script_progression --message="Removing various files..."
# Remove a directory securely # Remove a directory securely
ynh_secure_remove --file="/etc/onlyoffice" ynh_secure_remove --file="/etc/onlyoffice"
ynh_secure_remove --file="/var/lib/onlyoffice" ynh_secure_remove --file="/var/lib/onlyoffice"
#ynh_secure_remove --file="/var/cache/nginx/onlyoffice"
# Remove the log files # Remove the log files
ynh_secure_remove --file="/var/log/$app" ynh_secure_remove --file="/var/log/$app"
@ -107,4 +105,4 @@ ynh_system_user_delete --username=$app
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Removal of OnlyOffice completed" ynh_script_progression --message="Removal of $app completed"

View file

@ -6,7 +6,7 @@
# IMPORT GENERIC HELPERS # IMPORT GENERIC HELPERS
#================================================= #=================================================
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts # Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
@ -25,8 +25,8 @@ ynh_script_progression --message="Loading settings..."
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
path_url=$(ynh_app_setting_get --app=$app --key=path) path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
@ -43,31 +43,16 @@ test ! -d $final_path \
#================================================= #=================================================
# STANDARD RESTORATION STEPS # STANDARD RESTORATION STEPS
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# RECREATE THE DEDICATED USER # RECREATE THE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Recreating the dedicated system user..." ynh_script_progression --message="Recreating the dedicated system user..."
# Create the dedicated user (if not existing) # Create the dedicated user (if not existing)
ynh_system_user_create --username=$app ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# SPECIFIC RESTORATION # SPECIFIC RESTORATION
#=================================================
# ADD ONLYOFFICE REPOSITORY
#=================================================
ynh_script_progression --message="Add OnlyOffice repository..."
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CB2DE8E5
ynh_install_extra_repo --repo="deb http://download.onlyoffice.com/repo/debian squeeze main" --append
#================================================= #=================================================
# REINSTALL DEPENDENCIES # REINSTALL DEPENDENCIES
#================================================= #=================================================
@ -75,6 +60,14 @@ ynh_script_progression --message="Reinstalling dependencies..."
# Define and install dependencies # Define and install dependencies
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="deb http://deb.debian.org/debian/ buster main contrib" --package=$contrib_dependencies --key="https://ftp-master.debian.org/keys/release-$(lsb_release --release --short).asc"
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# RESTORE THE POSTGRESQL DATABASE # RESTORE THE POSTGRESQL DATABASE
@ -101,7 +94,9 @@ echo onlyoffice-documentserver onlyoffice/db-name string $db_name | debconf-set-
#================================================= #=================================================
ynh_script_progression --message="Reinstalling OnlyOffice..." ynh_script_progression --message="Reinstalling OnlyOffice..."
ynh_exec_warn_less ynh_add_app_dependencies --package="onlyoffice-documentserver" apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CB2DE8E5
ynh_install_extra_app_dependencies --repo="https://download.onlyoffice.com/repo/debian squeeze main" --package=$extra_dependencies --key="https://ftp-master.debian.org/keys/release-$(lsb_release --release --short).asc"
#================================================= #=================================================
# RESTORE THE CONFIGURATION # RESTORE THE CONFIGURATION
@ -110,6 +105,11 @@ ynh_script_progression --message="Restoring the configuration..."
ynh_restore_file --origin_path="/etc/onlyoffice" ynh_restore_file --origin_path="/etc/onlyoffice"
#=================================================
# RESTORE THE CACHE
#=================================================
ynh_restore_file --origin_path="/var/lib/onlyoffice/documentserver/App_Data/cache/files"
#================================================= #=================================================
# REGENERATE FONTS # REGENERATE FONTS
#================================================= #=================================================
@ -118,9 +118,20 @@ ynh_script_progression --message="Generating fonts..."
/usr/bin/documentserver-generate-allfonts.sh /usr/bin/documentserver-generate-allfonts.sh
#================================================= #=================================================
# RELOAD ONLYOFFICE # SECURE FILES AND DIRECTORIES
#================================================= #=================================================
ynh_script_progression --message="Reloading OnlyOffice..."
# Set permissions to app files
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R ds:ds "$final_path"
#=================================================
# GENERIC FINALIZATION
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..."
supervisorctl reload supervisorctl reload
@ -139,4 +150,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Restoration completed for OnlyOffice" ynh_script_progression --message="Restoration completed for $app"

View file

@ -25,20 +25,29 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
port=$(ynh_app_setting_get --app=$app --key=port) port=$(ynh_app_setting_get --app=$app --key=port)
nextclouddomain=$(ynh_app_setting_get --app=$app --key=nextclouddomain) nextclouddomain=$(ynh_app_setting_get --app=$app --key=nextclouddomain)
#=================================================
# CHECK VERSION
#=================================================
ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed)
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
ynh_script_progression --message="Backing up OnlyOffice before upgrading (may take a while)..." ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
# Backup the current version of the app # Backup the current version of the app
ynh_backup_before_upgrade ynh_backup_before_upgrade
ynh_clean_setup () { ynh_clean_setup () {
# restore it if the upgrade fails # Restore it if the upgrade fails
ynh_restore_upgradebackup ynh_restore_upgradebackup
} }
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors ynh_abort_if_errors
#=================================================
# STANDARD UPGRADE STEPS
#================================================= #=================================================
# ENSURE DOWNWARD COMPATIBILITY # ENSURE DOWNWARD COMPATIBILITY
#================================================= #=================================================
@ -78,14 +87,20 @@ ynh_secure_remove --file="/etc/apt/sources.list.d/nodesource.list"
ynh_script_progression --message="Making sure dedicated system user exists..." ynh_script_progression --message="Making sure dedicated system user exists..."
# Create a dedicated user (if not existing) # Create a dedicated user (if not existing)
ynh_system_user_create --username=$app ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# STANDARD UPGRADE STEPS # UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..."
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="deb http://deb.debian.org/debian/ buster main contrib" --package=$contrib_dependencies --key="https://ftp-master.debian.org/keys/release-$(lsb_release --release --short).asc"
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Configuring NGINX web server..." ynh_script_progression --message="Upgrading NGINX web server configuration..."
if [ "$path_url" = "/" ]; then if [ "$path_url" = "/" ]; then
ynh_replace_string --match_string="__SUB_PATH__" --replace_string="" --target_file="../conf/nginx.conf" ynh_replace_string --match_string="__SUB_PATH__" --replace_string="" --target_file="../conf/nginx.conf"
@ -96,23 +111,8 @@ fi
# Create a dedicated nginx config # Create a dedicated nginx config
ynh_add_nginx_config "nextclouddomain" ynh_add_nginx_config "nextclouddomain"
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..."
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
# SPECIFIC UPGRADE # SPECIFIC UPGRADE
#=================================================
# ADD ONLYOFFICE REPOSITORY
#=================================================
ynh_script_progression --message="Add OnlyOffice repository..."
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CB2DE8E5
ynh_install_extra_repo --repo="deb http://download.onlyoffice.com/repo/debian squeeze main" --append
#================================================= #=================================================
# CONFIGURE ONLYOFFICE # CONFIGURE ONLYOFFICE
#================================================= #=================================================
@ -130,12 +130,16 @@ echo onlyoffice-documentserver onlyoffice/db-name string $db_name | debconf-set-
#================================================= #=================================================
ynh_script_progression --message="Upgrading OnlyOffice..." ynh_script_progression --message="Upgrading OnlyOffice..."
ynh_exec_warn_less ynh_add_app_dependencies --package="onlyoffice-documentserver" ynh_remove_extra_repo --name="$app" # backward compat
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys CB2DE8E5
# ynh_remove_app_dependencies
ynh_install_extra_app_dependencies --repo="https://download.onlyoffice.com/repo/debian squeeze main" --package=$extra_dependencies --key="https://ftp-master.debian.org/keys/release-$(lsb_release --release --short).asc"
#================================================= #=================================================
# MODIFY A CONFIG FILE # UPDATE A CONFIG FILE
#================================================= #=================================================
ynh_script_progression --message="Modifying a config file..." ynh_script_progression --message="Updating a configuration file..."
ynh_backup_if_checksum_is_different --file="/etc/onlyoffice/documentserver/default.json" ynh_backup_if_checksum_is_different --file="/etc/onlyoffice/documentserver/default.json"
@ -151,12 +155,21 @@ ynh_script_progression --message="Generating fonts..."
/usr/bin/documentserver-generate-allfonts.sh /usr/bin/documentserver-generate-allfonts.sh
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
# Set permissions to app files
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R ds:ds "$final_path"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================
# RELOAD ONLYOFFICE # START SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Reloading OnlyOffice..." ynh_script_progression --message="Starting a systemd service..."
supervisorctl reload supervisorctl reload
@ -173,4 +186,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Upgrade of OnlyOffice completed" ynh_script_progression --message="Upgrade of $app completed"