1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/nextcloud_ynh.git synced 2024-09-03 19:55:57 +02:00

Merge branch 'testing' into convert-mysql-charset

This commit is contained in:
Éric Gaspar 2022-07-16 15:33:00 +02:00
commit 3dfe44d4df
No known key found for this signature in database
GPG key ID: 574F281483054D44
29 changed files with 368 additions and 562 deletions

55
.github/ISSUE_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,55 @@
---
name: Bug report
about: When creating a bug report, please use the following template to provide all the relevant information and help debugging efficiently.
---
**How to post a meaningful bug report**
1. *Read this whole template first.*
2. *Determine if you are on the right place:*
- *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!*
- *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.*
- *When in doubt, post here and we will figure it out together.*
3. *Delete the italic comments as you write over them below, and remove this guide.*
---
### Describe the bug
*A clear and concise description of what the bug is.*
### Context
- Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...*
- YunoHost version: x.x.x
- I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...*
- Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: *no / yes*
- If yes, please explain:
- Using, or trying to install package version/branch:
- If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`*
### Steps to reproduce
- *If you performed a command from the CLI, the command itself is enough. For example:*
```sh
sudo yunohost app install the_app
```
- *If you used the webadmin, please perform the equivalent command from the CLI first.*
- *If the error occurs in your browser, explain what you did:*
1. *Go to '...'*
2. *Click on '...'*
3. *Scroll down to '...'*
4. *See error*
### Expected behavior
*A clear and concise description of what you expected to happen. You can remove this section if the command above is enough to understand your intent.*
### Logs
*When an operation fails, YunoHost provides a simple way to share the logs.*
- *In the webadmin, the error message contains a link to the relevant log page. On that page, you will be able to 'Share with Yunopaste'. If you missed it, the logs of previous operations are also available under Tools > Logs.*
- *In command line, the command to share the logs is displayed at the end of the operation and looks like `yunohost log display [log name] --share`. If you missed it, you can find the log ID of a previous operation using `yunohost log list`.*
*After sharing the log, please copypaste directly the link provided by YunoHost (to help readability, no need to copypaste the entire content of the log here, just the link is enough...)*
*If applicable and useful, add screenshots to help explain your problem.*

16
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,16 @@
## Problem
- *Description of why you made this PR*
## Solution
- *And how do you fix that problem*
## PR Status
- [ ] Code finished and ready to be reviewed/tested
- [ ] The fix/enhancement were manually tested (if applicable)
## Automatic tests
Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ *after creating the PR*, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization)

View file

@ -1,32 +1,31 @@
<!--
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.
-->
# Nextcloud for YunoHost
[![Integration level](https://dash.yunohost.org/integration/nextcloud.svg)](https://dash.yunohost.org/appci/app/nextcloud) ![](https://ci-apps.yunohost.org/ci/badges/nextcloud.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/nextcloud.maintain.svg)
[![Integration level](https://dash.yunohost.org/integration/nextcloud.svg)](https://dash.yunohost.org/appci/app/nextcloud) ![Working status](https://ci-apps.yunohost.org/ci/badges/nextcloud.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/nextcloud.maintain.svg)
[![Install Nextcloud with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=nextcloud)
*[Lire ce readme en français.](./README_fr.md)*
> *This package allow you to install Nextcloud quickly and simply on a YunoHost server.
If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.*
> *This package allows you to install Nextcloud 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.*
## Overview
[Nextcloud](https://nextcloud.com) gives you freedom and control over your own data. A personal cloud which runs on your own server. With Nextcloud you can synchronize your files over your devices.
Online storage, file sharing platform and various other applications
**Shipped version:** 20.0.7
**Shipped version:** 22.2.9~ynh1
**Demo:** https://demo.nextcloud.com/
## Screenshots
![](https://raw.githubusercontent.com/nextcloud/screenshots/master/files/Files%20Overview.png)
![Screenshot of Nextcloud](./doc/screenshots/screenshot.png)
## Demo
* [YunoHost demo](https://demo.yunohost.org/nextcloud/)
* [Official demo](https://demo.nextcloud.com/)
## Documentation
* Official documentation: https://docs.nextcloud.com/server/20/user_manual/en/
* YunoHost documentation: https://github.com/YunoHost/doc/blob/master/app_nextcloud.md
## Disclaimers / important information
## Configuration
@ -52,51 +51,25 @@ this package:
* Optionally access the user home folder from Nextcloud files (set at the installation, the sharing is enabled by default)
* Serve `/.well-known` paths for CalDAV and CardDAV on the domain only if it's not already served - i.e. by Baïkal
#### Multi-users support
## Documentation and resources
#### Supported architectures
* Official app website: <https://nextcloud.com>
* Official user documentation: <https://docs.nextcloud.com/server/latest/user_manual/en/>
* Official admin documentation: <https://docs.nextcloud.com/server/stable/admin_manual/>
* Upstream app code repository: <https://github.com/nextcloud/server>
* YunoHost documentation for this app: <https://yunohost.org/app_nextcloud>
* Report a bug: <https://github.com/YunoHost-Apps/nextcloud_ynh/issues>
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/nextcloud%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/nextcloud/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/nextcloud%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/nextcloud/)
## Developer info
## Limitations
To integrate the logout button to the SSO, we have to patch Nextcloud sources. In waiting an upstream integration, the source code integrity checking has been disabled to prevent the warning message.
Also, note we made the choice to disable third-parties applications at the upgrade. It allows to prevent an unstable - and sometimes broken - Nextcloud installation. You will just have to manually activate them after the upgrade.
Finally, the following error message in Nextcloud logs can be safely ignored:
```
Following symlinks is not allowed ('/home/yunohost.multimedia/user/Share' -> '/home/yunohost.multimedia/share/' not inside '/home/yunohost.multimedia/user/')
```
## Additionnal informations
#### `occ` command usage
If you need/want to use Nextcloud `occ` command¹, you need to be in `/var/www/nextcloud/` folder (or `/var/www/nextcloud__n/` depending on your instance number in case of multiple concurrent installations), then use `sudo -u nextcloud php7.3 occ` instead of `occ` (as an alternative, you can use `/var/www/nextcloud/occ` to run the command from another directory).
*NB: You may need to adapt `php7.3` to the PHP version that Nextcloud is using. Starting from Nextcloud 18, YunoHost uses php7.3, it used before php7.0.*
¹ See https://docs.nextcloud.com/server/18/admin_manual/configuration_server/occ_command.html
Use this only if you know what you're doing :)
## Links
* Report a bug: https://github.com/YunoHost-Apps/nextcloud_ynh/issues
* Nextcloud website: https://nextcloud.com/
* Nextcloud repository: https://github.com/nextcloud/server
* YunoHost website: https://yunohost.org/
---
## Developers infos
Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/nextcloud_ynh/tree/testing).
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/nextcloud_ynh/tree/testing).
To try the testing branch, please proceed like that.
```
``` bash
sudo yunohost app install https://github.com/YunoHost-Apps/nextcloud_ynh/tree/testing --debug
or
sudo yunohost app upgrade nextcloud -u https://github.com/YunoHost-Apps/nextcloud_ynh/tree/testing --debug
```
**More info regarding app packaging:** <https://yunohost.org/packaging_apps>

View file

@ -1,34 +1,32 @@
<!--
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.
-->
# Nextcloud pour YunoHost
[![Niveau d'integration](https://dash.yunohost.org/integration/nextcloud.svg)](https://dash.yunohost.org/appci/app/nextcloud) ![](https://ci-apps.yunohost.org/ci/badges/nextcloud.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/nextcloud.maintain.svg)
[![Niveau d'intégration](https://dash.yunohost.org/integration/nextcloud.svg)](https://dash.yunohost.org/appci/app/nextcloud) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/nextcloud.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/nextcloud.maintain.svg)
[![Installer Nextcloud avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=nextcloud)
*[Read this readme in english.](./README.md)*
*[Read this readme in english.](./README.md)*
> *Ce package vous permet d'installer Nextcloud rapidement et simplement sur un serveur YunoHost.
> *Ce package vous permet d'installer Nextcloud 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.*
## Vue d'ensemble
[Nextcloud](https://nextcloud.com) vous donne la liberté et le contrôle sur vos données. Un nuage personnel qui tourne sur votre serveur.
Avec NextCloud vous pouvez synchroniser vos fichiers sur vos appareils.
Stockage en ligne, plateforme de partage de fichiers et diverses autres applications
**Version incluse :** 20.0.7
**Version incluse :** 22.2.9~ynh1
**Démo :** https://demo.nextcloud.com/
## Captures d'écran
![](https://raw.githubusercontent.com/nextcloud/screenshots/master/files/Files%20Overview.png)
![Capture d'écran de Nextcloud](./doc/screenshots/screenshot.png)
## Démo
## Avertissements / informations importantes
* [Démo YunoHost](https://demo.yunohost.org/nextcloud/)
* [Démo officielle](https://demo.nextcloud.com/)
## Documentation
* Documentation officielle : https://docs.nextcloud.com/server/20/user_manual/fr/
* Documentation YunoHost : https://github.com/YunoHost/doc/blob/master/app_nextcloud_fr.md
## Configuration
#### Configurer l'intégration d'OnlyOffice
@ -52,41 +50,25 @@ En plus des fonctionnalités principales de Nextcloud, les fonctionnalités suiv
* Accès optionnel au répertoire home depuis les fichiers Nextcloud (à activer à l'installation, le partage étant activé par défaut)
* Utilise l'adresse `/.well-known` pour la synchronisation CalDAV et CardDAV du domaine si aucun autre service ne l'utilise déjà - par exemple, baikal
#### Support multi-utilisateurs
## Documentations et ressources
#### Architectures supportées
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/nextcloud%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/nextcloud/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/nextcloud%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/nextcloud/)
## Limitations
Pour intégrer le bouton de déconnexion du SSO, nous devons patcher les sources de Nextcloud.
En attendant un intégration de leur part, la vérification d'intégrité du code source est désactivée pour ne pas avoir de message d'avertissement.
Notez également que nous avons choisi de désactiver les applications tierces-parties lors des mises à jour. Ça permet d'éviter une installation de Nextcloud instable - ou qui pourrait planter.
Vous devrez juste les réactiver manuellement après chaque mise à jour.
Et enfin, le message d'erreur suivant dans les logs de Nextcloud peut être ignoré sans problème :
```
Following symlinks is not allowed ('/home/yunohost.multimedia/user/Share' -> '/home/yunohost.multimedia/share/' not inside '/home/yunohost.multimedia/user/')
```
## Liens
* Signaler un bug : https://github.com/YunoHost-Apps/nextcloud_ynh/issues
* Site web de Nextcloud : https://nextcloud.com/
* Dépôt de Nextcloud : https://github.com/nextcloud/server
* Site web de YunoHost : https://yunohost.org/
---
* Site officiel de l'app : <https://nextcloud.com>
* Documentation officielle utilisateur : <https://docs.nextcloud.com/server/latest/user_manual/en/>
* Documentation officielle de l'admin : <https://docs.nextcloud.com/server/stable/admin_manual/>
* Dépôt de code officiel de l'app : <https://github.com/nextcloud/server>
* Documentation YunoHost pour cette app : <https://yunohost.org/app_nextcloud>
* Signaler un bug : <https://github.com/YunoHost-Apps/nextcloud_ynh/issues>
## Informations pour les développeurs
Merci de faire votre « pull request » sur la [branche testing](https://github.com/YunoHost-Apps/nextcloud_ynh/tree/testing).
Pour tester la branche testing, faites comme ceci.
```
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/nextcloud_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit.
``` bash
sudo yunohost app install https://github.com/YunoHost-Apps/nextcloud_ynh/tree/testing --debug
ou
sudo yunohost app upgrade nextcloud -u https://github.com/YunoHost-Apps/nextcloud_ynh/tree/testing --debug
```
**Plus d'infos sur le packaging d'applications :** <https://yunohost.org/packaging_apps>

View file

@ -1,18 +1,20 @@
;; Test complet
; Manifest
domain="domain.tld" (DOMAIN)
path="/path" (PATH)
admin="homer" (USER)
domain="domain.tld"
path="/path"
admin="homer"
is_public=1
user_home="1"
; Checks
pkg_linter=1
setup_sub_dir=1
setup_root=1
setup_nourl=0
setup_private=0
setup_public=0
setup_private=1
setup_public=1
upgrade=1
upgrade=1 from_commit=c864e086625363d91dde6ba78a652011a991a027
#21.0.2
upgrade=1 from_commit=fa1f0da48d3edbdf5bcb3b8b70a0687b4e878d11
backup_restore=1
multi_instance=1
incorrect_path=1
@ -22,6 +24,6 @@
Email=
Notification=none
;;; Upgrade options
; commit=c864e086625363d91dde6ba78a652011a991a027
name=[fix] php7.2-mcrypt doesn't exist (#253)
; commit=fa1f0da48d3edbdf5bcb3b8b70a0687b4e878d11
name=Merge pull request #408 from YunoHost-Apps/21.0.2
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&user_home=1&

View file

@ -1,6 +0,0 @@
SOURCE_URL=https://download.nextcloud.com/server/releases/nextcloud-__VERSION__.tar.bz2
SOURCE_SUM=__SHA256_SUM__
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.bz2
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=

View file

@ -11,7 +11,9 @@
"timeout": "0.0",
"password": ""
},
"hashing_default_password": true
"hashing_default_password": true,
"localstorage.allowsymlinks": true,
"simpleSignUpLink.shown": false
},
"apps": {
"user_ldap": {
@ -24,11 +26,12 @@
"ldap_email_attr": "mail",
"ldap_expert_username_attr": "uid",
"ldap_group_display_name": "cn",
"ldap_group_filter": "objectClass=posixGroup",
"ldap_group_filter": "(&(objectclass=top)(memberUid=*))",
"ldap_group_filter_mode": "0",
"ldap_groupfilter_objectclass": "posixGroup",
"ldap_group_member_assoc_attribute": "memberUid",
"ldap_host": "localhost",
"ldap_login_filter": "(&(|(objectclass=posixAccount))(uid=%uid))",
"ldap_login_filter": "(&(|(objectclass=posixAccount))(uid=%uid)(permission=cn=__APP__.main,ou=permission,dc=yunohost,dc=org))",
"ldap_login_filter_mode": "0",
"ldap_port": "389",
"ldap_quota_attr": "userquota",

View file

@ -15,3 +15,6 @@ php_value[opcache.max_accelerated_files]=10000
php_value[opcache.memory_consumption]=128
php_value[opcache.save_comments]=1
php_value[opcache.revalidate_freq]=1
; https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/caching_configuration.html#id1
php_value[apc.enabled]=1
php_value[apc.enable_cli]=1

View file

@ -1 +1 @@
*/15 * * * * __USER__ /usr/bin/php__YNH_PHP_VERSION__ -f __DESTDIR__/cron.php
*/15 * * * * __APP__ /usr/bin/php__PHPVERSION__ --define apc.enable_cli=1 -f __FINAL_PATH__/cron.php

View file

@ -5,13 +5,12 @@ location ^~ /.well-known {
# Uncomment it if you're planning to use this app.
#rewrite ^/\.well-known/host-meta\.json __PATH__/public.php?service=host-meta-json last;
#rewrite ^/\.well-known/host-meta __PATH__/public.php?service=host-meta last;
# The following 2 rules are only needed for the Social app.
# Uncomment it if you're planning to use this app.
#rewrite ^/\.well-known/webfinger __PATH__/public.php?service=webfinger last;
#rewrite ^/\.well-known/nodeinfo __PATH__/public.php?service=nodeinfo last;
location = /.well-known/carddav { return 301 __PATH__/remote.php/dav/; }
location = /.well-known/caldav { return 301 __PATH__/remote.php/dav/; }
location = /.well-known/webfinger { return 301 __PATH__/index.php$uri; }
location = /.well-known/nodeinfo { return 301 __PATH__/index.php$uri; }
try_files $uri $uri/ =404;
}
@ -22,11 +21,6 @@ location ^~ __PATH__/ {
# Path to source
alias __FINALPATH__/;
# Force usage of https
if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent;
}
# Add headers to serve security related headers
more_set_headers "Strict-Transport-Security: max-age=15768000; includeSubDomains; preload;";
more_set_headers "Referrer-Policy: no-referrer";
@ -93,6 +87,10 @@ location ^~ __PATH__/ {
# then Nginx will encounter an infinite rewriting loop when it prepends
# `/nextcloud/index.php` to the URI, resulting in a HTTP 500 error response.
location ~ \.php(?:$|/) {
# Required for legacy support
# https://github.com/nextcloud/documentation/pull/2197#issuecomment-721432337
# This line fix the ldap admin page
rewrite ^__PATH__/(?!index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+|.+\/richdocumentscode\/proxy) __PATH__/index.php$request_uri;
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
set $path_info $fastcgi_path_info;
try_files $fastcgi_script_name =404;
@ -103,6 +101,7 @@ location ^~ __PATH__/ {
fastcgi_param HTTPS on;
fastcgi_param modHeadersAvailable true; # Avoid sending the security headers twice
fastcgi_param front_controller_active true; # Enable pretty urls
fastcgi_param HTTP_ACCEPT_ENCODING ""; # Disable encoding of nextcloud response to inject ynh scripts
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
fastcgi_intercept_errors on;
fastcgi_request_buffering off;

View file

@ -8,19 +8,19 @@ name = "Nextcloud configuration"
name = "PHP-FPM configuration"
[main.php_fpm_config.footprint]
ask = "Memory footprint of the service ?"
ask = "Memory footprint of the service?"
choices = ["low", "medium", "high", "specific"]
default = "low"
help = "low <= 20Mb per pool. medium between 20Mb and 40Mb per pool. high > 40Mb per pool.<br>Use specific to set a value with the following option."
[main.php_fpm_config.free_footprint]
ask = "Memory footprint of the service ?"
ask = "Memory footprint of the service?"
type = "number"
default = "0"
help = "Free field to specify exactly the footprint in Mb if you don't want to use one of the three previous values."
[main.php_fpm_config.usage]
ask = "Expected usage of the service ?"
ask = "Expected usage of the service?"
choices = ["low", "medium", "high"]
default = "low"
help = "low: Personal usage, behind the sso. No RAM footprint when not used, but the impact on the processor can be high if many users are using the service.<br>medium: Low usage, few people or/and publicly accessible. Low RAM footprint, medium processor footprint when used.<br>high: High usage, frequently visited website. High RAM footprint, but lower on processor usage and quickly responding."

23
doc/DISCLAIMER.md Normal file
View file

@ -0,0 +1,23 @@
## Configuration
#### Configure OnlyOffice integration
Starting from Nextcloud 18, it features a direct integration of OnlyOffice (an online rich text document editor) through a Nextcloud app.
To install and configure it:
- Install *Community Document Server* application in your Nextcloud. That's the part that runs OnlyOffice server.
- Install *ONLYOFFICE* application. That's the client part that will connect to an OnlyOffice server.
- Then in Settings -> ONLYOFFICE (`https://yourdomain.tld/nextcloud/settings/admin/onlyoffice`), if you want to configure which file formats should be opened by OnlyOffice.
- Here you go :) You should be able to create new type of documents and open them.
*NB: OnlyOffice is only available for x86 architecture - **ARM** architecture is **not** supported (Raspberry Pi, OLinuXino...)*
## YunoHost specific features
In addition to Nextcloud core features, the following are made available with
this package:
* Integrate with YunoHost users and SSO - i.e. logout button
* Allow one user to be the administrator (set at the installation)
* Allow multiple instances of this application
* Optionally access the user home folder from Nextcloud files (set at the installation, the sharing is enabled by default)
* Serve `/.well-known` paths for CalDAV and CardDAV on the domain only if it's not already served - i.e. by Baïkal

22
doc/DISCLAIMER_fr.md Normal file
View file

@ -0,0 +1,22 @@
## Configuration
#### Configurer l'intégration d'OnlyOffice
À partir de sa version 18, Nextcloud inclut une intégration directe de OnlyOffice (un éditeur de texte enrichi en ligne) via une application Nextcloud.
Pour l'installer et la configurer :
- Installez l'application *Community Document Server* dans votre Nextcloud. C'est la partie qui fait tourner un serveur OnlyOffice.
- Installez l'application *ONLYOFFICE*. C'est la partie cliente qui va se connecter au serveur OnlyOffice.
- Ensuite dans les Paramètres -> ONLYOFFICE (`https://yourdomain.tld/nextcloud/settings/admin/onlyoffice`), si vous voulez configurer quels formats de fichier s'ouvrent avec OnlyOffice.
- Et voilà :) Vous devriez pouvoir créer de nouveaux types de documents, et les ouvrir.
*NB : OnlyOffice n'est disponible que sous architecture x86 - L'architecture **ARM** n'est **pas** supporté (Raspberry Pi, OLinuXino...)*
## Caractéristiques spécifiques YunoHost
En plus des fonctionnalités principales de Nextcloud, les fonctionnalités suivantes sont incluses dans ce package :
* Intégration avec les utilisateurs YunoHost et le SSO - exemple, le bouton de déconnexion
* Permet à un utilisateur d'être l'administrateur (choisi à l'installation)
* Permet de multiples instances de cette application
* Accès optionnel au répertoire home depuis les fichiers Nextcloud (à activer à l'installation, le partage étant activé par défaut)
* Utilise l'adresse `/.well-known` pour la synchronisation CalDAV et CardDAV du domaine si aucun autre service ne l'utilise déjà - par exemple, baikal

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

View file

@ -1,5 +1,6 @@
#!/bin/bash
user=$1
user="$1"
app="$(basename $0 | cut -d- -f 2-)" # Extract the app name from the script name, which is supposed to be something like "50-app_id"
sudo setfacl --modify g:__GROUP__:rwx /home/$user
setfacl --modify g:$app:rwx /home/$user

View file

@ -6,15 +6,23 @@
"en": "Online storage, file sharing platform and various other applications",
"fr": "Stockage en ligne, plateforme de partage de fichiers et diverses autres applications"
},
"version": "20.0.7~ynh1",
"version": "22.2.9~ynh1",
"url": "https://nextcloud.com",
"upstream": {
"license": "AGPL-3.0",
"website": "https://nextcloud.com",
"demo": "https://demo.nextcloud.com/",
"admindoc": "https://docs.nextcloud.com/server/stable/admin_manual/",
"userdoc": "https://docs.nextcloud.com/server/latest/user_manual/en/",
"code": "https://github.com/nextcloud/server"
},
"license": "AGPL-3.0",
"maintainer": {
"name": "YunoHost Contributors",
"email": "apps@yunohost.org"
"name": "Kay0u",
"email": "pierre@kayou.io"
},
"requirements": {
"yunohost": ">= 4.1.6"
"yunohost": ">= 4.3.0"
},
"multi_instance": true,
"services": [
@ -26,31 +34,26 @@
"install" : [
{
"name": "domain",
"type": "domain",
"ask": {
"en": "Choose a domain for Nextcloud",
"fr": "Choisissez un domaine pour Nextcloud"
},
"example": "domain.org"
"type": "domain"
},
{
"name": "path",
"type": "path",
"ask": {
"en": "Choose a path for Nextcloud",
"fr": "Choisissez un chemin pour Nextcloud"
},
"example": "/nextcloud",
"default": "/nextcloud"
},
{
"name": "admin",
"type": "user",
"ask": {
"en": "Choose the Nextcloud administrator (must be an existing YunoHost user)",
"fr": "Choisissez l'administrateur de Nextcloud (doit être un utilisateur YunoHost existant)"
"type": "user"
},
{
"name": "is_public",
"type": "boolean",
"help": {
"en": "If enabled, Nextcloud will be accessible by Nextcloud Desktop and by users without a YunoHost account. This can be changed later in the webadmin.",
"fr": "Si cette case est cochée, Nextcloud sera accessible par Nextcloud Desktop et par les utilisateurs nayant pas de compte YunoHost. Vous pourrez changer dans la webadmin."
},
"example": "homer"
"default": true
},
{
"name": "user_home",

View file

@ -1,24 +0,0 @@
## Problem
- *Description of why you made this PR*
## Solution
- *And how you fix that*
## PR Status
- [ ] Code finished.
- [ ] Tested with Package_check.
- [ ] Fix or enhancement tested.
- [ ] Upgrade from last version tested.
- [ ] Can be reviewed and tested.
## Validation
---
*Minor decision*
- **Upgrade previous version** :
- [ ] **Code review** :
- [ ] **Approval (LGTM)** :
- [ ] **Approval (LGTM)** :
## Package_check results
---
* 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

@ -4,30 +4,13 @@
# COMMON VARIABLES
#=================================================
pkg_dependencies="imagemagick acl tar smbclient at"
YNH_PHP_VERSION="7.3"
extra_php_dependencies="php${YNH_PHP_VERSION}-bz2 php${YNH_PHP_VERSION}-imap php${YNH_PHP_VERSION}-smbclient php${YNH_PHP_VERSION}-gmp php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-apcu php${YNH_PHP_VERSION}-redis php${YNH_PHP_VERSION}-ldap php${YNH_PHP_VERSION}-imagick php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-igbinary php${YNH_PHP_VERSION}-bcmath"
pkg_dependencies="imagemagick libmagickcore-6.q16-6-extra acl tar smbclient at php${YNH_PHP_VERSION}-bz2 php${YNH_PHP_VERSION}-imap php${YNH_PHP_VERSION}-gmp php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-apcu php${YNH_PHP_VERSION}-redis php${YNH_PHP_VERSION}-ldap php${YNH_PHP_VERSION}-imagick php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-igbinary php${YNH_PHP_VERSION}-bcmath"
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
# Execute a command as another user
# usage: exec_as USER COMMAND [ARG ...]
exec_as() {
local USER=$1
shift 1
if [[ $USER = $(whoami) ]]; then
eval "$@"
else
sudo -u "$USER" "$@"
fi
}
#=================================================
# Check if an URL is already handled
# usage: is_url_handled --domain=DOMAIN --path=PATH_URI
is_url_handled() {
@ -60,251 +43,6 @@ is_url_handled() {
fi
}
#=================================================
# Make the main steps to migrate an app to its fork.
#
# This helper has to be used for an app which needs to migrate to a new name or a new fork
# (like owncloud to nextcloud or zerobin to privatebin).
#
# This helper will move the files of an app to its new name
# or recreate the things it can't move.
#
# To specify which files it has to move, you have to create a "migration file", stored in ../conf
# This file is a simple list of each file it has to move,
# except that file names must reference the $app variable instead of the real name of the app,
# and every instance-specific variables (like $domain).
# $app is especially important because it's this variable which will be used to identify the old place and the new one for each file.
#
# If a database exists for this app, it will be dumped and then imported in a newly created database, with a new name and new user.
# Don't forget you have to then apply these changes to application-specific settings (depends on the packaged application)
#
# Same things for an existing user, a new one will be created.
# But the old one can't be removed unless it's not used. See below.
#
# If you have some dependencies for your app, it's possible to change the fake debian package which manages them.
# You have to fill the $pkg_dependencies variable, and then a new fake package will be created and installed,
# and the old one will be removed.
# If you don't have a $pkg_dependencies variable, the helper can't know what the app dependencies are.
#
# The app settings.yml will be modified as follows:
# - finalpath will be changed according to the new name (but only if the existing $final_path contains the old app name)
# - The checksums of php-fpm and nginx config files will be updated too.
# - If there is a $db_name value, it will be changed.
# - And, of course, the ID will be changed to the new name too.
#
# Finally, the $app variable will take the value of the new name.
# The helper will set the $migration_process variable to 1 if a migration has been successfully handled.
#
# You have to handle by yourself all the migrations not done by this helper, like configuration or special values in settings.yml
# Also, at the end of the upgrade script, you have to add a post_migration script to handle all the things the helper can't do during YunoHost upgrade (mostly for permission reasons),
# especially remove the old user, move some hooks and remove the old configuration directory
# To launch this script, you have to move it elsewhere and start it after the upgrade script.
# `cp ../conf/$script_post_migration /tmp`
# `(cd /tmp; echo "/tmp/$script_post_migration" | at now + 2 minutes)`
#
# usage: ynh_handle_app_migration migration_id migration_list
# | arg: migration_id - ID from which to migrate
# | arg: migration_list - File specifying every file to move (one file per line)
ynh_handle_app_migration () {
#=================================================
# LOAD SETTINGS
#=================================================
old_app=$YNH_APP_INSTANCE_NAME
local old_app_id=$YNH_APP_ID
local old_app_number=$YNH_APP_INSTANCE_NUMBER
# Get the id from which to migrate
local migration_id="$1"
# And the file with the paths to move
local migration_list="$2"
# Get the new app id in the manifest
local new_app_id=$(grep \"id\": ../manifest.json | cut -d\" -f4)
if [ $old_app_number -eq 1 ]; then
local new_app=$new_app_id
else
local new_app=${new_app_id}__${old_app_number}
fi
#=================================================
# CHECK IF IT HAS TO MIGRATE
#=================================================
migration_process=0
if [ "$old_app_id" == "$new_app_id" ]
then
# If the 2 id are the same
# No migration to do.
echo 0
return 0
else
if [ "$old_app_id" != "$migration_id" ]
then
# If the new app is not the authorized id, fail.
ynh_die "Incompatible application for migration from $old_app_id to $new_app_id"
fi
echo "Migrate from $old_app_id to $new_app_id" >&2
#=================================================
# CHECK IF THE MIGRATION CAN BE DONE
#=================================================
# TODO Handle multi instance apps...
# Check that there is not already an app installed for this id.
yunohost app list | grep -q 'id: $appname' \
&& ynh_die "$new_app is already installed"
#=================================================
# CHECK THE LIST OF FILES TO MOVE
#=================================================
local temp_migration_list="$(tempfile)"
# Build the list by removing blank lines and comment lines
sed '/^#.*\|^$/d' "../conf/$migration_list" > "$temp_migration_list"
# Check if there is no file in the destination
local file_to_move=""
while read file_to_move
do
# Replace all occurences of $app by $new_app in each file to move.
local move_to_destination="${file_to_move//\$app/$new_app}"
test -e "$move_to_destination" && ynh_die "A file named $move_to_destination already exists."
done < "$temp_migration_list"
#=================================================
# COPY YUNOHOST SETTINGS FOR THIS APP
#=================================================
local settings_dir="/etc/yunohost/apps"
cp -a "$settings_dir/$old_app" "$settings_dir/$new_app"
# Replace the old id by the new one
ynh_replace_string "\(^id: .*\)$old_app" "\1$new_app" "$settings_dir/$new_app/settings.yml"
# INFO: There a special behavior with yunohost app setting:
# if the id given in argument does not match with the id
# stored in the config file, the config file will be purged.
# That's why we use sed instead of app setting here.
# https://github.com/YunoHost/yunohost/blob/c6b5284be8da39cf2da4e1036a730eb5e0515096/src/yunohost/app.py#L1316-L1321
# Change the label if it's simply the name of the app
old_label=$(ynh_app_setting_get $new_app label)
if [ "${old_label,,}" == "$old_app_id" ]
then
# Build the new label from the id of the app. With the first character as upper case
new_label=$(echo $new_app_id | cut -c1 | tr [:lower:] [:upper:])$(echo $new_app_id | cut -c2-)
ynh_app_setting_set $new_app label $new_label
fi
#=================================================
# MOVE FILES TO THE NEW DESTINATION
#=================================================
while read file_to_move
do
# Replace all occurence of $app by $new_app in each file to move.
move_to_destination="$(eval echo "${file_to_move//\$app/$new_app}")"
local real_file_to_move="$(eval echo "${file_to_move//\$app/$old_app}")"
echo "Move file $real_file_to_move to $move_to_destination" >&2
mv "$real_file_to_move" "$move_to_destination"
done < "$temp_migration_list"
#=================================================
# UPDATE SETTINGS KNOWN ENTRIES
#=================================================
# Replace nginx checksum
ynh_replace_string "\(^checksum__etc_nginx.*\)_$old_app" "\1_$new_app/" "$settings_dir/$new_app/settings.yml"
# Replace php5-fpm checksums
ynh_replace_string "\(^checksum__etc_php5.*[-_]\)$old_app" "\1$new_app/" "$settings_dir/$new_app/settings.yml"
# Replace final_path
ynh_replace_string "\(^final_path: .*\)$old_app" "\1$new_app" "$settings_dir/$new_app/settings.yml"
#=================================================
# MOVE THE DATABASE
#=================================================
db_pwd=$(ynh_app_setting_get $old_app mysqlpwd)
db_name=$(ynh_app_setting_get $old_app db_name)
# Check if a database exists before trying to move it
local mysql_root_password=$(cat $MYSQL_ROOT_PWD_FILE)
if [ -n "$db_name" ] && mysqlshow -u root -p$mysql_root_password | grep -q "^| $db_name"
then
new_db_name=$(ynh_sanitize_dbid $new_app)
echo "Rename the database $db_name to $new_db_name" >&2
local sql_dump="/tmp/${db_name}-$(date '+%s').sql"
# Dump the old database
ynh_mysql_dump_db "$db_name" > "$sql_dump"
# Create a new database
ynh_mysql_setup_db $new_db_name $new_db_name $db_pwd
# Then restore the old one into the new one
ynh_mysql_connect_as $new_db_name $db_pwd $new_db_name < "$sql_dump"
# Remove the old database
ynh_mysql_remove_db $db_name $db_name
# And the dump
ynh_secure_remove "$sql_dump"
# Update the value of $db_name
db_name=$new_db_name
ynh_app_setting_set $new_app db_name $db_name
fi
#=================================================
# CREATE A NEW USER
#=================================================
# Check if the user exists on the system
if ynh_system_user_exists "$old_app"
then
echo "Create a new user $new_app to replace $old_app" >&2
ynh_system_user_create $new_app
fi
#=================================================
# CHANGE THE FAKE DEPENDENCIES PACKAGE
#=================================================
# Check if a variable $pkg_dependencies exists
# If this variable doesn't exist, this part shall be managed in the upgrade script.
if [ -n "${pkg_dependencies:-}" ]
then
# Define the name of the package
local old_package_name="${old_app//_/-}-ynh-deps"
local new_package_name="${new_app//_/-}-ynh-deps"
if ynh_package_is_installed "$old_package_name"
then
# Install a new fake package
app=$new_app
ynh_install_app_dependencies $pkg_dependencies
# Then remove the old one
app=$old_app
ynh_remove_app_dependencies
fi
fi
#=================================================
# UPDATE THE ID OF THE APP
#=================================================
app=$new_app
# Set migration_process to 1 to inform that an upgrade has been made
migration_process=1
fi
}
#=================================================
@ -348,42 +86,3 @@ ynh_smart_mktemp () {
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================
#=================================================
# YUNOHOST MULTIMEDIA INTEGRATION
#=================================================
# Install or update the main directory yunohost.multimedia
#
# usage: ynh_multimedia_build_main_dir
ynh_multimedia_build_main_dir () {
local ynh_media_release="v1.2"
local checksum="806a827ba1902d6911095602a9221181"
# Download yunohost.multimedia scripts
wget -nv https://github.com/YunoHost-Apps/yunohost.multimedia/archive/${ynh_media_release}.tar.gz 2>&1
# Check the control sum
echo "${checksum} ${ynh_media_release}.tar.gz" | md5sum -c --status \
|| ynh_die "Corrupt source"
# Check if the package acl is installed. Or install it.
ynh_package_is_installed 'acl' \
|| ynh_package_install acl
# Extract
mkdir yunohost.multimedia-master
tar -xf ${ynh_media_release}.tar.gz -C yunohost.multimedia-master --strip-components 1
./yunohost.multimedia-master/script/ynh_media_build.sh
}
# Grant write access to multimedia directories to a specified user
#
# usage: ynh_multimedia_addaccess user_name
#
# | arg: user_name - User to be granted write access
ynh_multimedia_addaccess () {
local user_name=$1
groupadd -f multimedia
usermod -a -G multimedia $user_name
}

View file

@ -28,7 +28,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
# Define a function to execute commands with `occ`
exec_occ() {
(cd "$final_path" && exec_as "$app" \
php$YNH_PHP_VERSION occ --no-interaction --no-ansi "$@")
php$YNH_PHP_VERSION --define apc.enable_cli=1 occ --no-interaction --no-ansi "$@")
}
# Define a function to add an external storage

View file

@ -42,7 +42,7 @@ ynh_script_progression --message="Disabling maintenance mode..." --weight=3
(
cd "$final_path" && exec_as "$app" \
php$YNH_PHP_VERSION occ --no-interaction --no-ansi maintenance:mode --off
php$YNH_PHP_VERSION --define apc.enable_cli=1 occ --no-interaction --no-ansi maintenance:mode --off
)
#=================================================

View file

@ -28,6 +28,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
@ -65,7 +66,7 @@ ynh_mysql_dump_db --database="$db_name" --default_character_set="utf8mb4" > db.s
# BACKUP LOGROTATE
#=================================================
ynh_backup "/etc/logrotate.d/$app"
ynh_backup --src_path="/etc/logrotate.d/$app"
#=================================================
# BACKUP FAIL2BAN CONFIGURATION
@ -85,7 +86,7 @@ ynh_backup --src_path="/etc/cron.d/$app"
#=================================================
ynh_print_info --message="Backing up data directory..."
ynh_backup --src_path="/home/yunohost.app/${app}/data" --is_big
ynh_backup --src_path="$datadir" --is_big
#=================================================
# END OF SCRIPT

View file

@ -30,6 +30,23 @@ ynh_script_progression --message="Loading installation settings..."
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# 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"
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED
#=================================================
@ -84,8 +101,8 @@ ynh_script_progression --message="Applying Nextcloud specific modifications..."
# Define a function to execute commands with `occ`
exec_occ() {
(cd "$final_path" && exec_as "$app" \
php${phpversion} occ --no-interaction --no-ansi "$@")
(cd "$final_path" && ynh_exec_as "$app" \
php${phpversion} --define apc.enable_cli=1 occ --no-interaction --no-ansi "$@")
}
if [ $change_domain -eq 1 ]
@ -94,15 +111,15 @@ then
exec_occ config:system:set trusted_domains 1 --value=$new_domain
# Change hostname for activity notifications
ynh_replace_string --match_string="'overwrite.cli.url' => 'http://${old_domain}'," --replace_string="'overwrite.cli.url' => 'https://${new_domain}'," --target_file="${final_path}/config/config.php"
exec_occ config:system:set overwrite.cli.url --value="https://${new_domain}"
fi
if [ $change_domain -eq 1 ]
then
# Check if .well-known is available for this domain
if is_url_handled --domain="$domain" --path="/.well-known/caldav" || is_url_handled --domain="$domain" --path="/.well-known/carddav"
if is_url_handled --domain="$new_domain" --path="/.well-known/caldav" || is_url_handled --domain="$new_domain" --path="/.well-known/carddav"
then
ynh_print_warn --message="Another app already uses the domain $domain to serve a caldav/carddav feature. You may encounter issues when dealing with your calendar or address book."
ynh_print_warn --message="Another app already uses the domain $new_domain to serve a caldav/carddav feature. You may encounter issues when dealing with your calendar or address book."
# Remove lines about .well-known/carddav and caldav with sed.
sed --in-place --regexp-extended '/location = \/\.well\-known\/(caldav|carddav)/d' "/etc/nginx/conf.d/$new_domain.d/$app.conf"

View file

@ -25,6 +25,7 @@ domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
admin=$YNH_APP_ARG_ADMIN
user_home=$YNH_APP_ARG_USER_HOME
is_public=$YNH_APP_ARG_IS_PUBLIC
app=$YNH_APP_INSTANCE_NAME
@ -77,10 +78,15 @@ ynh_script_progression --message="Setting up source files..."
# Load the last available version
source upgrade.d/upgrade.last.sh
# Create an app.src for the last version of nextcloud
cp ../conf/app.src.default ../conf/app.src
ynh_replace_string --match_string="__VERSION__" --replace_string="$next_version" --target_file="../conf/app.src"
ynh_replace_string --match_string="__SHA256_SUM__" --replace_string="$nextcloud_source_sha256" --target_file="../conf/app.src"
cat > ../conf/app.src << EOF
SOURCE_URL=https://download.nextcloud.com/server/releases/nextcloud-$next_version.tar.bz2
SOURCE_SUM=$nextcloud_source_sha256
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.bz2
SOURCE_IN_SUBDIR=true
EOF
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Enable YunoHost patches on Nextcloud sources
@ -88,9 +94,6 @@ cp -a ../sources/patches_last_version/* ../sources/patches
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path"
# Allow Symlinks for multimedia folder
ynh_replace_string --match_string="protected \$allowSymlinks = false;" --replace_string="protected \$allowSymlinks = true;" --target_file="$final_path/lib/private/Files/Storage/Local.php"
#=================================================
# CREATE DEDICATED USER
#=================================================
@ -105,7 +108,7 @@ ynh_system_user_create --username=$app
ynh_script_progression --message="Configuring PHP-FPM..." --weight=50
# Create a dedicated php-fpm config
ynh_add_fpm_config --usage=medium --footprint=high --phpversion=$YNH_PHP_VERSION --package="$extra_php_dependencies"
ynh_add_fpm_config --usage=medium --footprint=high --phpversion=$YNH_PHP_VERSION
# Used by ynh_add_nginx_config
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
@ -131,9 +134,12 @@ ynh_add_nginx_config
#=================================================
# CREATE THE DATA DIRECTORY
#=================================================
ynh_script_progression --message="Creating a data directory..." --weight=1
# Define app's data directory
datadir="/home/yunohost.app/$app/data"
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
# Create app folders
mkdir -p "$datadir"
@ -144,18 +150,23 @@ ynh_script_progression --message="Installing Nextcloud..." --weight=30
# Define a function to execute commands with `occ`
exec_occ() {
(cd "$final_path" && exec_as "$app" \
php${phpversion} occ --no-interaction --no-ansi "$@")
(cd "$final_path" && ynh_exec_as "$app" \
php${phpversion} --define apc.enable_cli=1 occ --no-interaction --no-ansi "$@")
}
# Set write access for the following commands
chown -R $app: "$final_path" "$datadir"
# Define password in an intermediate var
# The fact that it's called _password allows it to be
# picked up by Yunohost's auto-redact mecanism
admin_password="$(ynh_string_random --length=6)"
# Install Nextcloud using a temporary admin user
exec_occ maintenance:install \
--database "mysql" --database-name $db_name \
--database-user $db_name --database-pass "$db_pwd" \
--admin-user "admin" --admin-pass "$(ynh_string_random --length=6)" \
--admin-user "admin" --admin-pass "$admin_password" \
--data-dir "$datadir" \
|| ynh_die --message="Unable to install Nextcloud"
@ -173,10 +184,8 @@ exec_occ ldap:create-empty-config
# Load the installation config file in Nextcloud
nc_conf="$final_path/config_install.json"
cp ../conf/config_install.json "$nc_conf"
ynh_add_config --template="../conf/config_install.json" --destination="$nc_conf"
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$nc_conf"
ynh_replace_string --match_string="__DATADIR__" --replace_string="$datadir" --target_file="$nc_conf"
exec_occ config:import "$nc_conf"
# Then remove the config file
@ -184,7 +193,7 @@ ynh_secure_remove --file="$nc_conf"
# Load the additional config file (used also for upgrade)
nc_conf="$final_path/config.json"
cp ../conf/config.json "$nc_conf"
ynh_add_config --template="../conf/config.json" --destination="$nc_conf"
exec_occ config:import "$nc_conf"
@ -244,7 +253,7 @@ exec_occ config:system:get logout_url >/dev/null 2>&1 \
# CHANGE HOSTNAME FOR ACTIVITY NOTIFICATIONS
#=================================================
ynh_replace_string --match_string="'overwrite.cli.url' => 'http://localhost'," --replace_string="'overwrite.cli.url' => 'https://${domain}'," --target_file="${final_path}/config/config.php"
exec_occ config:system:set overwrite.cli.url --value="https://${domain}"
#=================================================
# REMOVE THE TEMPORARY ADMIN AND SET THE TRUE ONE
@ -268,14 +277,10 @@ ynh_store_file_checksum --file="$final_path/config/config.php"
#=================================================
cron_path="/etc/cron.d/$app"
cp -a ../conf/nextcloud.cron "$cron_path"
ynh_add_config --template="../conf/nextcloud.cron" --destination="$cron_path"
chown root: "$cron_path"
chmod 644 "$cron_path"
ynh_replace_string --match_string="__USER__" --replace_string="$app" --target_file="$cron_path"
ynh_replace_string --match_string="__DESTDIR__" --replace_string="$final_path" --target_file="$cron_path"
ynh_replace_string --match_string="__YNH_PHP_VERSION__" --replace_string="$phpversion" --target_file="$cron_path"
exec_occ background:cron
#=================================================
@ -286,13 +291,6 @@ exec_occ db:add-missing-indices
exec_occ db:add-missing-columns
exec_occ db:convert-filecache-bigint -n
#=================================================
# CONFIGURE THE HOOK FILE FOR USER CREATE
#=================================================
# Set system group in hooks
ynh_replace_string --match_string="__GROUP__" --replace_string="$app" --target_file=../hooks/post_user_create
#=================================================
# YUNOHOST MULTIMEDIA INTEGRATION
#=================================================
@ -314,13 +312,15 @@ ynh_multimedia_addaccess $app
#=================================================
# Fix app ownerships & permissions
chown -R $app: "$final_path" "$datadir"
chown -R $app:www-data "$final_path"
chown -R $app: "$datadir"
find $final_path/ -type f -print0 | xargs -0 chmod 0644
find $final_path/ -type d -print0 | xargs -0 chmod 0755
find $datadir/ -type f -print0 | xargs -0 chmod 0640
find $datadir/ -type d -print0 | xargs -0 chmod 0750
chmod 640 "$final_path/config/config.php"
chmod 755 /home/yunohost.app
chmod 750 $final_path
#=================================================
# SETUP LOGROTATE
@ -341,11 +341,15 @@ ynh_add_fail2ban_config --logpath="/home/yunohost.app/$app/data/nextcloud.log" -
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring SSOwat..."
ynh_script_progression --message="Configuring permissions..."
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
ynh_app_setting_set --app=$app --key=skipped_regex \
--value="$(sed 's/[\.\-]/\%&/g' <<< $domain)/%.well%-known/.*"
# Make app public if necessary
if [ $is_public -eq 1 ]
then
ynh_permission_update --permission="main" --add="visitors"
fi
ynh_permission_create --permission="api" --label="api" --url="re:$domain\/.well-known\/.*" --allowed="visitors" "all_users" --auth_header="false" --show_tile="false" --protected="true"
#=================================================
# RELOAD NGINX

View file

@ -19,6 +19,7 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
#=================================================
# STANDARD REMOVE
@ -46,6 +47,17 @@ ynh_script_progression --message="Removing app main directory..." --weight=3
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE DATA DIR
#=================================================
# Remove the data directory if --purge option is used
if [ "${YNH_APP_PURGE:-0}" -eq 1 ]
then
ynh_script_progression --message="Removing app data directory..." --weight=1
ynh_secure_remove --file="$datadir"
fi
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================

View file

@ -29,6 +29,7 @@ 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)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage)
@ -38,8 +39,6 @@ fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage)
#=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=4
ynh_webpath_available --domain=$domain --path_url=$path_url \
|| ynh_die --message="Path not available: ${domain}${path_url}"
test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path "
@ -106,7 +105,7 @@ ynh_script_progression --message="Reconfiguring PHP-FPM..." --weight=50
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
# Recreate a dedicated php-fpm config
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$phpversion --package="$extra_php_dependencies"
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$phpversion
#=================================================
# RESTORE THE CRON FILE
@ -125,8 +124,6 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#=================================================
ynh_script_progression --message="Restoring data directory..." --weight=2
datadir="/home/yunohost.app/$app/data"
# Use --not_mandatory for the data directory, because if the backup has been made with BACKUP_CORE_ONLY, there's no data into the backup.
ynh_restore_file --origin_path="$datadir" --not_mandatory
@ -137,9 +134,15 @@ mkdir -p "$datadir"
#=================================================
# Fix app ownerships & permissions
chown -R $app: "$final_path" "$datadir"
chown -R $app:www-data "$final_path"
chown -R $app: "$datadir"
find $final_path/ -type f -print0 | xargs -0 chmod 0644
find $final_path/ -type d -print0 | xargs -0 chmod 0755
find $datadir/ -type f -print0 | xargs -0 chmod 0640
find $datadir/ -type d -print0 | xargs -0 chmod 0750
chmod 640 "$final_path/config/config.php"
chmod 755 /home/yunohost.app
chmod 750 $final_path
# Iterate over users to extend their home folder permissions - for the external
# storage plugin usage - and create relevant Nextcloud directories

View file

@ -50,6 +50,12 @@ if [ -z "$final_path" ]; then
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
fi
# If datadir doesn't exist, create it
if [ -z "$datadir" ]; then
datadir=/home/yunohost.app/$app
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
fi
# Remove the option backup_core_only if it's in the settings.yml file
ynh_app_setting_delete --app=$app --key=backup_core_only
@ -70,6 +76,18 @@ if [ -z "$phpversion" ]; then
phpversion="$YNH_PHP_VERSION"
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
# Create a permission if needed
if ! ynh_permission_exists --permission="api"; then
ynh_permission_create --permission="api" --label="api" --url="re:$domain\/.well-known\/.*" --allowed="visitors" "all_users" --auth_header="false" --show_tile="false" --protected="true"
fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
@ -102,6 +120,12 @@ fi
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
ynh_permission_create --permission="api" --label="api" --url="re:$domain\/.well-known\/.*" --allowed="visitors" "all_users" --auth_header="false" --show_tile="false" --protected="true"
fi
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
@ -138,7 +162,7 @@ then
fi
# Recreate a dedicated PHP-FPM config
ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint --package="$extra_php_dependencies"
ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint
# Delete existing ini configuration file (backward compatibility)
if [ -f /etc/php/$phpversion/fpm/conf.d/20-$app.ini ]; then
@ -187,8 +211,8 @@ exec_occ() {
else
NEXTCLOUD_PHP_VERSION="7.0"
fi
(cd "$final_path" && exec_as "$app" \
php$NEXTCLOUD_PHP_VERSION occ --no-interaction --no-ansi "$@")
(cd "$final_path" && ynh_exec_as "$app" \
php$NEXTCLOUD_PHP_VERSION --define apc.enable_cli=1 occ --no-interaction --no-ansi "$@")
}
# Define a function to add an external storage
@ -264,9 +288,13 @@ then
ynh_print_info --message="Upgrade to nextcloud $next_version"
# Create an app.src for this version of Nextcloud
cp ../conf/app.src.default ../conf/app.src
ynh_replace_string --match_string="__VERSION__" --replace_string="$next_version" --target_file="../conf/app.src"
ynh_replace_string --match_string="__SHA256_SUM__" --replace_string="$nextcloud_source_sha256" --target_file="../conf/app.src"
cat > ../conf/app.src << EOF
SOURCE_URL=https://download.nextcloud.com/server/releases/nextcloud-$next_version.tar.bz2
SOURCE_SUM=$nextcloud_source_sha256
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.bz2
SOURCE_IN_SUBDIR=true
EOF
# Create a temporary directory
tmpdir="$(ynh_smart_mktemp min_size=300)"
@ -274,9 +302,6 @@ then
# Install the next nextcloud version in $tmpdir
ynh_setup_source --dest_dir="$tmpdir"
# Allow Symlinks for multimedia folder
ynh_replace_string --match_string="protected \$allowSymlinks = false;" --replace_string="protected \$allowSymlinks = true;" --target_file="$tmpdir/lib/private/Files/Storage/Local.php"
# Enable maintenance mode
exec_occ maintenance:mode --on
@ -332,10 +357,7 @@ then
ynh_backup_if_checksum_is_different --file="$final_path/config/config.php"
nc_conf="${final_path}/config.json"
cp ../conf/config.json "$nc_conf"
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$nc_conf"
ynh_replace_string --match_string="__DATADIR__" --replace_string="$datadir" --target_file="$nc_conf"
ynh_add_config --template="../conf/config.json" --destination="$nc_conf"
# Reneable the mail app
if [ $mail_app_must_be_reactived -eq 1 ]; then
@ -372,7 +394,7 @@ then
# CHANGE HOSTNAME FOR ACTIVITY NOTIFICATIONS
#=================================================
ynh_replace_string --match_string="'overwrite.cli.url' => 'http://localhost'," --replace_string="'overwrite.cli.url' => 'https://${domain}'," --target_file="${final_path}/config/config.php"
exec_occ config:system:set overwrite.cli.url --value="https://${domain}"
#=================================================
# MOUNT HOME FOLDERS AS EXTERNAL STORAGE
@ -403,23 +425,12 @@ fi
#=================================================
cron_path="/etc/cron.d/$app"
cp -a ../conf/nextcloud.cron "$cron_path"
ynh_add_config --template="../conf/nextcloud.cron" --destination="$cron_path"
chown root: "$cron_path"
chmod 644 "$cron_path"
ynh_replace_string --match_string="__USER__" --replace_string="$app" --target_file="$cron_path"
ynh_replace_string --match_string="__DESTDIR__" --replace_string="$final_path" --target_file="$cron_path"
ynh_replace_string --match_string="__YNH_PHP_VERSION__" --replace_string="$phpversion" --target_file="$cron_path"
exec_occ background:cron
#=================================================
# UPDATE THE HOOK FILE FOR USER CREATE
#=================================================
# Set system group in hooks
ynh_replace_string --match_string="__GROUP__" --replace_string="$app" --target_file=../hooks/post_user_create
#=================================================
# GENERIC FINALIZATION
#=================================================
@ -427,13 +438,15 @@ ynh_replace_string --match_string="__GROUP__" --replace_string="$app" --target_f
#=================================================
# Fix app ownerships & permissions
chown -R $app: "$final_path" "$datadir"
chown -R $app:www-data "$final_path"
chown -R $app: "$datadir"
find $final_path/ -type f -print0 | xargs -0 chmod 0644
find $final_path/ -type d -print0 | xargs -0 chmod 0755
find $datadir/ -type f -print0 | xargs -0 chmod 0640
find $datadir/ -type d -print0 | xargs -0 chmod 0750
chmod 640 "$final_path/config/config.php"
chmod 755 /home/yunohost.app
chmod 750 $final_path
#=================================================
# WARNING ABOUT THIRD-PARTY APPS
@ -464,15 +477,6 @@ ynh_add_fail2ban_config --logpath="/home/yunohost.app/$app/data/nextcloud.log" -
#=================================================
# GENERIC FINALIZATION
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Upgrading SSOwat configuration..." --weight=2
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
ynh_app_setting_set --app=$app --key=skipped_regex \
--value="$(sed 's/[\.\-]/\%&/g' <<< $domain)/%.well%-known/.*"
#=================================================
# RELOAD NGINX
#=================================================

View file

@ -0,0 +1,7 @@
#!/bin/bash
# Last available nextcloud version
next_version="21.0.0"
# Nextcloud tarball checksum sha256
nextcloud_source_sha256="ceadaeef67685a11afc5b23b0a86ba3c7bd0a7b138d5d1ecc05262383655f1f0"

View file

@ -0,0 +1,7 @@
#!/bin/bash
# Last available nextcloud version
next_version="22.0.0"
# Nextcloud tarball checksum sha256
nextcloud_source_sha256="3911d3754c37aca7c9b5f3b2b37513c0f2b5bb979af00816c1117b1eedbc5d7a"

View file

@ -1,7 +1,7 @@
#!/bin/bash
# Last available Nextcloud version
next_version="20.0.7"
next_version="22.2.9"
# Nextcloud tarball checksum sha256
nextcloud_source_sha256="8ced82b772bf0af67d5be1323e40f977429bc0a2bcc864095efc78767500b72b"
nextcloud_source_sha256="0beb6b959db855e30023954bd1299b6bb1331f895e3095b51350ab5eaeb5b1cd"