diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..2729a6b --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -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.* diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..ef70e18 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -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) diff --git a/README.md b/README.md index dac2f68..4007b2f 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,8 @@ + + # 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) @@ -5,28 +10,22 @@ *[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.8 +**Shipped version:** 21.0.2~ynh1 + +**Demo:** https://demo.nextcloud.com/ ## Screenshots -![](https://raw.githubusercontent.com/nextcloud/screenshots/master/files/Files%20Overview.png) +![](./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,47 +51,18 @@ 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://yunohost.org/en/app_nextcloud +* Official admin documentation: https://docs.nextcloud.com/server/21/user_manual/en/ +* 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. ``` @@ -100,3 +70,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/nextcloud_ynh/tree/te 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 \ No newline at end of file diff --git a/README_fr.md b/README_fr.md index b478bea..aee7890 100644 --- a/README_fr.md +++ b/README_fr.md @@ -1,34 +1,28 @@ # 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) ![](https://ci-apps.yunohost.org/ci/badges/nextcloud.status.svg) ![](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)* +*[Lire ce readme en français.](./README_fr.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.8 +**Version incluse :** 21.0.2~ynh1 + +**Démo :** https://demo.nextcloud.com/ ## Captures d'écran -![](https://raw.githubusercontent.com/nextcloud/screenshots/master/files/Files%20Overview.png) +![](./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 +46,24 @@ 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://yunohost.org/en/app_nextcloud +* Documentation officielle de l'admin : https://docs.nextcloud.com/server/21/user_manual/en/ +* 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. ``` 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 \ No newline at end of file diff --git a/check_process b/check_process index 440eb43..8d88180 100644 --- a/check_process +++ b/check_process @@ -1,8 +1,8 @@ ;; Test complet ; Manifest - domain="domain.tld" (DOMAIN) - path="/path" (PATH) - admin="homer" (USER) + domain="domain.tld" + path="/path" + admin="homer" user_home="1" ; Checks pkg_linter=1 diff --git a/conf/app.src.default b/conf/app.src.default deleted file mode 100644 index 1347e37..0000000 --- a/conf/app.src.default +++ /dev/null @@ -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= diff --git a/conf/config.json b/conf/config.json index f7c5fa5..70efa3f 100644 --- a/conf/config.json +++ b/conf/config.json @@ -11,7 +11,8 @@ "timeout": "0.0", "password": "" }, - "hashing_default_password": true + "hashing_default_password": true, + "localstorage.allowsymlinks": true }, "apps": { "user_ldap": { @@ -29,7 +30,7 @@ "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", diff --git a/conf/nextcloud.cron b/conf/nextcloud.cron index 3a63ff5..e040d0c 100644 --- a/conf/nextcloud.cron +++ b/conf/nextcloud.cron @@ -1 +1 @@ -*/15 * * * * __USER__ /usr/bin/php__YNH_PHP_VERSION__ -f __DESTDIR__/cron.php +*/15 * * * * __APP__ /usr/bin/php__PHPVERSION__ -f __FINAL_PATH__/cron.php diff --git a/conf/nginx.conf b/conf/nginx.conf index 781fb77..7970b97 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -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; } @@ -107,6 +106,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; diff --git a/config_panel.toml b/config_panel.toml index b88c83e..9c73626 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -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.
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.
medium: Low usage, few people or/and publicly accessible. Low RAM footprint, medium processor footprint when used.
high: High usage, frequently visited website. High RAM footprint, but lower on processor usage and quickly responding." diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md new file mode 100644 index 0000000..ff9f640 --- /dev/null +++ b/doc/DISCLAIMER.md @@ -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 diff --git a/doc/DISCLAIMER_fr.md b/doc/DISCLAIMER_fr.md new file mode 100644 index 0000000..aacdc22 --- /dev/null +++ b/doc/DISCLAIMER_fr.md @@ -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 diff --git a/doc/screenshots/screenshot.png b/doc/screenshots/screenshot.png new file mode 100644 index 0000000..966bb3e Binary files /dev/null and b/doc/screenshots/screenshot.png differ diff --git a/hooks/post_user_create b/hooks/post_user_create index da6bb53..c6717ef 100644 --- a/hooks/post_user_create +++ b/hooks/post_user_create @@ -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 diff --git a/manifest.json b/manifest.json index f6f82a9..ccc8955 100644 --- a/manifest.json +++ b/manifest.json @@ -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.8~ynh1", + "version": "21.0.2~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/21/user_manual/en/", + "userdoc": "https://yunohost.org/en/app_nextcloud", + "code": "https://github.com/nextcloud/server" + }, "license": "AGPL-3.0", "maintainer": { "name": "Kay0u", "email": "pierre@kayou.io" }, "requirements": { - "yunohost": ">= 4.1.6" + "yunohost": ">= 4.2" }, "multi_instance": true, "services": [ @@ -27,29 +35,17 @@ { "name": "domain", "type": "domain", - "ask": { - "en": "Choose a domain for Nextcloud", - "fr": "Choisissez un domaine pour Nextcloud" - }, "example": "domain.org" }, { "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)" - }, "example": "homer" }, { diff --git a/pull_request_template.md b/pull_request_template.md deleted file mode 100644 index f501dd4..0000000 --- a/pull_request_template.md +++ /dev/null @@ -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!"* diff --git a/scripts/_common.sh b/scripts/_common.sh index adf5f21..98be903 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -3,7 +3,7 @@ # COMMON VARIABLES #================================================= -pkg_dependencies="imagemagick acl tar smbclient at" +pkg_dependencies="imagemagick libmagickcore-6.q16-6-extra 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" @@ -12,21 +12,6 @@ extra_php_dependencies="php${YNH_PHP_VERSION}-bz2 php${YNH_PHP_VERSION}-imap php # 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() { @@ -102,42 +87,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 -} diff --git a/scripts/change_url b/scripts/change_url index 5cb1cb9..5c6deb8 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -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,7 +101,7 @@ ynh_script_progression --message="Applying Nextcloud specific modifications..." # Define a function to execute commands with `occ` exec_occ() { - (cd "$final_path" && exec_as "$app" \ + (cd "$final_path" && ynh_exec_as "$app" \ php${phpversion} occ --no-interaction --no-ansi "$@") } @@ -94,7 +111,7 @@ 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 ] diff --git a/scripts/install b/scripts/install index 1e1621d..51d8b0f 100755 --- a/scripts/install +++ b/scripts/install @@ -73,10 +73,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 @@ -84,9 +89,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 #================================================= @@ -140,18 +142,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" \ + (cd "$final_path" && ynh_exec_as "$app" \ php${phpversion} 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" @@ -169,10 +176,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 @@ -180,7 +185,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" @@ -240,7 +245,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 @@ -264,14 +269,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 #================================================= @@ -282,13 +283,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 #================================================= @@ -339,9 +333,7 @@ ynh_add_fail2ban_config --logpath="/home/yunohost.app/$app/data/nextcloud.log" - #================================================= ynh_script_progression --message="Configuring SSOwat..." -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/.*" +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 diff --git a/scripts/upgrade b/scripts/upgrade index 5805432..205cc51 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -102,6 +102,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 #================================================= @@ -187,7 +193,7 @@ exec_occ() { else NEXTCLOUD_PHP_VERSION="7.0" fi -(cd "$final_path" && exec_as "$app" \ +(cd "$final_path" && ynh_exec_as "$app" \ php$NEXTCLOUD_PHP_VERSION occ --no-interaction --no-ansi "$@") } @@ -261,9 +267,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)" @@ -271,9 +281,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 @@ -329,10 +336,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 @@ -369,7 +373,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 @@ -400,23 +404,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 #================================================= @@ -461,15 +454,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 #================================================= diff --git a/scripts/upgrade.d/upgrade.20.sh b/scripts/upgrade.d/upgrade.20.sh new file mode 100644 index 0000000..01a1f94 --- /dev/null +++ b/scripts/upgrade.d/upgrade.20.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +# Last available nextcloud version +next_version="21.0.0" + +# Nextcloud tarball checksum sha256 +nextcloud_source_sha256="ceadaeef67685a11afc5b23b0a86ba3c7bd0a7b138d5d1ecc05262383655f1f0" diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index 051172b..da7061c 100755 --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -1,7 +1,7 @@ #!/bin/bash # Last available Nextcloud version -next_version="20.0.8" +next_version="21.0.2" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="85746a4bda87bf754be5834cdb6489c365dc847653bab8ff3afccdaac3b356b5" +nextcloud_source_sha256="5e5b38109a3485db5fd2d248f24478eabe6c0790ec10b030acbbee207d5511fe"