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 new-permissions-system

This commit is contained in:
Kay0u 2021-03-01 13:06:31 +01:00
commit fa5d488abf
No known key found for this signature in database
GPG key ID: AAFEEB16CFA2AE2D
11 changed files with 44 additions and 193 deletions

View file

@ -12,7 +12,7 @@ If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to
[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. [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.
**Shipped version:** 20.0.4 **Shipped version:** 20.0.7
## Screenshots ## Screenshots
@ -25,7 +25,7 @@ If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to
## Documentation ## Documentation
* Official documentation: https://docs.nextcloud.com/server/19/user_manual/ * Official documentation: https://docs.nextcloud.com/server/20/user_manual/en/
* YunoHost documentation: https://github.com/YunoHost/doc/blob/master/app_nextcloud.md * YunoHost documentation: https://github.com/YunoHost/doc/blob/master/app_nextcloud.md
## Configuration ## Configuration
@ -81,30 +81,6 @@ If you need/want to use Nextcloud `occ` command¹, you need to be in `/var/www/n
¹ See https://docs.nextcloud.com/server/18/admin_manual/configuration_server/occ_command.html ¹ See https://docs.nextcloud.com/server/18/admin_manual/configuration_server/occ_command.html
Use this only if you know what you're doing :) Use this only if you know what you're doing :)
#### Migrate from ownCloud
**This is not considered as stable yet, please do it with care and only for testing!**
This package handles the migration from ownCloud to Nextcloud. For that, your ownCloud application must be **up-to-date** in YunoHost.
You will then have to upgrade your ownCloud application with this repository. This can only be done from the command-line interface - e.g. through SSH. Once you're connected, you simply have to execute the following:
```bash
sudo yunohost app upgrade -u https://github.com/YunoHost-Apps/nextcloud_ynh owncloud --debug
```
The `--debug` option will let you see the full output. If you encounter any
issue, please paste it.
Note that a cron job will be executed at some time after the end of this command. You must wait that before doing any other application operations! You should see that Nextcloud is installed after that.
Note that it does not change the application label nor the URL. To rename the label, you can execute the following - replace `Nextcloud` with whatever you want:
```bash
sudo yunohost app setting nextcloud label -v "Nextcloud"
sudo yunohost app ssowatconf
```
## Links ## Links
* Report a bug: https://github.com/YunoHost-Apps/nextcloud_ynh/issues * Report a bug: https://github.com/YunoHost-Apps/nextcloud_ynh/issues

View file

@ -13,7 +13,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
[Nextcloud](https://nextcloud.com) vous donne la liberté et le contrôle sur vos données. Un nuage personnel qui tourne sur votre serveur. [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. Avec NextCloud vous pouvez synchroniser vos fichiers sur vos appareils.
**Version incluse :** 20.0.4 **Version incluse :** 20.0.7
## Captures d'écran ## Captures d'écran
@ -26,7 +26,7 @@ Avec NextCloud vous pouvez synchroniser vos fichiers sur vos appareils.
## Documentation ## Documentation
* Documentation officielle : https://docs.nextcloud.com/server/19/user_manual/ * Documentation officielle : https://docs.nextcloud.com/server/20/user_manual/fr/
* Documentation YunoHost : https://github.com/YunoHost/doc/blob/master/app_nextcloud_fr.md * Documentation YunoHost : https://github.com/YunoHost/doc/blob/master/app_nextcloud_fr.md
## Configuration ## Configuration
@ -72,31 +72,6 @@ Et enfin, le message d'erreur suivant dans les logs de Nextcloud peut être igno
Following symlinks is not allowed ('/home/yunohost.multimedia/user/Share' -> '/home/yunohost.multimedia/share/' not inside '/home/yunohost.multimedia/user/') Following symlinks is not allowed ('/home/yunohost.multimedia/user/Share' -> '/home/yunohost.multimedia/share/' not inside '/home/yunohost.multimedia/user/')
``` ```
## Informations supplémentaires
#### Migrer depuis ownCloud
**La migration n'est pas encore considérée comme stable, merci de la faire prudemment et uniquement pour tester !**
Ce package gère la migration de ownCloud vers Nextcloud. Pour ça, l'application ownCloud doit **être à jour** dans YunoHost.
Vous allez ensuite mettre à niveau votre ownCloud avec ce dépôt.
Ça ne peut être fait qu'en ligne de commande - par exemple via SSH. Une fois connecté, vous n'avez plus qu'à exécuter la commande suivante :
```bash
sudo yunohost app upgrade -u https://github.com/YunoHost-Apps/nextcloud_ynh owncloud --debug
```
L'option `--debug` va vous permettre de visualiser entièrement les retours de la mise à niveau. Si vous rencontrez un problème, merci de nous le transmettre.
Notez qu'une tâche cron va être exécutée une fois la fin de cette commande. Vous devez attendre qu'elle se fasse avant de faire une autre opération liée aux applications.
Vous devriez constater que Nextcloud sera installé après ça.
Notez que ça ne changera pas le label ni l'URL. Pour renommer le label, vous pouvez exécuter la commande suivante (en remplaçant `Nextcloud` par ce que vous voulez) :
```bash
sudo yunohost app setting nextcloud label -v "Nextcloud"
sudo yunohost app ssowatconf
```
## Liens ## Liens
* Signaler un bug : https://github.com/YunoHost-Apps/nextcloud_ynh/issues * Signaler un bug : https://github.com/YunoHost-Apps/nextcloud_ynh/issues

View file

@ -24,9 +24,10 @@
"ldap_email_attr": "mail", "ldap_email_attr": "mail",
"ldap_expert_username_attr": "uid", "ldap_expert_username_attr": "uid",
"ldap_group_display_name": "cn", "ldap_group_display_name": "cn",
"ldap_group_filter": "objectClass=posixGroup", "ldap_group_filter": "(&(objectclass=top)(memberUid=*))",
"ldap_group_filter_mode": "0", "ldap_group_filter_mode": "0",
"ldap_groupfilter_objectclass": "posixGroup", "ldap_groupfilter_objectclass": "posixGroup",
"ldap_group_member_assoc_attribute": "memberUid",
"ldap_host": "localhost", "ldap_host": "localhost",
"ldap_login_filter": "(&(|(objectclass=posixAccount))(uid=%uid)(permission=cn=__APP__.main,ou=permission,dc=yunohost,dc=org))", "ldap_login_filter": "(&(|(objectclass=posixAccount))(uid=%uid)(permission=cn=__APP__.main,ou=permission,dc=yunohost,dc=org))",
"ldap_login_filter_mode": "0", "ldap_login_filter_mode": "0",

View file

@ -93,6 +93,10 @@ location ^~ __PATH__/ {
# then Nginx will encounter an infinite rewriting loop when it prepends # then Nginx will encounter an infinite rewriting loop when it prepends
# `/nextcloud/index.php` to the URI, resulting in a HTTP 500 error response. # `/nextcloud/index.php` to the URI, resulting in a HTTP 500 error response.
location ~ \.php(?:$|/) { 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)(/.*)$; fastcgi_split_path_info ^(.+?\.php)(/.*)$;
set $path_info $fastcgi_path_info; set $path_info $fastcgi_path_info;
try_files $fastcgi_script_name =404; try_files $fastcgi_script_name =404;

View file

@ -1,13 +0,0 @@
# File to migrate from Owncloud
# Final path
/var/www/$app
# Data directory
/home/yunohost.app/$app
# Nginx config
/etc/nginx/conf.d/$domain.d/$app.conf
# php-fpm config
/etc/php5/fpm/pool.d/$app.conf

View file

@ -1,45 +0,0 @@
#!/bin/bash
# Ending the migration process from Owncloud to Nextcloud
set -u
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source /usr/share/yunohost/helpers
#=================================================
# SET VARIABLES
#=================================================
old_app="__OLD_APP__"
new_app="__NEW_APP__"
script_name="$0"
#=================================================
# MOVE HOOKS
#=================================================
hooks_dir="/etc/yunohost/hooks.d/"
mv "$hooks_dir/post_user_create/50-$old_app" "$hooks_dir/post_user_create/50-$new_app"
#=================================================
# DELETE OLD APP'S SETTINGS
#=================================================
ynh_secure_remove "/etc/yunohost/apps/$old_app"
yunohost app ssowatconf
#=================================================
# REMOVE THE OLD USER
#=================================================
ynh_system_user_delete $old_app
#=================================================
# DELETE THIS SCRIPT
#=================================================
echo "rm $script_name" | at now + 1 minutes

View file

@ -6,7 +6,7 @@
"en": "Online storage, file sharing platform and various other applications", "en": "Online storage, file sharing platform and various other applications",
"fr": "Stockage en ligne, plateforme de partage de fichiers et diverses autres applications" "fr": "Stockage en ligne, plateforme de partage de fichiers et diverses autres applications"
}, },
"version": "20.0.4~ynh1", "version": "20.0.7~ynh1",
"url": "https://nextcloud.com", "url": "https://nextcloud.com",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"maintainer": { "maintainer": {
@ -14,12 +14,12 @@
"email": "apps@yunohost.org" "email": "apps@yunohost.org"
}, },
"requirements": { "requirements": {
"yunohost": ">= 4.1.0" "yunohost": ">= 4.1.6"
}, },
"multi_instance": true, "multi_instance": true,
"services": [ "services": [
"nginx", "nginx",
"php7.0-fpm", "php7.3-fpm",
"mysql" "mysql"
], ],
"arguments": { "arguments": {

View file

@ -18,7 +18,7 @@
- [ ] **Code review** : - [ ] **Code review** :
- [ ] **Approval (LGTM)** : - [ ] **Approval (LGTM)** :
- [ ] **Approval (LGTM)** : - [ ] **Approval (LGTM)** :
- **CI succeeded** :
[![Build Status](https://ci-apps-hq.yunohost.org/jenkins/job/nextcloud_ynh%20PR-NUM-/badge/icon)](https://ci-apps-hq.yunohost.org/jenkins/job/nextcloud_ynh%20PR-NUM-/) ## Package_check results
*Please replace '-NUM-' in this link by the PR number.* ---
When the PR is marked as ready to merge, you have to wait for 3 days before really merging it. * 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

@ -386,22 +386,3 @@ ynh_multimedia_addaccess () {
groupadd -f multimedia groupadd -f multimedia
usermod -a -G multimedia $user_name usermod -a -G multimedia $user_name
} }
ynh_legacy_permissions_exists () {
for permission in "skipped" "unprotected" "protected"
do
if ynh_permission_exists --permission="legacy_${permission}_uris"; then
return 0
fi
done
return 1
}
ynh_legacy_permissions_delete_all () {
for permission in "skipped" "unprotected" "protected"
do
if ynh_permission_exists --permission="legacy_${permission}_uris"; then
ynh_permission_delete --permission="legacy_${permission}_uris"
fi
done
}

View file

@ -68,12 +68,17 @@ if [ -z "$fpm_usage" ]; then
fi fi
# Delete unprotected_uris if it exists # Delete unprotected_uris if it exists
if [ ! -z $unprotected_uris ]; then if [ -n "$unprotected_uris" ]; then
ynh_app_setting_delete $app unprotected_uris ynh_app_setting_delete $app unprotected_uris
# Delete unprotected_uris implicitly remove visitors, add it again. # Delete unprotected_uris implicitly remove visitors, add it again.
ynh_permission_update --permission "main" --add "visitors" ynh_permission_update --permission "main" --add "visitors"
fi fi
# If phpversion doesn't exist, create it
if [ -z "$phpversion" ]; then
phpversion="$YNH_PHP_VERSION"
fi
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
@ -98,45 +103,17 @@ then
ynh_app_setting_delete $app backup_core_only ynh_app_setting_delete $app backup_core_only
ynh_clean_setup () { ynh_clean_setup () {
# Remove the post migration script before its execution ! # restore it if the upgrade fails
ynh_exec_warn_less ynh_secure_remove --file="/tmp/owncloud_post_migration.sh" ynh_restore_upgradebackup
# restore it if the upgrade fails
ynh_restore_upgradebackup
} }
fi fi
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors ynh_abort_if_errors
#=================================================
# HANDLE MIGRATION FROM OWNCLOUD
#=================================================
ynh_handle_app_migration "owncloud" "owncloud_migration"
if [ $migration_process -eq 1 ]
then
# If a migration has been performed
# Reload some values changed by the migration process
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
# Remove the old fake package for owncloud.
# Its name is specific, so the migration process can't remove it
ynh_package_autopurge owncloud-deps
# Change the database access in the config
ynh_replace_string "\('dbname' =>\).*" "\1 '$db_name'," "$final_path/config/config.php"
ynh_replace_string "\('dbuser' =>\).*" "\1 '$db_name'," "$final_path/config/config.php"
# Change the path of the data directory
ynh_replace_string "\('dbuser' =>\).*" "\1 '$db_name'," "$final_path/config/config.php"
ynh_replace_string "\('datadirectory' =>.*\)$old_app" "\1$app" "$final_path/config/config.php"
fi
if ynh_legacy_permissions_exists; then if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all ynh_legacy_permissions_delete_all
ynh_permission_create --permission="api" --label="api" --url="re:$(sed 's/[\.\-]/\%&/g' <<< $domain)/%.well%-known/.*" --allowed="visitors" "all_users" --auth_header="false" --show_tile="false" --protected="true" ynh_permission_create --permission="api" --label="api" --url="re:$(sed 's/[\.\-]/\%&/g' <<< $domain)/%.well%-known/.*" --allowed="visitors" "all_users" --auth_header="false" --show_tile="false" --protected="true"
fi fi
@ -259,6 +236,17 @@ then
# Print the current version number of Nextcloud # Print the current version number of Nextcloud
exec_occ -V exec_occ -V
# Upgrade may fail if this app is enabled
# Take all apps enabled, and check if mail is one of them
# Then temporary disable the mail app
mail_app_must_be_reactived=0
if exec_occ app:list | awk '/Enabled/{f=1;next} /Disabled/{f=0} f' | grep -q -w mail; then
exec_occ app:disable mail
mail_app_must_be_reactived=1
fi
# While the current version is not the last version, do an upgrade # While the current version is not the last version, do an upgrade
while [ "$last_version" != "$current_version" ] while [ "$last_version" != "$current_version" ]
do do
@ -360,6 +348,11 @@ then
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$nc_conf" ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$nc_conf"
# Reneable the mail app
if [ $mail_app_must_be_reactived -eq 1 ]; then
exec_occ app:enable mail
fi
# Ensure that UpdateNotification app is disabled # Ensure that UpdateNotification app is disabled
exec_occ app:disable updatenotification exec_occ app:disable updatenotification
@ -490,27 +483,6 @@ ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..."
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload
ynh_systemd_action --service_name="php${phpversion}-fpm" --action=reload ynh_systemd_action --service_name="php${phpversion}-fpm" --action=reload
#=================================================
# FINISH MIGRATION PROCESS
#=================================================
if [ $migration_process -eq 1 ]
then
ynh_print_info --message="ownCloud has been successfully migrated to Nextcloud! \
A last scheduled operation will run in a couple of minutes to finish the \
migration in YunoHost side. Do not proceed any application operation while \
you don't see Nextcloud as installed."
# Execute a post migration script after the end of this upgrade.
# Mainly for some cleaning
script_post_migration=owncloud_post_migration.sh
ynh_replace_string --match_string="__OLD_APP__" --replace_string="$old_app" --target_file=../conf/$script_post_migration
ynh_replace_string --match_string="__NEW_APP__" --replace_string="$app" --target_file=../conf/$script_post_migration
cp ../conf/$script_post_migration /tmp
chmod +x /tmp/$script_post_migration
(cd /tmp; echo "/tmp/$script_post_migration > /tmp/$script_post_migration.log 2>&1" | at now + 2 minutes)
fi
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================

View file

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