From 8cd01bdc8da0de38906e5a3380d12ee8bfa3ca27 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Mon, 28 May 2018 19:30:51 +0200 Subject: [PATCH 001/204] Fix failed access after first installation Don't create the user data folder (automatically created by Nextcloud), thus avoiding giving wrong ownership... --- hooks/post_user_create | 1 - scripts/install | 11 ++++------- scripts/upgrade | 11 ++++------- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/hooks/post_user_create b/hooks/post_user_create index 24ebf8c..f215f00 100644 --- a/hooks/post_user_create +++ b/hooks/post_user_create @@ -2,5 +2,4 @@ user=$1 -sudo mkdir -p /home/$user sudo setfacl -m g:#GROUP#:rwx /home/$user diff --git a/scripts/install b/scripts/install index 6900ed2..0b2aac1 100755 --- a/scripts/install +++ b/scripts/install @@ -183,6 +183,10 @@ exec_occ ldap:test-config \'\' \ if [ $user_home -eq 1 ]; then exec_occ app:enable files_external create_external_storage "/home/\$user" "Home" + # Iterate over users to extend their home folder permissions + for u in $(ynh_user_list); do + setfacl -m g:$app:rwx "/home/$u" || true + done fi #================================================= @@ -265,13 +269,6 @@ find ${datadir}/ -type d -print0 | xargs -0 chmod 0750 chmod 640 "${final_path}/config/config.php" chmod 755 /home/yunohost.app -# Iterate over users to extend their home folder permissions - for the external -# storage plugin usage - and create relevant Nextcloud directories -for u in $(ynh_user_list); do - mkdir -p "${datadir}/${u}" - setfacl -m g:$app:rwx "/home/$u" || true -done - #================================================= # SETUP LOGROTATE #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index faeaf86..e1901b8 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -271,6 +271,10 @@ if [ $user_home -eq 1 ]; then exec_occ files_external:list --output=json \ | grep -q '"storage":"\\\\OC\\\\Files\\\\Storage\\\\Local"' \ || create_external_storage "/home/\$user" "Home" + # Iterate over users to extend their home folder permissions + for u in $(ynh_user_list); do + setfacl -m g:$app:rwx "/home/$u" || true + done fi #================================================= @@ -329,13 +333,6 @@ find ${datadir}/ -type d -print0 | xargs -0 chmod 0750 chmod 640 "${final_path}/config/config.php" chmod 755 /home/yunohost.app -# Iterate over users to extend their home folder permissions - for the external -# storage plugin usage - and create relevant Nextcloud directories -for u in $(ynh_user_list); do - mkdir -p "${datadir}/${u}" - setfacl -m g:$app:rwx "/home/$u" || true -done - #================================================= # WARNING ABOUT THIRD-PARTY APPS #================================================= From 3ab4c18e8c0913371e6708e5814804a389e112e5 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Thu, 7 Jun 2018 20:44:00 +0200 Subject: [PATCH 002/204] Upgrade to upstream version 13.0.3 --- README.md | 2 +- manifest.json | 2 +- scripts/upgrade.d/upgrade.last.sh | 5 ++--- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 014b49c..84f7f7c 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Nextcloud for YunoHost own data. A personal cloud which run on your own server. With Nextcloud you can synchronize your files over your devices. -**Shipped version:** 13.0.2 +**Shipped version:** 13.0.3 [![Install Nextcloud with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=nextcloud) ![](https://github.com/nextcloud/screenshots/blob/master/files/filelist.png) diff --git a/manifest.json b/manifest.json index 2f8cd21..3abce85 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Access & share your files, calendars, contacts, mail & more from any device, on your terms", "fr": "Consultez et partagez vos fichiers, agendas, carnets d'adresses, emails et bien plus depuis les appareils de votre choix, sous vos conditions" }, - "version": "13.0.2~ynh1", + "version": "13.0.3~ynh1", "url": "https://nextcloud.com", "license": "AGPL-3.0", "maintainer": { diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index 04ffd38..0db575e 100755 --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -1,11 +1,10 @@ #!/bin/bash # Last available nextcloud version -next_version="13.0.2" +next_version="13.0.3" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="7396f98a1a53a9f4b144f55360d87c89cb6ee899feef1cfbf29a736219f9c47d" +nextcloud_source_sha256="183667540800dd045ea57801fedf8ca280de82b91582412aad07d42ed71e93e4" # Patch nextcloud files only for the last version cp -a ../sources/patches_last_version/* ../sources/patches - From 51de0db3626e2889f2f93fe8838eb78551e67f48 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Thu, 14 Jun 2018 18:20:53 +0200 Subject: [PATCH 003/204] Fix Nextcloud apps upgrade (fixes #123) avoid putting existing apps in an inappropriate sub-directory after Nextcloud update... --- scripts/upgrade | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index e1901b8..6c54ca5 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -202,7 +202,8 @@ do # Backup 3rd party applications from the current nextcloud # But do not overwrite if there is any upgrade - cp -a --update "$final_path/apps" "$tmpdir/apps" + # (apps directory already exists in Nextcloud archive) + cp -a --update "$final_path/apps" "$tmpdir" # Replace the old nextcloud by the new one ynh_secure_remove "$final_path" From 634d607dd4dd4963842845eba2951407e7c2c5fa Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Sun, 24 Jun 2018 19:16:41 +0200 Subject: [PATCH 004/204] Don't use /tmp anymore --- scripts/upgrade | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 6c54ca5..ab91500 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -189,7 +189,7 @@ do ynh_replace_string "__SHA256_SUM__" "$nextcloud_source_sha256" "../conf/app.src" # Create a temporary directory - tmpdir=$(mktemp -d) + tmpdir="${final_path}_temp_upgrade_dir" # Install the next nextcloud version in $tmpdir ynh_setup_source "$tmpdir" @@ -208,6 +208,7 @@ do # Replace the old nextcloud by the new one ynh_secure_remove "$final_path" mv "$tmpdir" "$final_path" + ynh_secure_remove "$tmpdir" # Set write access for the following commands chown -R $app: "$final_path" "$datadir" From dc2c104242a252d4509237e52bbf37168b617b23 Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Sun, 24 Jun 2018 19:19:04 +0200 Subject: [PATCH 005/204] Revert previous commit... --- scripts/upgrade | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index ab91500..6c54ca5 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -189,7 +189,7 @@ do ynh_replace_string "__SHA256_SUM__" "$nextcloud_source_sha256" "../conf/app.src" # Create a temporary directory - tmpdir="${final_path}_temp_upgrade_dir" + tmpdir=$(mktemp -d) # Install the next nextcloud version in $tmpdir ynh_setup_source "$tmpdir" @@ -208,7 +208,6 @@ do # Replace the old nextcloud by the new one ynh_secure_remove "$final_path" mv "$tmpdir" "$final_path" - ynh_secure_remove "$tmpdir" # Set write access for the following commands chown -R $app: "$final_path" "$datadir" From c046535b4eb0aa402601e090c44a7be07763e4a5 Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Sun, 24 Jun 2018 19:20:13 +0200 Subject: [PATCH 006/204] Don't use /tmp anymore --- scripts/upgrade | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 6c54ca5..ab91500 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -189,7 +189,7 @@ do ynh_replace_string "__SHA256_SUM__" "$nextcloud_source_sha256" "../conf/app.src" # Create a temporary directory - tmpdir=$(mktemp -d) + tmpdir="${final_path}_temp_upgrade_dir" # Install the next nextcloud version in $tmpdir ynh_setup_source "$tmpdir" @@ -208,6 +208,7 @@ do # Replace the old nextcloud by the new one ynh_secure_remove "$final_path" mv "$tmpdir" "$final_path" + ynh_secure_remove "$tmpdir" # Set write access for the following commands chown -R $app: "$final_path" "$datadir" From d9feba3dab44c35112deb3a7a64a6bc5b6b9c442 Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Sat, 30 Jun 2018 00:39:58 +0200 Subject: [PATCH 007/204] Fix upgrade from for stretch --- check_process | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/check_process b/check_process index df67e3a..6513463 100644 --- a/check_process +++ b/check_process @@ -12,7 +12,7 @@ setup_private=0 setup_public=0 upgrade=1 - upgrade=1 from_commit=68c2f41da6b33bd8c949e5ba624bedba08c448be + upgrade=1 from_commit=1cdb9ea1619c6acaaa90bae88b5c4bed5084a2a7 backup_restore=1 multi_instance=0 incorrect_path=1 @@ -35,6 +35,6 @@ Email= Notification=none ;;; Upgrade options - ; commit=68c2f41da6b33bd8c949e5ba624bedba08c448be - name=Move patches to the right folder + ; commit=1cdb9ea1619c6acaaa90bae88b5c4bed5084a2a7 + name= Fix Debian Stretch dependencies by installing php-apcu, php-mbstring … manifest_arg=domain=DOMAIN&path=PATH&admin=USER&user_home=1& From c42091254e86fa15d056a206688425707b905e6a Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Sun, 8 Jul 2018 19:58:38 +0200 Subject: [PATCH 008/204] Enable multi-instance capability (closes #42) --- README.md | 1 + check_process | 2 +- manifest.json | 2 +- scripts/install | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 84f7f7c..612863d 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ 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 diff --git a/check_process b/check_process index df67e3a..101cce1 100644 --- a/check_process +++ b/check_process @@ -14,7 +14,7 @@ upgrade=1 upgrade=1 from_commit=68c2f41da6b33bd8c949e5ba624bedba08c448be backup_restore=1 - multi_instance=0 + multi_instance=1 incorrect_path=1 port_already_use=0 change_url=0 diff --git a/manifest.json b/manifest.json index 3abce85..8c4a36f 100644 --- a/manifest.json +++ b/manifest.json @@ -16,7 +16,7 @@ "requirements": { "yunohost": ">= 2.7.2" }, - "multi_instance": false, + "multi_instance": true, "services": [ "nginx", "php5-fpm", diff --git a/scripts/install b/scripts/install index 0b2aac1..f46d396 100755 --- a/scripts/install +++ b/scripts/install @@ -274,7 +274,7 @@ chmod 755 /home/yunohost.app #================================================= # Use logrotate to manage application logfile -ynh_use_logrotate "/home/yunohost.app/nextcloud/data/nextcloud.log" +ynh_use_logrotate "${datadir}/nextcloud.log" #================================================= # SETUP SSOWAT From 0c52ede48585d6f24895e7e0bf66cb402f6f684a Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Mon, 23 Jul 2018 21:57:27 +0200 Subject: [PATCH 009/204] Upgrade to upstream version 13.0.5 --- README.md | 2 +- manifest.json | 2 +- scripts/upgrade.d/upgrade.last.sh | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 84f7f7c..2b4eed5 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Nextcloud for YunoHost own data. A personal cloud which run on your own server. With Nextcloud you can synchronize your files over your devices. -**Shipped version:** 13.0.3 +**Shipped version:** 13.0.5 [![Install Nextcloud with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=nextcloud) ![](https://github.com/nextcloud/screenshots/blob/master/files/filelist.png) diff --git a/manifest.json b/manifest.json index 3abce85..f4f4627 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Access & share your files, calendars, contacts, mail & more from any device, on your terms", "fr": "Consultez et partagez vos fichiers, agendas, carnets d'adresses, emails et bien plus depuis les appareils de votre choix, sous vos conditions" }, - "version": "13.0.3~ynh1", + "version": "13.0.5~ynh1", "url": "https://nextcloud.com", "license": "AGPL-3.0", "maintainer": { diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index 0db575e..cbd2d8e 100755 --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -1,10 +1,10 @@ #!/bin/bash # Last available nextcloud version -next_version="13.0.3" +next_version="13.0.5" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="183667540800dd045ea57801fedf8ca280de82b91582412aad07d42ed71e93e4" +nextcloud_source_sha256="a110d32849259ab79813af3078123a09057fc659ee414e5f3ed75451ec9e80ea" # Patch nextcloud files only for the last version cp -a ../sources/patches_last_version/* ../sources/patches From 30c19929cbcad3443c67d410e816b30026f659a2 Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Wed, 29 Aug 2018 21:07:53 +0200 Subject: [PATCH 010/204] Add a new helper to create temporary directory --- scripts/_common.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/scripts/_common.sh b/scripts/_common.sh index 7ce131e..77b2812 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -356,3 +356,27 @@ ynh_multimedia_addaccess () { groupadd -f multimedia usermod -a -G multimedia $user_name } + +ynh_smart_mktemp () { + local min_size="${1:-300}" + # Transform the minimum size from megabytes to kilobytes + min_size=$(( $min_size * 1024 )) + + # Check if there's enough free space in a directory + is_there_enough_space () { + local free_space=$(df --output=avail "$1" | sed 1d) + test $free_space -ge $min_size + } + + if is_there_enough_space /tmp; then + local tmpdir=/tmp + elif is_there_enough_space /var; then + local tmpdir=/var + elif is_there_enough_space /; then + local tmpdir=/ + elif is_there_enough_space /home; then + local tmpdir=/home + fi + + echo "$(sudo mktemp --directory --tmpdir="$tmpdir")" +} From 87d92b35a02e5c929c4b57d59e6d61da22da7222 Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Wed, 29 Aug 2018 21:10:08 +0200 Subject: [PATCH 011/204] Use ynh_smart_mktemp --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index ab91500..44327db 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -189,7 +189,7 @@ do ynh_replace_string "__SHA256_SUM__" "$nextcloud_source_sha256" "../conf/app.src" # Create a temporary directory - tmpdir="${final_path}_temp_upgrade_dir" + tmpdir="$(ynh_smart_mktemp 300)" # Install the next nextcloud version in $tmpdir ynh_setup_source "$tmpdir" From 2bac5ce10d66a87f34d68c52b3c0a39a0e2c1ea3 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Fri, 31 Aug 2018 19:22:46 +0200 Subject: [PATCH 012/204] Upgrade to upstream version 13.0.6 --- README.md | 2 +- manifest.json | 2 +- scripts/upgrade.d/upgrade.last.sh | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e64886d..bf20566 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Nextcloud for YunoHost own data. A personal cloud which run on your own server. With Nextcloud you can synchronize your files over your devices. -**Shipped version:** 13.0.5 +**Shipped version:** 13.0.6 [![Install Nextcloud with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=nextcloud) ![](https://github.com/nextcloud/screenshots/blob/master/files/filelist.png) diff --git a/manifest.json b/manifest.json index 97038f7..1c09dac 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Access & share your files, calendars, contacts, mail & more from any device, on your terms", "fr": "Consultez et partagez vos fichiers, agendas, carnets d'adresses, emails et bien plus depuis les appareils de votre choix, sous vos conditions" }, - "version": "13.0.5~ynh1", + "version": "13.0.6~ynh1", "url": "https://nextcloud.com", "license": "AGPL-3.0", "maintainer": { diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index cbd2d8e..4bcad4e 100755 --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -1,10 +1,10 @@ #!/bin/bash # Last available nextcloud version -next_version="13.0.5" +next_version="13.0.6" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="a110d32849259ab79813af3078123a09057fc659ee414e5f3ed75451ec9e80ea" +nextcloud_source_sha256="90fc9e960b6a477bb14ee87042b3d158bde95c3f0157677cb4547ca7649968d4" # Patch nextcloud files only for the last version cp -a ../sources/patches_last_version/* ../sources/patches From d76dc401512c378649918b4a7c6d0c372d3c7e5a Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Fri, 21 Sep 2018 23:32:02 +0200 Subject: [PATCH 013/204] ynh_die if no free space --- scripts/_common.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/_common.sh b/scripts/_common.sh index 77b2812..1e2bd82 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -376,6 +376,8 @@ ynh_smart_mktemp () { local tmpdir=/ elif is_there_enough_space /home; then local tmpdir=/home + else + ynh_die "Insufficient free space to continue..." fi echo "$(sudo mktemp --directory --tmpdir="$tmpdir")" From 33ec8e215ea229c246cb1a7e1d797eae06368d87 Mon Sep 17 00:00:00 2001 From: Julien Malik Date: Mon, 1 Oct 2018 23:44:59 +0200 Subject: [PATCH 014/204] [enh] move specific php.ini defines to the pool configuration --- conf/php-fpm.conf | 8 ++++++++ conf/php-fpm.ini | 7 ------- 2 files changed, 8 insertions(+), 7 deletions(-) delete mode 100644 conf/php-fpm.ini diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf index 485c87b..2571613 100644 --- a/conf/php-fpm.conf +++ b/conf/php-fpm.conf @@ -397,3 +397,11 @@ php_value[upload_max_filesize] = 10G php_value[post_max_size] = 10G php_value[default_charset] = UTF-8 php_value[always_populate_raw_post_data] = -1 +php_value[opcache.enable]=1 +php_value[opcache.enable_cli]=1 +php_value[opcache.interned_strings_buffer]=8 +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 + diff --git a/conf/php-fpm.ini b/conf/php-fpm.ini deleted file mode 100644 index 104f242..0000000 --- a/conf/php-fpm.ini +++ /dev/null @@ -1,7 +0,0 @@ -opcache.enable=1 -opcache.enable_cli=1 -opcache.interned_strings_buffer=8 -opcache.max_accelerated_files=10000 -opcache.memory_consumption=128 -opcache.save_comments=1 -opcache.revalidate_freq=1 From c435b4bb0d22ac14a7a2e24bfda20f4415136f91 Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Tue, 2 Oct 2018 00:24:36 +0200 Subject: [PATCH 015/204] Remove 20-$app.ini from the backup file --- scripts/backup | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/backup b/scripts/backup index aecf0c0..0a1f69c 100755 --- a/scripts/backup +++ b/scripts/backup @@ -52,7 +52,6 @@ ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= ynh_backup "/etc/php5/fpm/pool.d/$app.conf" -ynh_backup "/etc/php5/fpm/conf.d/20-$app.ini" #================================================= # BACKUP THE MYSQL DATABASE From 795adc09152a8f6f4a1afe5510ead6e5a0812cca Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Tue, 2 Oct 2018 00:25:05 +0200 Subject: [PATCH 016/204] Remove 20-$app.ini from the restore file --- scripts/restore | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/restore b/scripts/restore index 44a7f58..7f601db 100755 --- a/scripts/restore +++ b/scripts/restore @@ -77,7 +77,6 @@ ynh_system_user_create $app #================================================= ynh_restore_file "/etc/php5/fpm/pool.d/$app.conf" -ynh_restore_file "/etc/php5/fpm/conf.d/20-$app.ini" #================================================= # SPECIFIC RESTORATION From 51dc246f2a10856cad2f325a4c72da95b031d5e2 Mon Sep 17 00:00:00 2001 From: frju365 Date: Mon, 8 Oct 2018 19:17:16 +0200 Subject: [PATCH 017/204] Revert "[enh] move specific php.ini defines to the pool configuration" --- conf/php-fpm.conf | 8 -------- conf/php-fpm.ini | 7 +++++++ scripts/backup | 1 + scripts/restore | 1 + 4 files changed, 9 insertions(+), 8 deletions(-) create mode 100644 conf/php-fpm.ini diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf index 2571613..485c87b 100644 --- a/conf/php-fpm.conf +++ b/conf/php-fpm.conf @@ -397,11 +397,3 @@ php_value[upload_max_filesize] = 10G php_value[post_max_size] = 10G php_value[default_charset] = UTF-8 php_value[always_populate_raw_post_data] = -1 -php_value[opcache.enable]=1 -php_value[opcache.enable_cli]=1 -php_value[opcache.interned_strings_buffer]=8 -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 - diff --git a/conf/php-fpm.ini b/conf/php-fpm.ini new file mode 100644 index 0000000..104f242 --- /dev/null +++ b/conf/php-fpm.ini @@ -0,0 +1,7 @@ +opcache.enable=1 +opcache.enable_cli=1 +opcache.interned_strings_buffer=8 +opcache.max_accelerated_files=10000 +opcache.memory_consumption=128 +opcache.save_comments=1 +opcache.revalidate_freq=1 diff --git a/scripts/backup b/scripts/backup index 0a1f69c..aecf0c0 100755 --- a/scripts/backup +++ b/scripts/backup @@ -52,6 +52,7 @@ ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= ynh_backup "/etc/php5/fpm/pool.d/$app.conf" +ynh_backup "/etc/php5/fpm/conf.d/20-$app.ini" #================================================= # BACKUP THE MYSQL DATABASE diff --git a/scripts/restore b/scripts/restore index 7f601db..44a7f58 100755 --- a/scripts/restore +++ b/scripts/restore @@ -77,6 +77,7 @@ ynh_system_user_create $app #================================================= ynh_restore_file "/etc/php5/fpm/pool.d/$app.conf" +ynh_restore_file "/etc/php5/fpm/conf.d/20-$app.ini" #================================================= # SPECIFIC RESTORATION From e60cb644060479245e7a8ddfdf4f5087508784c0 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Thu, 8 Nov 2018 13:44:50 +0100 Subject: [PATCH 018/204] Set maintainer as "YunoHost Contributors" --- manifest.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index 1c09dac..75a532b 100644 --- a/manifest.json +++ b/manifest.json @@ -10,8 +10,8 @@ "url": "https://nextcloud.com", "license": "AGPL-3.0", "maintainer": { - "name": "-", - "email": "-" + "name": "YunoHost Contributors", + "email": "apps@yunohost.org" }, "requirements": { "yunohost": ">= 2.7.2" From 118b1d4d30aced948c751d9853015bebf52f2c43 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Sun, 25 Nov 2018 22:08:10 +0100 Subject: [PATCH 019/204] Major upgrade to upstream version 14.0.4 --- README.md | 2 +- manifest.json | 2 +- scripts/upgrade.d/upgrade.13.sh | 7 +++++++ scripts/upgrade.d/upgrade.last.sh | 4 ++-- 4 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 scripts/upgrade.d/upgrade.13.sh diff --git a/README.md b/README.md index bf20566..97d1435 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Nextcloud for YunoHost own data. A personal cloud which run on your own server. With Nextcloud you can synchronize your files over your devices. -**Shipped version:** 13.0.6 +**Shipped version:** 14.0.4 [![Install Nextcloud with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=nextcloud) ![](https://github.com/nextcloud/screenshots/blob/master/files/filelist.png) diff --git a/manifest.json b/manifest.json index 75a532b..d5924da 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Access & share your files, calendars, contacts, mail & more from any device, on your terms", "fr": "Consultez et partagez vos fichiers, agendas, carnets d'adresses, emails et bien plus depuis les appareils de votre choix, sous vos conditions" }, - "version": "13.0.6~ynh1", + "version": "14.0.4~ynh1", "url": "https://nextcloud.com", "license": "AGPL-3.0", "maintainer": { diff --git a/scripts/upgrade.d/upgrade.13.sh b/scripts/upgrade.d/upgrade.13.sh new file mode 100644 index 0000000..f979aa9 --- /dev/null +++ b/scripts/upgrade.d/upgrade.13.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +# Last available nextcloud version +next_version="14.0.0" + +# Nextcloud tarball checksum sha256 +nextcloud_source_sha256="f965c14286e7aabbfe49c947d86af59597af302c35d10e0b5440e7e6c53b8f47" diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index 4bcad4e..55c0f06 100755 --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -1,10 +1,10 @@ #!/bin/bash # Last available nextcloud version -next_version="13.0.6" +next_version="14.0.4" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="90fc9e960b6a477bb14ee87042b3d158bde95c3f0157677cb4547ca7649968d4" +nextcloud_source_sha256="4f5dd15a71694bd2f15fba0d2f942e5a5b1f5aba13511c507a23324d746b40e8" # Patch nextcloud files only for the last version cp -a ../sources/patches_last_version/* ../sources/patches From de3979a065e8952a3c91f3dbbc65f0253ad5e07e Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Sun, 25 Nov 2018 22:09:09 +0100 Subject: [PATCH 020/204] Adapt PHP custom patches to 14.0.4 code --- .../app-00-add-logout_url-conf.patch | 56 ++++++++++++++-- ...able-CSPv3-nonce_and_allow-YNH-fonts.patch | 66 +++++++++---------- 2 files changed, 85 insertions(+), 37 deletions(-) diff --git a/sources/patches_last_version/app-00-add-logout_url-conf.patch b/sources/patches_last_version/app-00-add-logout_url-conf.patch index 3659fb1..2e70ba7 100644 --- a/sources/patches_last_version/app-00-add-logout_url-conf.patch +++ b/sources/patches_last_version/app-00-add-logout_url-conf.patch @@ -1,14 +1,62 @@ + core/Controller/LoginController.php | 25 ++++++++++++++----------- + 1 file changed, 14 insertions(+), 11 deletions(-) + +diff --git a/core/Controller/LoginController.php b/core/Controller/LoginController.php +index 182d2bc106..82523e306e 100644 --- a/core/Controller/LoginController.php +++ b/core/Controller/LoginController.php -@@ -119,7 +119,10 @@ +@@ -95,13 +95,13 @@ class LoginController extends Controller { + * @param Throttler $throttler + */ + public function __construct($appName, +- IRequest $request, +- IUserManager $userManager, +- IConfig $config, +- ISession $session, +- IUserSession $userSession, +- IURLGenerator $urlGenerator, +- ILogger $logger, ++ IRequest $request, ++ IUserManager $userManager, ++ IConfig $config, ++ ISession $session, ++ IUserSession $userSession, ++ IURLGenerator $urlGenerator, ++ ILogger $logger, + Manager $twoFactorManager, + Defaults $defaults, + Throttler $throttler) { +@@ -130,7 +130,10 @@ class LoginController extends Controller { } $this->userSession->logout(); - + - $response = new RedirectResponse($this->urlGenerator->linkToRouteAbsolute('core.login.showLoginForm')); + $redirectUrl = $this->config->getSystemValue('logout_url', -+ $this->urlGenerator->linkToRouteAbsolute('core.login.showLoginForm') ++ $this->urlGenerator->linkToRouteAbsolute('core.login.showLoginForm') + ); + $response = new RedirectResponse($redirectUrl); - $response->addHeader('Clear-Site-Data', '"cache", "cookies", "storage", "executionContexts"'); + $response->addHeader('Clear-Site-Data', '"cache", "storage", "executionContexts"'); return $response; } +@@ -303,10 +306,10 @@ class LoginController extends Controller { + $previousUser = $user; + $user = $users[0]->getUID(); + if($user !== $previousUser) { +- $loginResult = $this->userManager->checkPassword($user, $password); +- } ++ $loginResult = $this->userManager->checkPassword($user, $password); + } + } ++ } + + if ($loginResult === false) { + $this->logger->warning('Login failed: \''. $user . +@@ -314,7 +317,7 @@ class LoginController extends Controller { + ['app' => 'core']); + return $this->createLoginFailedResponse($user, $originalUser, + $redirect_url, self::LOGIN_MSG_INVALIDPASSWORD); +- } ++ } + + // TODO: remove password checks from above and let the user session handle failures + // requires https://github.com/owncloud/core/pull/24616 diff --git a/sources/patches_last_version/app-01-disable-CSPv3-nonce_and_allow-YNH-fonts.patch b/sources/patches_last_version/app-01-disable-CSPv3-nonce_and_allow-YNH-fonts.patch index f5ced3a..42d6d99 100644 --- a/sources/patches_last_version/app-01-disable-CSPv3-nonce_and_allow-YNH-fonts.patch +++ b/sources/patches_last_version/app-01-disable-CSPv3-nonce_and_allow-YNH-fonts.patch @@ -1,33 +1,33 @@ - lib/private/Security/CSP/ContentSecurityPolicyNonceManager.php | 4 ++++ - lib/public/AppFramework/Http/EmptyContentSecurityPolicy.php | 3 ++- - 2 files changed, 6 insertions(+), 1 deletion(-) - -diff --git a/lib/private/Security/CSP/ContentSecurityPolicyNonceManager.php b/lib/private/Security/CSP/ContentSecurityPolicyNonceManager.php -index 85ae127f5f..91618a09fc 100644 ---- a/lib/private/Security/CSP/ContentSecurityPolicyNonceManager.php -+++ b/lib/private/Security/CSP/ContentSecurityPolicyNonceManager.php -@@ -65,6 +65,10 @@ class ContentSecurityPolicyNonceManager { - * @return bool - */ - public function browserSupportsCspV3() { -+ // YunoHost patch: disable CSPv3 nonces to: -+ // - avoid white page on first login from YunoHost portal -+ // - allow YunoHost tile display -+ return false; - $browserWhitelist = [ - Request::USER_AGENT_CHROME, - // Firefox 45+ -diff --git a/lib/public/AppFramework/Http/EmptyContentSecurityPolicy.php b/lib/public/AppFramework/Http/EmptyContentSecurityPolicy.php -index 64d4eb6e5d..59d5885620 100644 ---- a/lib/public/AppFramework/Http/EmptyContentSecurityPolicy.php -+++ b/lib/public/AppFramework/Http/EmptyContentSecurityPolicy.php -@@ -377,7 +377,8 @@ class EmptyContentSecurityPolicy { - - if(!empty($this->allowedFontDomains)) { - $policy .= 'font-src ' . implode(' ', $this->allowedFontDomains); -- $policy .= ';'; -+ // YunoHost patch: extend font-src to load data fonts embedded in YunoHost tile script -+ $policy .= ' data:;'; - } - - if(!empty($this->allowedConnectDomains)) { + lib/private/Security/CSP/ContentSecurityPolicyNonceManager.php | 4 ++++ + lib/public/AppFramework/Http/EmptyContentSecurityPolicy.php | 3 ++- + 2 files changed, 6 insertions(+), 1 deletion(-) + +diff --git a/lib/private/Security/CSP/ContentSecurityPolicyNonceManager.php b/lib/private/Security/CSP/ContentSecurityPolicyNonceManager.php +index 088fb2d859..15b05b75d1 100644 +--- a/lib/private/Security/CSP/ContentSecurityPolicyNonceManager.php ++++ b/lib/private/Security/CSP/ContentSecurityPolicyNonceManager.php +@@ -70,6 +70,10 @@ class ContentSecurityPolicyNonceManager { + * @return bool + */ + public function browserSupportsCspV3(): bool { ++ // YunoHost patch: disable CSPv3 nonces to: ++ // - avoid white page on first login from YunoHost portal ++ // - allow YunoHost tile display ++ return false; + $browserWhitelist = [ + Request::USER_AGENT_CHROME, + // Firefox 45+ +diff --git a/lib/public/AppFramework/Http/EmptyContentSecurityPolicy.php b/lib/public/AppFramework/Http/EmptyContentSecurityPolicy.php +index 6397d32cb9..32281a1734 100644 +--- a/lib/public/AppFramework/Http/EmptyContentSecurityPolicy.php ++++ b/lib/public/AppFramework/Http/EmptyContentSecurityPolicy.php +@@ -406,7 +406,8 @@ class EmptyContentSecurityPolicy { + + if(!empty($this->allowedFontDomains)) { + $policy .= 'font-src ' . implode(' ', $this->allowedFontDomains); +- $policy .= ';'; ++ // YunoHost patch: extend font-src to load data fonts embedded in YunoHost tile script ++ $policy .= ' data:;'; + } + + if(!empty($this->allowedConnectDomains)) { From 2848fe3719a217585ed2dbcc8df19c9d97d461ac Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Sun, 25 Nov 2018 22:10:06 +0100 Subject: [PATCH 021/204] Upgrade nginx configuration following release 14 recommendations (https://docs.nextcloud.com/server/14/admin_manual/installation/nginx.html) --- conf/nginx.conf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/conf/nginx.conf b/conf/nginx.conf index 3eee860..1691095 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -19,6 +19,7 @@ location ^~ __PATH__ { add_header X-Robots-Tag none; add_header X-Download-Options noopen; add_header X-Permitted-Cross-Domain-Policies none; + add_header Referrer-Policy no-referrer; # Set max upload size client_max_body_size 10G; @@ -85,6 +86,8 @@ location ^~ __PATH__ { add_header X-Robots-Tag none; add_header X-Download-Options noopen; add_header X-Permitted-Cross-Domain-Policies none; + add_header Referrer-Policy no-referrer; + # Optional: Don't log access to assets access_log off; } From 53c4fb686b427fd72fa5686e80efd786b49ac1c4 Mon Sep 17 00:00:00 2001 From: Nathanael Date: Sat, 15 Dec 2018 12:04:09 +0100 Subject: [PATCH 022/204] Upgrade to upstream version 15.0.0 Upgrade to upstream version 15.0.0 --- README.md | 2 +- scripts/upgrade.d/upgrade.14.sh | 10 ++++++++++ scripts/upgrade.d/upgrade.last.sh | 4 ++-- 3 files changed, 13 insertions(+), 3 deletions(-) create mode 100755 scripts/upgrade.d/upgrade.14.sh diff --git a/README.md b/README.md index 97d1435..8bc16ea 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Nextcloud for YunoHost own data. A personal cloud which run on your own server. With Nextcloud you can synchronize your files over your devices. -**Shipped version:** 14.0.4 +**Shipped version:** 15.0.0 [![Install Nextcloud with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=nextcloud) ![](https://github.com/nextcloud/screenshots/blob/master/files/filelist.png) diff --git a/scripts/upgrade.d/upgrade.14.sh b/scripts/upgrade.d/upgrade.14.sh new file mode 100755 index 0000000..55c0f06 --- /dev/null +++ b/scripts/upgrade.d/upgrade.14.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# Last available nextcloud version +next_version="14.0.4" + +# Nextcloud tarball checksum sha256 +nextcloud_source_sha256="4f5dd15a71694bd2f15fba0d2f942e5a5b1f5aba13511c507a23324d746b40e8" + +# Patch nextcloud files only for the last version +cp -a ../sources/patches_last_version/* ../sources/patches diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index 55c0f06..62e17eb 100755 --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -1,10 +1,10 @@ #!/bin/bash # Last available nextcloud version -next_version="14.0.4" +next_version="15.0.0" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="4f5dd15a71694bd2f15fba0d2f942e5a5b1f5aba13511c507a23324d746b40e8" +nextcloud_source_sha256="5bb0c58171353da844019b64080c21078002a59ab956ab72adb958844a98eb78" # Patch nextcloud files only for the last version cp -a ../sources/patches_last_version/* ../sources/patches From a5d7aac75d181883abd49ca51961c698cbc05e65 Mon Sep 17 00:00:00 2001 From: Nathanael Date: Sat, 15 Dec 2018 18:16:30 +0100 Subject: [PATCH 023/204] Upgrade to upstream version 15.0.0 (fix) Upgrade to upstream version 15.0.0 (fix) --- scripts/upgrade.d/upgrade.14.sh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/scripts/upgrade.d/upgrade.14.sh b/scripts/upgrade.d/upgrade.14.sh index 55c0f06..8c5e80c 100755 --- a/scripts/upgrade.d/upgrade.14.sh +++ b/scripts/upgrade.d/upgrade.14.sh @@ -1,10 +1,7 @@ #!/bin/bash # Last available nextcloud version -next_version="14.0.4" +next_version="15.0.0" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="4f5dd15a71694bd2f15fba0d2f942e5a5b1f5aba13511c507a23324d746b40e8" - -# Patch nextcloud files only for the last version -cp -a ../sources/patches_last_version/* ../sources/patches +nextcloud_source_sha256="5bb0c58171353da844019b64080c21078002a59ab956ab72adb958844a98eb78" \ No newline at end of file From 698218cacd4b4e77e55207d7bf60bf8a2389b981 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Sun, 16 Dec 2018 18:02:59 +0100 Subject: [PATCH 024/204] Plan required maintenance operations after upgrade --- scripts/_common.sh | 2 +- scripts/upgrade.d/upgrade.last.sh | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 7ce131e..566494d 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -3,7 +3,7 @@ # COMMON VARIABLES #================================================= -pkg_dependencies="php5-gd php5-json php5-intl php5-mcrypt php5-curl php5-apcu php5-redis php5-ldap php5-imagick imagemagick acl tar smbclient" +pkg_dependencies="php5-gd php5-json php5-intl php5-mcrypt php5-curl php5-apcu php5-redis php5-ldap php5-imagick imagemagick acl tar smbclient at" if [ "$(lsb_release --codename --short)" != "jessie" ]; then pkg_dependencies="$pkg_dependencies php-zip php-apcu php-mbstring php-xml" diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index 55c0f06..0a21846 100755 --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -8,3 +8,6 @@ nextcloud_source_sha256="4f5dd15a71694bd2f15fba0d2f942e5a5b1f5aba13511c507a23324 # Patch nextcloud files only for the last version cp -a ../sources/patches_last_version/* ../sources/patches + +# Execute post-upgrade operations later on +(cd /tmp ; at now + 10 minutes <<< "(cd $final_path ; sudo -u nextcloud php occ db:add-missing-indices ; sudo -u nextcloud php occ db:convert-filecache-bigint -n) > /tmp/nextcloud_maintenance.log") From f1f95274a283206f1cb9bfcc5c11ddbc3273c34c Mon Sep 17 00:00:00 2001 From: Nathanael Date: Sun, 16 Dec 2018 20:49:31 +0100 Subject: [PATCH 025/204] Version 15 : add occ commands to improve db performances --- scripts/upgrade | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index 6c54ca5..355cff6 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -223,6 +223,8 @@ do # Print the current version number of nextcloud exec_occ -V + exec_occ db:add-missing-indices + exec_occ db:convert-filecache-bigint done #================================================= From 134a44cc3fee83bdce40caab2518c89bd30fd0cc Mon Sep 17 00:00:00 2001 From: Nathanael Date: Sun, 16 Dec 2018 21:29:45 +0100 Subject: [PATCH 026/204] Revert "Version 15 : add occ commands to improve db performances" Because of https://github.com/YunoHost-Apps/nextcloud_ynh/pull/149 This reverts commit f1f95274a283206f1cb9bfcc5c11ddbc3273c34c. --- scripts/upgrade | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 355cff6..6c54ca5 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -223,8 +223,6 @@ do # Print the current version number of nextcloud exec_occ -V - exec_occ db:add-missing-indices - exec_occ db:convert-filecache-bigint done #================================================= From 33c3ecb3dcfd61340a6aed15f1569288e189c58f Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Fri, 21 Dec 2018 00:09:01 +0100 Subject: [PATCH 027/204] Adapt CSPv3 disabling patch and add a patch to allow eval in JS scripts for YunoHost tile --- ...isable-CSPv3-nonce_and_allow-YNH-fonts.patch | 14 +++++++------- ...r-eval-in-JS-scripts-for-YunoHost-tile.patch | 17 +++++++++++++++++ 2 files changed, 24 insertions(+), 7 deletions(-) create mode 100644 sources/patches_last_version/app-02-Allow-for-eval-in-JS-scripts-for-YunoHost-tile.patch diff --git a/sources/patches_last_version/app-01-disable-CSPv3-nonce_and_allow-YNH-fonts.patch b/sources/patches_last_version/app-01-disable-CSPv3-nonce_and_allow-YNH-fonts.patch index 42d6d99..d5a609a 100644 --- a/sources/patches_last_version/app-01-disable-CSPv3-nonce_and_allow-YNH-fonts.patch +++ b/sources/patches_last_version/app-01-disable-CSPv3-nonce_and_allow-YNH-fonts.patch @@ -1,9 +1,9 @@ - lib/private/Security/CSP/ContentSecurityPolicyNonceManager.php | 4 ++++ - lib/public/AppFramework/Http/EmptyContentSecurityPolicy.php | 3 ++- + .../Security/CSP/ContentSecurityPolicyNonceManager.php | 4 ++++ + lib/public/AppFramework/Http/EmptyContentSecurityPolicy.php | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/private/Security/CSP/ContentSecurityPolicyNonceManager.php b/lib/private/Security/CSP/ContentSecurityPolicyNonceManager.php -index 088fb2d859..15b05b75d1 100644 +index 795d8cc864..5f3c961445 100644 --- a/lib/private/Security/CSP/ContentSecurityPolicyNonceManager.php +++ b/lib/private/Security/CSP/ContentSecurityPolicyNonceManager.php @@ -70,6 +70,10 @@ class ContentSecurityPolicyNonceManager { @@ -18,16 +18,16 @@ index 088fb2d859..15b05b75d1 100644 Request::USER_AGENT_CHROME, // Firefox 45+ diff --git a/lib/public/AppFramework/Http/EmptyContentSecurityPolicy.php b/lib/public/AppFramework/Http/EmptyContentSecurityPolicy.php -index 6397d32cb9..32281a1734 100644 +index 3fcef1d0ef..7ce01a68fc 100644 --- a/lib/public/AppFramework/Http/EmptyContentSecurityPolicy.php +++ b/lib/public/AppFramework/Http/EmptyContentSecurityPolicy.php -@@ -406,7 +406,8 @@ class EmptyContentSecurityPolicy { - +@@ -449,7 +449,8 @@ class EmptyContentSecurityPolicy { + if(!empty($this->allowedFontDomains)) { $policy .= 'font-src ' . implode(' ', $this->allowedFontDomains); - $policy .= ';'; + // YunoHost patch: extend font-src to load data fonts embedded in YunoHost tile script + $policy .= ' data:;'; } - + if(!empty($this->allowedConnectDomains)) { diff --git a/sources/patches_last_version/app-02-Allow-for-eval-in-JS-scripts-for-YunoHost-tile.patch b/sources/patches_last_version/app-02-Allow-for-eval-in-JS-scripts-for-YunoHost-tile.patch new file mode 100644 index 0000000..38f37f9 --- /dev/null +++ b/sources/patches_last_version/app-02-Allow-for-eval-in-JS-scripts-for-YunoHost-tile.patch @@ -0,0 +1,17 @@ + lib/public/AppFramework/Http/ContentSecurityPolicy.php | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/lib/public/AppFramework/Http/ContentSecurityPolicy.php b/lib/public/AppFramework/Http/ContentSecurityPolicy.php +index e9ecf00036..8e69c8d2dc 100644 +--- a/lib/public/AppFramework/Http/ContentSecurityPolicy.php ++++ b/lib/public/AppFramework/Http/ContentSecurityPolicy.php +@@ -44,7 +44,8 @@ class ContentSecurityPolicy extends EmptyContentSecurityPolicy { + /** @var bool Whether inline JS snippets are allowed */ + protected $inlineScriptAllowed = false; + /** @var bool Whether eval in JS scripts is allowed */ +- protected $evalScriptAllowed = false; ++ // YunoHost patch: allow for eval in JS scripts for YunoHost tile ++ protected $evalScriptAllowed = true; + /** @var array Domains from which scripts can get loaded */ + protected $allowedScriptDomains = [ + '\'self\'', From c3d725c45bc14c110419924d5a8c544c15527b7e Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Fri, 21 Dec 2018 19:40:20 +0100 Subject: [PATCH 028/204] Fix README screenshot URL (fixes #153) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8bc16ea..278dc05 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ you can synchronize your files over your devices. **Shipped version:** 15.0.0 [![Install Nextcloud with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=nextcloud) -![](https://github.com/nextcloud/screenshots/blob/master/files/filelist.png) +![](https://raw.githubusercontent.com/nextcloud/screenshots/master/files/Files%20Overview.png) ## Features From d62e8c411c25d114235c29ed6ae67452364f1d76 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Sat, 22 Dec 2018 09:26:05 +0100 Subject: [PATCH 029/204] Limit upgrade operations (patches, maintenance, etc.) to the last upgrade --- scripts/upgrade | 2 ++ scripts/upgrade.d/upgrade.last.sh | 11 +++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 6c54ca5..d0c6329 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -176,6 +176,8 @@ do # then it's the last upgrade to do if [ "$major_version" -eq "$current_major_version" ]; then current_major_version=last + # Execute the commands dedicated to the last upgrade + last_upgrade_operations fi # Load the value for this version diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index 2bed20b..e061d31 100755 --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -6,8 +6,11 @@ next_version="15.0.0" # Nextcloud tarball checksum sha256 nextcloud_source_sha256="5bb0c58171353da844019b64080c21078002a59ab956ab72adb958844a98eb78" -# Patch nextcloud files only for the last version -cp -a ../sources/patches_last_version/* ../sources/patches +# This function will only be executed upon applying the last upgrade referenced above +last_upgrade_operations () { + # Patch nextcloud files only for the last version + cp -a ../sources/patches_last_version/* ../sources/patches -# Execute post-upgrade operations later on -(cd /tmp ; at now + 10 minutes <<< "(cd $final_path ; sudo -u nextcloud php occ db:add-missing-indices ; sudo -u nextcloud php occ db:convert-filecache-bigint -n) > /tmp/nextcloud_maintenance.log") + # Execute post-upgrade operations later on + (cd /tmp ; at now + 10 minutes <<< "(cd $final_path ; sudo -u nextcloud php occ db:add-missing-indices ; sudo -u nextcloud php occ db:convert-filecache-bigint -n) > /tmp/nextcloud_maintenance.log") +} From 0857601c4fc5e183c7bdc289f7773c91b9129b2e Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Sun, 30 Dec 2018 20:05:20 +0100 Subject: [PATCH 030/204] Change version in manifest as well --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index d5924da..9b9f080 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Access & share your files, calendars, contacts, mail & more from any device, on your terms", "fr": "Consultez et partagez vos fichiers, agendas, carnets d'adresses, emails et bien plus depuis les appareils de votre choix, sous vos conditions" }, - "version": "14.0.4~ynh1", + "version": "15.0.0~ynh1", "url": "https://nextcloud.com", "license": "AGPL-3.0", "maintainer": { From a1e51bb9927889d66c876e5d1f9951a83d3908f9 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Sat, 5 Jan 2019 21:48:29 +0100 Subject: [PATCH 031/204] Fix patches not applied on installation --- scripts/install | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/install b/scripts/install index f46d396..7173e1d 100755 --- a/scripts/install +++ b/scripts/install @@ -79,6 +79,8 @@ ynh_replace_string "__VERSION__" "$next_version" "../conf/app.src" ynh_replace_string "__SHA256_SUM__" "$nextcloud_source_sha256" "../conf/app.src" ynh_app_setting_set $app final_path $final_path +# Enable YunoHost patches on Nextcloud sources +cp -a ../sources/patches_last_version/* ../sources/patches # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source "$final_path" From d934a9192db4b9504d0364d99147ed8eef38eed9 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Mon, 7 Jan 2019 07:30:42 +0100 Subject: [PATCH 032/204] Maintenance operations: fix user for multi-instance and apply at installation --- scripts/install | 5 +++++ scripts/upgrade.d/upgrade.last.sh | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 7173e1d..246f6ea 100755 --- a/scripts/install +++ b/scripts/install @@ -236,6 +236,11 @@ ynh_replace_string "#DESTDIR#" "$final_path" "$cron_path" exec_occ background:cron +#================================================= +# POST-INSTALL MAINTENANCE +#================================================= +(cd /tmp ; at now + 10 minutes <<< "(cd $final_path ; sudo -u $app php occ db:add-missing-indices ; sudo -u $app php occ db:convert-filecache-bigint -n) > /tmp/nextcloud_maintenance.log") + #================================================= # CONFIGURE THE HOOK FILE FOR USER CREATE #================================================= diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index e061d31..0d0d7a2 100755 --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -12,5 +12,5 @@ last_upgrade_operations () { cp -a ../sources/patches_last_version/* ../sources/patches # Execute post-upgrade operations later on - (cd /tmp ; at now + 10 minutes <<< "(cd $final_path ; sudo -u nextcloud php occ db:add-missing-indices ; sudo -u nextcloud php occ db:convert-filecache-bigint -n) > /tmp/nextcloud_maintenance.log") + (cd /tmp ; at now + 10 minutes <<< "(cd $final_path ; sudo -u $app php occ db:add-missing-indices ; sudo -u $app php occ db:convert-filecache-bigint -n) > /tmp/nextcloud_maintenance.log") } From 5ffb18ca0653538da35c4efd0aa3150a8569b410 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Mon, 14 Jan 2019 20:42:25 +0100 Subject: [PATCH 033/204] Upgrade to upstream version 15.0.2 --- README.md | 2 +- manifest.json | 2 +- scripts/upgrade.d/upgrade.last.sh | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 278dc05..146d35d 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Nextcloud for YunoHost own data. A personal cloud which run on your own server. With Nextcloud you can synchronize your files over your devices. -**Shipped version:** 15.0.0 +**Shipped version:** 15.0.2 [![Install Nextcloud with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=nextcloud) ![](https://raw.githubusercontent.com/nextcloud/screenshots/master/files/Files%20Overview.png) diff --git a/manifest.json b/manifest.json index 9b9f080..568d011 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Access & share your files, calendars, contacts, mail & more from any device, on your terms", "fr": "Consultez et partagez vos fichiers, agendas, carnets d'adresses, emails et bien plus depuis les appareils de votre choix, sous vos conditions" }, - "version": "15.0.0~ynh1", + "version": "15.0.2~ynh1", "url": "https://nextcloud.com", "license": "AGPL-3.0", "maintainer": { diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index e061d31..937263d 100755 --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -1,10 +1,10 @@ #!/bin/bash # Last available nextcloud version -next_version="15.0.0" +next_version="15.0.2" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="5bb0c58171353da844019b64080c21078002a59ab956ab72adb958844a98eb78" +nextcloud_source_sha256="c1f4cc33e39994ddbe6777370b62c30b7ae52136a0530c0b9922770803ca0fea" # This function will only be executed upon applying the last upgrade referenced above last_upgrade_operations () { @@ -12,5 +12,5 @@ last_upgrade_operations () { cp -a ../sources/patches_last_version/* ../sources/patches # Execute post-upgrade operations later on - (cd /tmp ; at now + 10 minutes <<< "(cd $final_path ; sudo -u nextcloud php occ db:add-missing-indices ; sudo -u nextcloud php occ db:convert-filecache-bigint -n) > /tmp/nextcloud_maintenance.log") + (cd /tmp ; at now + 10 minutes <<< "(cd $final_path ; sudo -u $app php occ db:add-missing-indices ; sudo -u $app php occ db:convert-filecache-bigint -n) > /tmp/nextcloud_maintenance.log") } From 8e75ccbee95e7d78194ca20529bc351db492b5a8 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Sun, 27 Jan 2019 08:58:18 +0100 Subject: [PATCH 034/204] Use one log file per nextcloud instance --- scripts/install | 2 +- scripts/upgrade.d/upgrade.last.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 246f6ea..5bc37bf 100755 --- a/scripts/install +++ b/scripts/install @@ -239,7 +239,7 @@ exec_occ background:cron #================================================= # POST-INSTALL MAINTENANCE #================================================= -(cd /tmp ; at now + 10 minutes <<< "(cd $final_path ; sudo -u $app php occ db:add-missing-indices ; sudo -u $app php occ db:convert-filecache-bigint -n) > /tmp/nextcloud_maintenance.log") +(cd /tmp ; at now + 10 minutes <<< "(cd $final_path ; sudo -u $app php occ db:add-missing-indices ; sudo -u $app php occ db:convert-filecache-bigint -n) > /tmp/${app}_maintenance.log") #================================================= # CONFIGURE THE HOOK FILE FOR USER CREATE diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index 0d0d7a2..2e16813 100755 --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -12,5 +12,5 @@ last_upgrade_operations () { cp -a ../sources/patches_last_version/* ../sources/patches # Execute post-upgrade operations later on - (cd /tmp ; at now + 10 minutes <<< "(cd $final_path ; sudo -u $app php occ db:add-missing-indices ; sudo -u $app php occ db:convert-filecache-bigint -n) > /tmp/nextcloud_maintenance.log") + (cd /tmp ; at now + 10 minutes <<< "(cd $final_path ; sudo -u $app php occ db:add-missing-indices ; sudo -u $app php occ db:convert-filecache-bigint -n) > /tmp/${app}_maintenance.log") } From 94087e89d51dae733994c9b2495410566a0fd1bb Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Thu, 7 Feb 2019 21:38:17 +0100 Subject: [PATCH 035/204] Upgrade to upstream version 15.0.4 --- README.md | 2 +- manifest.json | 2 +- scripts/upgrade.d/upgrade.last.sh | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 146d35d..865fc0c 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Nextcloud for YunoHost own data. A personal cloud which run on your own server. With Nextcloud you can synchronize your files over your devices. -**Shipped version:** 15.0.2 +**Shipped version:** 15.0.4 [![Install Nextcloud with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=nextcloud) ![](https://raw.githubusercontent.com/nextcloud/screenshots/master/files/Files%20Overview.png) diff --git a/manifest.json b/manifest.json index 568d011..43bf976 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Access & share your files, calendars, contacts, mail & more from any device, on your terms", "fr": "Consultez et partagez vos fichiers, agendas, carnets d'adresses, emails et bien plus depuis les appareils de votre choix, sous vos conditions" }, - "version": "15.0.2~ynh1", + "version": "15.0.4~ynh1", "url": "https://nextcloud.com", "license": "AGPL-3.0", "maintainer": { diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index 1a77d52..80d65dd 100755 --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -1,10 +1,10 @@ #!/bin/bash # Last available nextcloud version -next_version="15.0.2" +next_version="15.0.4" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="c1f4cc33e39994ddbe6777370b62c30b7ae52136a0530c0b9922770803ca0fea" +nextcloud_source_sha256="f87db047c174f563e391a22c959d9ace767ca14ef0f97fc394f3061fc63d8f77" # This function will only be executed upon applying the last upgrade referenced above last_upgrade_operations () { From c3480daae60f402982754c152c4e663616d977a6 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Thu, 7 Feb 2019 21:41:32 +0100 Subject: [PATCH 036/204] Adapt nginx configuration to avoid double headers due to core change (https://github.com/YunoHost/yunohost/commit/8cb029a55e471e1ece3a8a2d7bba00975a6f2d17) --- conf/nginx.conf | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 1691095..2e085c9 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -13,23 +13,23 @@ location ^~ __PATH__ { } # Add headers to serve security related headers - add_header Strict-Transport-Security "max-age=15768000;"; - add_header X-Content-Type-Options nosniff; - add_header X-XSS-Protection "1; mode=block"; - add_header X-Robots-Tag none; - add_header X-Download-Options noopen; - add_header X-Permitted-Cross-Domain-Policies none; - add_header Referrer-Policy no-referrer; + more_set_headers "Strict-Transport-Security: max-age=15768000"; + more_set_headers "X-Content-Type-Options: nosniff"; + more_set_headers "X-XSS-Protection: 1; mode=block"; + more_set_headers "X-Robots-Tag: none"; + more_set_headers "X-Download-Options: noopen"; + more_set_headers "X-Permitted-Cross-Domain-Policies: none"; + more_set_headers "Referrer-Policy: no-referrer"; # Set max upload size client_max_body_size 10G; fastcgi_buffers 64 4K; - + # Extend timeouts client_body_timeout 60m; proxy_read_timeout 60m; fastcgi_read_timeout 60m; - + # Disable gzip to avoid the removal of the ETag header gzip off; @@ -78,15 +78,15 @@ location ^~ __PATH__ { # Adding the cache control header for js and css files location ~* \.(?:css|js)$ { - add_header Cache-Control "public, max-age=7200"; + more_set_headers "Cache-Control: public, max-age=7200"; # Add headers to serve security related headers - add_header Strict-Transport-Security "max-age=15768000;"; - add_header X-Content-Type-Options nosniff; - add_header X-XSS-Protection "1; mode=block"; - add_header X-Robots-Tag none; - add_header X-Download-Options noopen; - add_header X-Permitted-Cross-Domain-Policies none; - add_header Referrer-Policy no-referrer; + more_set_headers "Strict-Transport-Security: max-age=15768000"; + more_set_headers "X-Content-Type-Options: nosniff"; + more_set_headers "X-XSS-Protection: 1; mode=block"; + more_set_headers "X-Robots-Tag: none"; + more_set_headers "X-Download-Options: noopen"; + more_set_headers "X-Permitted-Cross-Domain-Policies: none"; + more_set_headers "Referrer-Policy: no-referrer"; # Optional: Don't log access to assets access_log off; From 1a993ae9b99e2d9520b7bb9c82834966b7169e05 Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Sat, 16 Feb 2019 17:18:56 +0100 Subject: [PATCH 037/204] Normalization from example_ynh --- README.md | 56 +++++++++++++++++++--- conf/config_install.json | 4 +- conf/nextcloud.cron | 2 +- conf/nginx.conf | 7 ++- hooks/post_user_create | 2 +- scripts/_common.sh | 38 --------------- scripts/backup | 21 ++------ scripts/install | 85 ++++++++++++++++++++------------- scripts/remove | 3 +- scripts/restore | 19 ++------ scripts/upgrade | 100 +++++++++++++++++++++++---------------- 11 files changed, 181 insertions(+), 156 deletions(-) diff --git a/README.md b/README.md index 146d35d..83e2e54 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,12 @@ -Nextcloud for YunoHost ---------------------- +# Nextcloud for YunoHost + +[![Integration level](https://dash.yunohost.org/integration/nextcloud.svg)](https://dash.yunohost.org/appci/app/nextcloud) +[![Install Nextcloud with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=nextcloud) + +> *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.* + +## Overview [Nextcloud](https://nextcloud.com) gives you freedom and control over your own data. A personal cloud which run on your own server. With Nextcloud @@ -7,10 +14,23 @@ you can synchronize your files over your devices. **Shipped version:** 15.0.2 -[![Install Nextcloud with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=nextcloud) +## Screenshots + ![](https://raw.githubusercontent.com/nextcloud/screenshots/master/files/Files%20Overview.png) -## Features +## Demo + +* [YunoHost demo](https://demo.yunohost.org/nextcloud/) +* [Official demo](https://demo.nextcloud.com/) + +## Configuration + +## Documentation + + * Official documentation: https://docs.nextcloud.com/server/15/user_manual/ + * YunoHost documentation: https://github.com/YunoHost/doc/blob/master/app_nextcloud_fr.md + +## YunoHost specific features In addition to Nextcloud core features, the following are made available with this package: @@ -23,6 +43,14 @@ this package: * 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 + +#### Supported architectures + +* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/nextcloud%20%28Official%29.svg)](https://ci-apps.yunohost.org/ci/apps/nextcloud/) +* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/nextcloud%20%28Official%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/nextcloud/) +* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/nextcloud%20%28Official%29.svg)](https://ci-stretch.nohost.me/ci/apps/nextcloud/) + ## Limitations To integrate the logout button to the SSO, we have to patch Nextcloud sources. @@ -38,7 +66,9 @@ 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/') ``` -## Migrate from ownCloud +## Additionnal informations + +#### Migrate from ownCloud **This is not considered as stable yet, please do it with care and only for testing!** @@ -72,6 +102,20 @@ sudo yunohost app ssowatconf ## Links - * Report a bug: https://dev.yunohost.org/projects/apps/issues + * Report a bug: https://github.com/YunoHost-Apps/nextcloud_ynh/issues * Nextcloud website: https://nextcloud.com/ * 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). + +To try the testing branch, please proceed like that. +``` +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 +``` diff --git a/conf/config_install.json b/conf/config_install.json index 52bff54..10db7cf 100644 --- a/conf/config_install.json +++ b/conf/config_install.json @@ -1,9 +1,9 @@ { "system": { - "datadirectory": "#DATADIR#", + "datadirectory": "__DATADIR__", "trusted_domains": [ "localhost", - "#DOMAIN#" + "__DOMAIN__" ] } } diff --git a/conf/nextcloud.cron b/conf/nextcloud.cron index 294325b..93fde63 100644 --- a/conf/nextcloud.cron +++ b/conf/nextcloud.cron @@ -1 +1 @@ -*/15 * * * * #USER# /usr/bin/php -f #DESTDIR#/cron.php +*/15 * * * * __USER__ /usr/bin/php -f __DESTDIR__/cron.php diff --git a/conf/nginx.conf b/conf/nginx.conf index 1691095..6d217e1 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -6,8 +6,11 @@ location = /.well-known/caldav { } location ^~ __PATH__ { + + # Path to source alias __FINALPATH__/; + # Force usage of https if ($scheme = http) { rewrite ^ https://$server_name$request_uri? permanent; } @@ -24,12 +27,12 @@ location ^~ __PATH__ { # Set max upload size client_max_body_size 10G; fastcgi_buffers 64 4K; - + # Extend timeouts client_body_timeout 60m; proxy_read_timeout 60m; fastcgi_read_timeout 60m; - + # Disable gzip to avoid the removal of the ETag header gzip off; diff --git a/hooks/post_user_create b/hooks/post_user_create index f215f00..da6bb53 100644 --- a/hooks/post_user_create +++ b/hooks/post_user_create @@ -2,4 +2,4 @@ user=$1 -sudo setfacl -m g:#GROUP#:rwx /home/$user +sudo setfacl --modify g:__GROUP__:rwx /home/$user diff --git a/scripts/_common.sh b/scripts/_common.sh index 566494d..540c024 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -9,44 +9,6 @@ if [ "$(lsb_release --codename --short)" != "jessie" ]; then pkg_dependencies="$pkg_dependencies php-zip php-apcu php-mbstring php-xml" fi -#================================================= -# COMMON HELPERS -#================================================= - -# Execute a command with occ -exec_occ() { - (cd "$final_path" && exec_as "$app" \ - php occ --no-interaction --no-ansi "$@") -} - -# Create the external storage for the given folders and enable sharing -create_external_storage() { - local datadir="$1" - local mount_name="$2" - local mount_id=`exec_occ files_external:create --output=json \ - "$2" 'local' 'null::null' -c "datadir=$datadir" || true` - ! [[ $mount_id =~ ^[0-9]+$ ]] \ - && echo "Unable to create external storage" >&2 \ - || exec_occ files_external:option "$mount_id" enable_sharing true -} - -# Rename a MySQL database and user -# Usage: rename_mysql_db DBNAME DBUSER DBPASS NEW_DBNAME_AND_USER -rename_mysql_db() { - local db_name=$1 db_user=$2 db_pwd=$3 new_db_name=$4 - local sqlpath="/tmp/${db_name}-$(date '+%s').sql" - - # Dump the old database - mysqldump -u "$db_user" -p"$db_pwd" --no-create-db "$db_name" > "$sqlpath" - - # Create the new database and user - ynh_mysql_create_db "$new_db_name" "$new_db_name" "$db_pwd" - ynh_mysql_connect_as "$new_db_name" "$db_pwd" "$new_db_name" < "$sqlpath" - - # Remove the old database - ynh_mysql_remove_db $db_name $db_name - ynh_secure_remove "$sqlpath" -} #================================================= # COMMON HELPERS -- SHOULD BE ADDED TO YUNOHOST diff --git a/scripts/backup b/scripts/backup index 0a1f69c..a41fb88 100755 --- a/scripts/backup +++ b/scripts/backup @@ -2,18 +2,11 @@ #================================================= # GENERIC START -#================================================= - #================================================= # IMPORT GENERIC HELPERS #================================================= -if [ ! -e _common.sh ]; then - # Get the _common.sh file if it's not in the current directory - cp ../settings/scripts/_common.sh ./_common.sh - chmod a+rx _common.sh -fi -source _common.sh +source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers #================================================= @@ -77,11 +70,7 @@ ynh_backup "/etc/cron.d/$app" # BACKUP THE DATA DIRECTORY #================================================= -backup_core_only=$(ynh_app_setting_get "$app" backup_core_only) -# If backup_core_only have any value in the settings.yml file, do not backup the data directory -if [ -z $backup_core_only ] -then - ynh_backup "/home/yunohost.app/${app}/data" -else - echo "Data dir will not be saved, because backup_core_only is set." >&2 -fi +# The 1 parameter indicates the directory is "big", +# so that it won't be backed up before upgrade +# This argument has to be the third one. +ynh_backup "/home/yunohost.app/${app}/data" "/home/yunohost.app/${app}/data" 1 diff --git a/scripts/install b/scripts/install index 5bc37bf..2c301c0 100755 --- a/scripts/install +++ b/scripts/install @@ -37,8 +37,6 @@ test ! -e "$final_path" || ynh_die "This path already contains a folder" # Normalize the url path syntax path_url=$(ynh_normalize_url_path $path_url) -# Check web path availability -ynh_webpath_available $domain $path_url # Register (book) web path ynh_webpath_register $app $domain $path_url @@ -89,16 +87,11 @@ ynh_setup_source "$final_path" #================================================= # Do not serve .well-known if it's already served on the domain -if is_url_handled "https://${domain}/.well-known/caldav" ; then +if is_url_handled "https://$domain/.well-known/caldav" ; then sed -ri '/^location = \/\.well\-known\/(caldav|carddav) \{/,/\}/d' \ - "../conf/nginx.conf" + "../conf/nginx.conf" fi -# Handle root path, avoid double slash. -# Temporary fix, in waiting for an upgrade of the helper. (#361) -path_url_slash_less=${path_url%/} -ynh_replace_string "__PATH__/" "$path_url_slash_less/" "../conf/nginx.conf" - # Create a dedicated nginx config ynh_add_nginx_config @@ -123,7 +116,7 @@ ynh_add_fpm_config #================================================= # Define app's data directory -datadir="/home/yunohost.app/${app}/data" +datadir="/home/yunohost.app/$app/data" # Create app folders mkdir -p "$datadir" @@ -131,16 +124,22 @@ mkdir -p "$datadir" # INSTALL NEXTCLOUD #================================================= +# Define a function to execute commands with `occ` +exec_occ() { + (cd "$final_path" && exec_as "$app" \ + php occ --no-interaction --no-ansi "$@") +} + # Set write access for the following commands chown -R $app: "$final_path" "$datadir" # 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" \ + --database "mysql" --database-name $db_name \ + --database-user $db_name --database-pass "$db_pwd" \ --admin-user "admin" --admin-pass "$(ynh_string_random 6)" \ --data-dir "$datadir" \ - || ynh_die "Unable to install Nextcloud" + || ynh_die "Unable to install Nextcloud" #================================================= # CONFIGURE NEXTCLOUD @@ -149,24 +148,28 @@ exec_occ maintenance:install \ # Ensure that UpdateNotification app is disabled exec_occ app:disable updatenotification -# Enable plugins +# Enable ldap plugins exec_occ app:enable user_ldap exec_occ ldap:create-empty-config # Load the installation config file in nextcloud -nc_conf="${final_path}/config_install.json" +nc_conf="$final_path/config_install.json" cp ../conf/config_install.json "$nc_conf" -ynh_replace_string "#DOMAIN#" "$domain" "$nc_conf" -ynh_replace_string "#DATADIR#" "$datadir" "$nc_conf" + +ynh_replace_string "__DOMAIN__" "$domain" "$nc_conf" +ynh_replace_string "__DATADIR__" "$datadir" "$nc_conf" exec_occ config:import "$nc_conf" -# Then remove it + +# Then remove the config file rm -f "$nc_conf" # Load the additional config file (used also for upgrade) -nc_conf="${final_path}/config_install.json" +nc_conf="$final_path/config.json" cp ../conf/config.json "$nc_conf" + exec_occ config:import "$nc_conf" -# Then remove it + +# Then remove the config file rm -f "$nc_conf" #================================================= @@ -181,13 +184,26 @@ exec_occ ldap:test-config \'\' \ # MOUNT HOME FOLDERS AS EXTERNAL STORAGE #================================================= +# Define a function to add an external storage +# Create the external storage for the given folders and enable sharing +create_external_storage() { + local datadir="$1" + local mount_name="$2" + local mount_id=`exec_occ files_external:create --output=json \ + "$mount_name" 'local' 'null::null' -c "datadir=$datadir" || true` + ! [[ $mount_id =~ ^[0-9]+$ ]] \ + && echo "Unable to create external storage" >&2 \ + || exec_occ files_external:option "$mount_id" enable_sharing true +} + # Enable External Storage and create local mount to home folder -if [ $user_home -eq 1 ]; then +if [ $user_home -eq 1 ] +then exec_occ app:enable files_external create_external_storage "/home/\$user" "Home" # Iterate over users to extend their home folder permissions for u in $(ynh_user_list); do - setfacl -m g:$app:rwx "/home/$u" || true + setfacl --modify g:$app:rwx "/home/$u" || true done fi @@ -203,7 +219,7 @@ exec_occ config:system:get logout_url >/dev/null 2>&1 \ \$main_domain = exec('cat /etc/yunohost/current_host'); \$CONFIG['logout_url'] = 'https://'.\$main_domain.'/yunohost/sso/?action=logout'; //-YunoHost- -" >> "${final_path}/config/config.php" +" >> "$final_path/config/config.php" #================================================= # REMOVE THE TEMPORARY ADMIN AND SET THE TRUE ONE @@ -220,7 +236,7 @@ exec_occ user:delete admin #================================================= # Calculate and store the config file checksum into the app settings -ynh_store_file_checksum "${final_path}/config/config.php" +ynh_store_file_checksum "$final_path/config/config.php" #================================================= # ADD A CRON JOB @@ -231,14 +247,15 @@ cp -a ../conf/nextcloud.cron "$cron_path" chown root: "$cron_path" chmod 644 "$cron_path" -ynh_replace_string "#USER#" "$app" "$cron_path" -ynh_replace_string "#DESTDIR#" "$final_path" "$cron_path" +ynh_replace_string "__USER__" "$app" "$cron_path" +ynh_replace_string "__DESTDIR__" "$final_path" "$cron_path" exec_occ background:cron #================================================= # POST-INSTALL MAINTENANCE #================================================= + (cd /tmp ; at now + 10 minutes <<< "(cd $final_path ; sudo -u $app php occ db:add-missing-indices ; sudo -u $app php occ db:convert-filecache-bigint -n) > /tmp/${app}_maintenance.log") #================================================= @@ -246,7 +263,7 @@ exec_occ background:cron #================================================= # Set system group in hooks -ynh_replace_string "#GROUP#" "$app" ../hooks/post_user_create +ynh_replace_string "__GROUP__" "$app" ../hooks/post_user_create #================================================= # YUNOHOST MULTIMEDIA INTEGRATION @@ -269,19 +286,19 @@ ynh_multimedia_addaccess $app # Fix app ownerships & permissions chown -R $app: "$final_path" "$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" +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 #================================================= # SETUP LOGROTATE #================================================= -# Use logrotate to manage application logfile -ynh_use_logrotate "${datadir}/nextcloud.log" +# Use logrotate to manage application logfile(s) +ynh_use_logrotate "$datadir/nextcloud.log" #================================================= # SETUP SSOWAT diff --git a/scripts/remove b/scripts/remove index b21d030..907a7e7 100755 --- a/scripts/remove +++ b/scripts/remove @@ -78,8 +78,9 @@ ynh_secure_remove "/etc/cron.d/$app" #================================================= for i in $(ls /home); do + # Clean ACL in every directories in /home, except those which start with 'yunohost.' [[ ! $i == yunohost.* ]] \ - && setfacl -x g:$app:rwx 2>&1 + && setfacl --remove g:$app:rwx 2>&1 done #================================================= diff --git a/scripts/restore b/scripts/restore index 7f601db..157128a 100755 --- a/scripts/restore +++ b/scripts/restore @@ -2,18 +2,11 @@ #================================================= # GENERIC START -#================================================= - #================================================= # IMPORT GENERIC HELPERS #================================================= -if [ ! -e _common.sh ]; then - # Get the _common.sh file if it's not in the current directory - cp ../settings/scripts/_common.sh ./_common.sh - chmod a+rx _common.sh -fi -source _common.sh +source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers #================================================= @@ -103,7 +96,7 @@ ynh_restore_file "/etc/logrotate.d/$app" # RESTORE THE DATA DIRECTORY #================================================= -datadir="/home/yunohost.app/${app}/data" +datadir="/home/yunohost.app/$app/data" # The data directory will be restored only if it exists in the backup archive # So only if it was backup previously. @@ -114,8 +107,6 @@ else # Create app folders mkdir -p "$datadir" fi -# Remove the option backup_core_only if it's in the settings.yml file -ynh_app_setting_delete $app backup_core_only #================================================= # RESTORE USER RIGHTS @@ -123,14 +114,14 @@ ynh_app_setting_delete $app backup_core_only # Fix app ownerships & permissions chown -R $app: "$final_path" "$datadir" -chmod 640 "${final_path}/config/config.php" +chmod 640 "$final_path/config/config.php" chmod 755 /home/yunohost.app # Iterate over users to extend their home folder permissions - for the external # storage plugin usage - and create relevant Nextcloud directories for u in $(ynh_user_list); do - mkdir -p "${datadir}/${u}" - setfacl -m g:$app:rwx "/home/$u" || true + mkdir -p "$datadir/$u" + setfacl --modify g:$app:rwx "/home/$u" || true done #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index d0c6329..78bdce9 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -38,34 +38,33 @@ if [ -z $final_path ]; then ynh_app_setting_set $app final_path $final_path fi +# Remove the option backup_core_only if it's in the settings.yml file +ynh_app_setting_delete $app backup_core_only + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= # Made a backup only after the version 11.0.0 # Before, the datas will be always saved. - # Get the current version number of nextcloud/owncloud current_version=$(grep OC_VersionString "$final_path/version.php" | cut -d\' -f2) current_major_version=${current_version%%.*} if [ $current_major_version -gt 11 ] then - # Inform the backup/restore process that it should not save the data directory - ynh_app_setting_set $app backup_core_only 1 - # Backup the current version of the app ynh_backup_before_upgrade ynh_clean_setup () { - # Remove the post migration script before its execution ! - ynh_secure_remove "/tmp/owncloud_post_migration.sh" 2>&1 + # Remove the post migration script before its execution ! + ynh_secure_remove "/tmp/owncloud_post_migration.sh" 2>&1 - # restore it if the upgrade fails - ynh_restore_upgradebackup + # restore it if the upgrade fails + ynh_restore_upgradebackup } fi -# Exit if an error occurs during the script execution +# Exit if an error occurs during the execution of the script ynh_abort_if_errors #================================================= @@ -75,7 +74,7 @@ ynh_abort_if_errors ynh_handle_app_migration "owncloud" "owncloud_migration" if [ $migration_process -eq 1 ] then - # If a migration has been perform + # If a migration has been performed # Reload some values changed by the migration process final_path=$(ynh_app_setting_get $app final_path) db_name=$(ynh_app_setting_get $app db_name) @@ -106,19 +105,17 @@ path_url=$(ynh_normalize_url_path $path_url) # NGINX CONFIGURATION #================================================= +ynh_backup_if_checksum_is_different "/etc/nginx/conf.d/$domain.d/$app.conf" + # Delete current nginx configuration to be able to check if .well-known is already served. ynh_remove_nginx_config ynh_app_setting_delete $app "checksum__etc_nginx_conf.d_$domain.d_$app.conf" || true -# Do not serve .well-known if it's already served on the domain -if is_url_handled "https://${domain}/.well-known/caldav" ; then - sed -ri '/^location = \/\.well\-known\/(caldav|carddav) \{/,/\}/d' \ - "../conf/nginx.conf" -fi -# Handle root path, avoid double slash. -# Temporary fix, in waiting for an upgrade of the helper. (#361) -path_url_slash_less=${path_url%/} -ynh_replace_string "__PATH__/" "$path_url_slash_less/" "../conf/nginx.conf" +# Do not serve .well-known if it's already served on the domain +if is_url_handled "https://$domain/.well-known/caldav" ; then + sed -ri '/^location = \/\.well\-known\/(caldav|carddav) \{/,/\}/d' \ + "../conf/nginx.conf" +fi # Create a dedicated nginx config ynh_add_nginx_config @@ -127,7 +124,7 @@ ynh_add_nginx_config # CREATE DEDICATED USER #================================================= -# Create a system user +# Create a dedicated user (if not existing) ynh_system_user_create $app #================================================= @@ -149,13 +146,20 @@ ynh_install_app_dependencies $pkg_dependencies # MAKE SEQUENTIAL UPGRADES FROM EACH MAJOR # VERSION TO THE NEXT ONE #================================================= +ynh_print_info "Upgrading nextcloud..." + +# Define a function to execute commands with `occ` +exec_occ() { + (cd "$final_path" && exec_as "$app" \ + php occ --no-interaction --no-ansi "$@") +} # Load the last available version source upgrade.d/upgrade.last.sh last_version=$next_version # Define app's data directory -datadir="/home/yunohost.app/${app}/data" +datadir="/home/yunohost.app/$app/data" # Set write access for the following commands chown -R $app: "$final_path" "$datadir" @@ -183,7 +187,7 @@ do # Load the value for this version source upgrade.d/upgrade.$current_major_version.sh - echo -e "\nUpgrade to nextcloud $next_version" >&2 + ynh_print_info "Upgrade to nextcloud $next_version" # Create an app.src for this version of nextcloud cp ../conf/app.src.default ../conf/app.src @@ -217,7 +221,7 @@ do # Upgrade Nextcloud (SUCCESS = 0, UP_TO_DATE = 3) exec_occ maintenance:mode --off exec_occ upgrade \ - || ([[ $? -eq 3 ]] || ynh_die "Unable to upgrade Nextcloud") + || ([ $? -eq 3 ] || ynh_die "Unable to upgrade Nextcloud") # Get the new current version number current_version=$(grep OC_VersionString "$final_path/version.php" | cut -d\' -f2) @@ -232,12 +236,13 @@ done #================================================= # Verify the checksum and backup the file if it's different -ynh_backup_if_checksum_is_different "${final_path}/config/config.php" +ynh_backup_if_checksum_is_different "$final_path/config/config.php" nc_conf="${final_path}/config.json" cp ../conf/config.json "$nc_conf" -ynh_replace_string "#DOMAIN#" "$domain" "$nc_conf" -ynh_replace_string "#DATADIR#" "$datadir" "$nc_conf" + +ynh_replace_string "__DOMAIN__" "$domain" "$nc_conf" +ynh_replace_string "__DATADIR__" "$datadir" "$nc_conf" # Ensure that UpdateNotification app is disabled exec_occ app:disable updatenotification @@ -247,7 +252,8 @@ exec_occ app:enable user_ldap # Load the config file in nextcloud exec_occ config:import "$nc_conf" -# Then remove it + +# Then remove the config file rm -f "$nc_conf" #================================================= @@ -262,12 +268,24 @@ exec_occ config:system:get logout_url >/dev/null 2>&1 \ \$main_domain = exec('cat /etc/yunohost/current_host'); \$CONFIG['logout_url'] = 'https://'.\$main_domain.'/yunohost/sso/?action=logout'; //-YunoHost- -" >> "${final_path}/config/config.php" +" >> "$final_path/config/config.php" #================================================= # MOUNT HOME FOLDERS AS EXTERNAL STORAGE #================================================= +# Define a function to add an external storage +# Create the external storage for the given folders and enable sharing +create_external_storage() { + local datadir="$1" + local mount_name="$2" + local mount_id=`exec_occ files_external:create --output=json \ + "$mount_name" 'local' 'null::null' -c "datadir=$datadir" || true` + ! [[ $mount_id =~ ^[0-9]+$ ]] \ + && echo "Unable to create external storage" >&2 \ + || exec_occ files_external:option "$mount_id" enable_sharing true +} + # Enable External Storage and create local mount to home folder as needed if [ $user_home -eq 1 ]; then exec_occ app:enable files_external @@ -276,7 +294,7 @@ if [ $user_home -eq 1 ]; then || create_external_storage "/home/\$user" "Home" # Iterate over users to extend their home folder permissions for u in $(ynh_user_list); do - setfacl -m g:$app:rwx "/home/$u" || true + setfacl --modify g:$app:rwx "/home/$u" || true done fi @@ -296,8 +314,8 @@ cp -a ../conf/nextcloud.cron "$cron_path" chown root: "$cron_path" chmod 644 "$cron_path" -ynh_replace_string "#USER#" "$app" "$cron_path" -ynh_replace_string "#DESTDIR#" "$final_path" "$cron_path" +ynh_replace_string "__USER__" "$app" "$cron_path" +ynh_replace_string "__DESTDIR__" "$final_path" "$cron_path" exec_occ background:cron @@ -306,7 +324,7 @@ exec_occ background:cron #================================================= # Set system group in hooks -ynh_replace_string "#GROUP#" "$app" ../hooks/post_user_create +ynh_replace_string "__GROUP__" "$app" ../hooks/post_user_create #================================================= # YUNOHOST MULTIMEDIA INTEGRATION @@ -329,11 +347,11 @@ ynh_multimedia_addaccess $app # Fix app ownerships & permissions chown -R $app: "$final_path" "$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" +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 #================================================= @@ -341,8 +359,8 @@ chmod 755 /home/yunohost.app #================================================= # Warn about possible disabled apps -echo "Note that if you've installed some third-parties Nextcloud applications, \ -they are probably disabled and you'll have to manually enable them again." >&2 +ynh_print_warn "Note that if you've installed some third-parties Nextcloud applications, \ +they are probably disabled and you'll have to manually enable them again." #================================================= # SETUP LOGROTATE @@ -373,10 +391,10 @@ systemctl reload nginx if [ $migration_process -eq 1 ] then - echo "ownCloud has been successfully migrated to Nextcloud! \ + ynh_print_info "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." >&2 +you don't see Nextcloud as installed." # Execute a post migration script after the end of this upgrade. # Mainly for some cleaning From 00761efadebacace0db1c3cbe232a658c4226e9a Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Sat, 16 Feb 2019 17:21:15 +0100 Subject: [PATCH 038/204] Use php7 --- conf/nginx.conf | 2 +- conf/php-fpm.conf | 104 ++++++++++++++++++++++++++++++--------------- manifest.json | 4 +- scripts/_common.sh | 7 +-- scripts/backup | 2 +- scripts/restore | 4 +- 6 files changed, 77 insertions(+), 46 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 6d217e1..ba6c554 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -70,7 +70,7 @@ location ^~ __PATH__ { fastcgi_param HTTPS on; fastcgi_param modHeadersAvailable true; fastcgi_param REMOTE_USER $remote_user; - fastcgi_pass unix:/var/run/php5-fpm-__NAME__.sock; + fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock; fastcgi_intercept_errors on; } diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf index 2571613..74825fa 100644 --- a/conf/php-fpm.conf +++ b/conf/php-fpm.conf @@ -1,10 +1,11 @@ ; Start a new pool named 'www'. -; the variable $pool can we used in any directive and will be replaced by the +; the variable $pool can be used in any directive and will be replaced by the ; pool name ('www' here) [__NAMETOCHANGE__] ; Per pool prefix ; It only applies on the following directives: +; - 'access.log' ; - 'slowlog' ; - 'listen' (unixsocket) ; - 'chroot' @@ -24,28 +25,35 @@ group = __USER__ ; The address on which to accept FastCGI requests. ; Valid syntaxes are: -; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on +; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on ; a specific port; -; 'port' - to listen on a TCP socket to all addresses on a -; specific port; +; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on +; a specific port; +; 'port' - to listen on a TCP socket to all addresses +; (IPv6 and IPv4-mapped) on a specific port; ; '/path/to/unix/socket' - to listen on a unix socket. ; Note: This value is mandatory. -listen = /var/run/php5-fpm-__NAMETOCHANGE__.sock +listen = /var/run/php/php7.0-fpm-__NAMETOCHANGE__.sock -; Set listen(2) backlog. A value of '-1' means unlimited. -; Default Value: 128 (-1 on FreeBSD and OpenBSD) -;listen.backlog = 128 +; Set listen(2) backlog. +; Default Value: 511 (-1 on FreeBSD and OpenBSD) +;listen.backlog = 511 ; Set permissions for unix socket, if one is used. In Linux, read/write ; permissions must be set in order to allow connections from a web server. Many -; BSD-derived systems allow connections regardless of permissions. +; BSD-derived systems allow connections regardless of permissions. ; Default Values: user and group are set as the running user ; mode is set to 0660 listen.owner = www-data listen.group = www-data ;listen.mode = 0660 - -; List of ipv4 addresses of FastCGI clients which are allowed to connect. +; When POSIX Access Control Lists are supported you can set them using +; these options, value is a comma separated list of user/group names. +; When set, listen.owner and listen.group are ignored +;listen.acl_users = +;listen.acl_groups = + +; List of addresses (IPv4/IPv6) of FastCGI clients which are allowed to connect. ; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original ; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address ; must be separated by a comma. If this value is left blank, connections will be @@ -59,7 +67,13 @@ listen.group = www-data ; - The pool processes will inherit the master process priority ; unless it specified otherwise ; Default Value: no set -; priority = -19 +; process.priority = -19 + +; Set the process dumpable flag (PR_SET_DUMPABLE prctl) even if the process user +; or group is differrent than the master process user. It allows to create process +; core dump and ptrace the process for the pool user. +; Default Value: no +; process.dumpable = yes ; Choose how the process manager will control the number of child processes. ; Possible Values: @@ -117,12 +131,12 @@ pm.max_spare_servers = 3 ; Note: Used only when pm is set to 'ondemand' ; Default Value: 10s ;pm.process_idle_timeout = 10s; - + ; The number of requests each child process should execute before respawning. ; This can be useful to work around memory leaks in 3rd party libraries. For ; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS. ; Default Value: 0 -pm.max_requests = 500 +;pm.max_requests = 500 ; The URI to view the FPM status page. If this value is not set, no URI will be ; recognized as a status page. It shows the following informations: @@ -170,7 +184,7 @@ pm.max_requests = 500 ; ; By default the status page only outputs short status. Passing 'full' in the ; query string will also return status for each pool process. -; Example: +; Example: ; http://www.foo.bar/status?full ; http://www.foo.bar/status?json&full ; http://www.foo.bar/status?html&full @@ -215,7 +229,7 @@ pm.max_requests = 500 ; last request memory: 0 ; ; Note: There is a real-time FPM status monitoring sample web page available -; It's available in: ${prefix}/share/fpm/status.html +; It's available in: /usr/share/php/7.0/fpm/status.html ; ; Note: The value must start with a leading slash (/). The value can be ; anything, but it may not be a good idea to use the .php extension or it @@ -275,7 +289,7 @@ pm.max_requests = 500 ; - %{megabytes}M ; - %{mega}M ; %n: pool name -; %o: ouput header +; %o: output header ; it must be associated with embraces to specify the name of the header: ; - %{Content-Type}o ; - %{X-Powered-By}o @@ -283,7 +297,7 @@ pm.max_requests = 500 ; - .... ; %p: PID of the child that serviced the request ; %P: PID of the parent of the child that serviced the request -; %q: the query string +; %q: the query string ; %Q: the '?' character if query string exists ; %r: the request URI (without the query string, see %q and %Q) ; %R: remote IP address @@ -291,47 +305,51 @@ pm.max_requests = 500 ; %t: server time the request was received ; it can accept a strftime(3) format: ; %d/%b/%Y:%H:%M:%S %z (default) +; The strftime(3) format must be encapsuled in a %{}t tag +; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t ; %T: time the log has been written (the request has finished) ; it can accept a strftime(3) format: ; %d/%b/%Y:%H:%M:%S %z (default) +; The strftime(3) format must be encapsuled in a %{}t tag +; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t ; %u: remote user ; ; Default: "%R - %u %t \"%m %r\" %s" ;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%" - + ; The log file for slow requests ; Default Value: not set ; Note: slowlog is mandatory if request_slowlog_timeout is set -slowlog = /var/log/nginx/__NAMETOCHANGE__.slow.log - +;slowlog = log/$pool.log.slow + ; The timeout for serving a single request after which a PHP backtrace will be ; dumped to the 'slowlog' file. A value of '0s' means 'off'. ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) ; Default Value: 0 -request_slowlog_timeout = 5s - +;request_slowlog_timeout = 0 + ; The timeout for serving a single request after which the worker process will ; be killed. This option should be used when the 'max_execution_time' ini option ; does not stop script execution for some reason. A value of '0' means 'off'. ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) ; Default Value: 0 request_terminate_timeout = 1d - + ; Set open file descriptor rlimit. ; Default Value: system defined value ;rlimit_files = 1024 - + ; Set max core size rlimit. ; Possible Values: 'unlimited' or an integer greater or equal to 0 ; Default Value: system defined value ;rlimit_core = 0 - + ; Chroot to this directory at the start. This value must be defined as an ; absolute path. When this value is not set, chroot is not used. ; Note: you can prefix with '$prefix' to chroot to the pool prefix or one ; of its subdirectories. If the pool prefix is not set, the global prefix ; will be used instead. -; Note: chrooting is a great security feature and should be used whenever +; Note: chrooting is a great security feature and should be used whenever ; possible. However, all PHP paths will be relative to the chroot ; (error_log, sessions.save_path, ...). ; Default Value: not set @@ -347,16 +365,25 @@ chdir = __FINALPATH__ ; Note: on highloaded environement, this can cause some delay in the page ; process time (several ms). ; Default Value: no -catch_workers_output = yes +;catch_workers_output = yes + +; Clear environment in FPM workers +; Prevents arbitrary environment variables from reaching FPM worker processes +; by clearing the environment in workers before env vars specified in this +; pool configuration are added. +; Setting to "no" will make all environment variables available to PHP code +; via getenv(), $_ENV and $_SERVER. +; Default Value: yes +;clear_env = no ; Limits the extensions of the main script FPM will allow to parse. This can ; prevent configuration mistakes on the web server side. You should only limit ; FPM to .php extensions to prevent malicious users to use other extensions to -; exectute php code. +; execute php code. ; Note: set an empty value to allow all extensions. ; Default Value: .php -;security.limit_extensions = .php .php3 .php4 .php5 - +;security.limit_extensions = .php .php3 .php4 .php5 .php7 + ; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from ; the current environment. ; Default Value: clean env @@ -365,13 +392,12 @@ catch_workers_output = yes ;env[TMP] = /tmp ;env[TMPDIR] = /tmp ;env[TEMP] = /tmp -env[PATH] = $PATH ; Additional php.ini defines, specific to this pool of workers. These settings ; overwrite the values previously defined in the php.ini. The directives are the ; same as the PHP SAPI: ; php_value/php_flag - you can set classic ini defines which can -; be overwritten from PHP call 'ini_set'. +; be overwritten from PHP call 'ini_set'. ; php_admin_value/php_admin_flag - these directives won't be overwritten by ; PHP call 'ini_set' ; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no. @@ -392,6 +418,17 @@ env[PATH] = $PATH ;php_admin_flag[log_errors] = on ;php_admin_value[memory_limit] = 32M +; Common values to change to increase file upload limit +; php_admin_value[upload_max_filesize] = 50M +; php_admin_value[post_max_size] = 50M +; php_admin_flag[mail.add_x_header] = Off + +; Other common parameters +; php_admin_value[max_execution_time] = 600 +; php_admin_value[max_input_time] = 300 +; php_admin_value[memory_limit] = 256M +; php_admin_flag[short_open_tag] = On + ; Additional php.ini defines, specific to this pool of workers. php_value[upload_max_filesize] = 10G php_value[post_max_size] = 10G @@ -404,4 +441,3 @@ 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 - diff --git a/manifest.json b/manifest.json index 568d011..f0197d9 100644 --- a/manifest.json +++ b/manifest.json @@ -14,12 +14,12 @@ "email": "apps@yunohost.org" }, "requirements": { - "yunohost": ">= 2.7.2" + "yunohost": ">= 3.0" }, "multi_instance": true, "services": [ "nginx", - "php5-fpm", + "php7.0-fpm", "mysql" ], "arguments": { diff --git a/scripts/_common.sh b/scripts/_common.sh index 540c024..cb2677e 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -3,12 +3,7 @@ # COMMON VARIABLES #================================================= -pkg_dependencies="php5-gd php5-json php5-intl php5-mcrypt php5-curl php5-apcu php5-redis php5-ldap php5-imagick imagemagick acl tar smbclient at" - -if [ "$(lsb_release --codename --short)" != "jessie" ]; then - pkg_dependencies="$pkg_dependencies php-zip php-apcu php-mbstring php-xml" -fi - +pkg_dependencies="php-gd php-json php-intl php-mcrypt php-curl php-apcu php-redis php-ldap php-imagick php-zip php-mbstring php-xml imagemagick acl tar smbclient at" #================================================= # COMMON HELPERS -- SHOULD BE ADDED TO YUNOHOST diff --git a/scripts/backup b/scripts/backup index a41fb88..67f05ce 100755 --- a/scripts/backup +++ b/scripts/backup @@ -44,7 +44,7 @@ ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" # BACKUP THE PHP-FPM CONFIGURATION #================================================= -ynh_backup "/etc/php5/fpm/pool.d/$app.conf" +ynh_backup "/etc/php/7.0/fpm/pool.d/$app.conf" #================================================= # BACKUP THE MYSQL DATABASE diff --git a/scripts/restore b/scripts/restore index 157128a..1a2209c 100755 --- a/scripts/restore +++ b/scripts/restore @@ -69,7 +69,7 @@ ynh_system_user_create $app # RESTORE THE PHP-FPM CONFIGURATION #================================================= -ynh_restore_file "/etc/php5/fpm/pool.d/$app.conf" +ynh_restore_file "/etc/php/7.0/fpm/pool.d/$app.conf" #================================================= # SPECIFIC RESTORATION @@ -139,5 +139,5 @@ ynh_multimedia_addaccess $app # RELOAD NGINX AND PHP-FPM #================================================= -systemctl reload php5-fpm +systemctl reload php7.0-fpm systemctl reload nginx From b399b690513a3159a4f9be47e89d548f8027e890 Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Sat, 16 Feb 2019 17:21:42 +0100 Subject: [PATCH 039/204] Update helpers --- scripts/_common.sh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index cb2677e..9301891 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -6,7 +6,7 @@ pkg_dependencies="php-gd php-json php-intl php-mcrypt php-curl php-apcu php-redis php-ldap php-imagick php-zip php-mbstring php-xml imagemagick acl tar smbclient at" #================================================= -# COMMON HELPERS -- SHOULD BE ADDED TO YUNOHOST +# EXPERIMENTAL HELPERS #================================================= # Execute a command as another user @@ -277,8 +277,9 @@ ynh_handle_app_migration () { #================================================= -# EXPERIMENTAL HELPERS +# FUTURE OFFICIAL HELPERS #================================================= + #================================================= # YUNOHOST MULTIMEDIA INTEGRATION #================================================= @@ -287,16 +288,20 @@ ynh_handle_app_migration () { # # usage: ynh_multimedia_build_main_dir ynh_multimedia_build_main_dir () { - local ynh_media_release="v1.0" - local checksum="4852c8607db820ad51f348da0dcf0c88" + 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 - # Verify checksum + # 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 From 764209306b31f858c03316d6749bc9c1743af7c3 Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Sun, 17 Feb 2019 20:57:31 +0100 Subject: [PATCH 040/204] Add progression with ynh_print_info --- README.md | 2 +- conf/nginx.conf | 30 +++++++++++++++--------------- manifest.json | 2 +- scripts/_common.sh | 25 +++++++++++++++++++++++++ scripts/backup | 13 +++++++++++++ scripts/install | 20 ++++++++++++++++++++ scripts/remove | 14 ++++++++++++++ scripts/restore | 15 +++++++++++++++ scripts/upgrade | 21 ++++++++++++++++++++- scripts/upgrade.d/upgrade.last.sh | 4 ++-- 10 files changed, 126 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 83e2e54..2a25708 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to own data. A personal cloud which run on your own server. With Nextcloud you can synchronize your files over your devices. -**Shipped version:** 15.0.2 +**Shipped version:** 15.0.4 ## Screenshots diff --git a/conf/nginx.conf b/conf/nginx.conf index ba6c554..1170d66 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -16,13 +16,13 @@ location ^~ __PATH__ { } # Add headers to serve security related headers - add_header Strict-Transport-Security "max-age=15768000;"; - add_header X-Content-Type-Options nosniff; - add_header X-XSS-Protection "1; mode=block"; - add_header X-Robots-Tag none; - add_header X-Download-Options noopen; - add_header X-Permitted-Cross-Domain-Policies none; - add_header Referrer-Policy no-referrer; + more_set_headers "Strict-Transport-Security: max-age=15768000"; + more_set_headers "X-Content-Type-Options: nosniff"; + more_set_headers "X-XSS-Protection: 1; mode=block"; + more_set_headers "X-Robots-Tag: none"; + more_set_headers "X-Download-Options: noopen"; + more_set_headers "X-Permitted-Cross-Domain-Policies: none"; + more_set_headers "Referrer-Policy: no-referrer"; # Set max upload size client_max_body_size 10G; @@ -81,15 +81,15 @@ location ^~ __PATH__ { # Adding the cache control header for js and css files location ~* \.(?:css|js)$ { - add_header Cache-Control "public, max-age=7200"; + more_set_headers "Cache-Control: public, max-age=7200"; # Add headers to serve security related headers - add_header Strict-Transport-Security "max-age=15768000;"; - add_header X-Content-Type-Options nosniff; - add_header X-XSS-Protection "1; mode=block"; - add_header X-Robots-Tag none; - add_header X-Download-Options noopen; - add_header X-Permitted-Cross-Domain-Policies none; - add_header Referrer-Policy no-referrer; + more_set_headers "Strict-Transport-Security: max-age=15768000"; + more_set_headers "X-Content-Type-Options: nosniff"; + more_set_headers "X-XSS-Protection: 1; mode=block"; + more_set_headers "X-Robots-Tag: none"; + more_set_headers "X-Download-Options: noopen"; + more_set_headers "X-Permitted-Cross-Domain-Policies: none"; + more_set_headers "Referrer-Policy: no-referrer"; # Optional: Don't log access to assets access_log off; diff --git a/manifest.json b/manifest.json index f0197d9..a146c94 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Access & share your files, calendars, contacts, mail & more from any device, on your terms", "fr": "Consultez et partagez vos fichiers, agendas, carnets d'adresses, emails et bien plus depuis les appareils de votre choix, sous vos conditions" }, - "version": "15.0.2~ynh1", + "version": "15.0.4~ynh2", "url": "https://nextcloud.com", "license": "AGPL-3.0", "maintainer": { diff --git a/scripts/_common.sh b/scripts/_common.sh index 9301891..2529d02 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -275,6 +275,31 @@ ynh_handle_app_migration () { fi } +ynh_smart_mktemp () { + local min_size="${1:-300}" + # Transform the minimum size from megabytes to kilobytes + min_size=$(( $min_size * 1024 )) + + # Check if there's enough free space in a directory + is_there_enough_space () { + local free_space=$(df --output=avail "$1" | sed 1d) + test $free_space -ge $min_size + } + + if is_there_enough_space /tmp; then + local tmpdir=/tmp + elif is_there_enough_space /var; then + local tmpdir=/var + elif is_there_enough_space /; then + local tmpdir=/ + elif is_there_enough_space /home; then + local tmpdir=/home + else + ynh_die "Insufficient free space to continue..." + fi + + echo "$(sudo mktemp --directory --tmpdir="$tmpdir")" +} #================================================= # FUTURE OFFICIAL HELPERS diff --git a/scripts/backup b/scripts/backup index 67f05ce..f548f90 100755 --- a/scripts/backup +++ b/scripts/backup @@ -19,6 +19,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= +ynh_print_info "Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -31,24 +32,28 @@ db_name=$(ynh_app_setting_get $app db_name) #================================================= # BACKUP THE APP MAIN DIR #================================================= +ynh_print_info "Backing up the main app directory..." ynh_backup "$final_path" #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= +ynh_print_info "Backing up nginx web server configuration..." ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # BACKUP THE PHP-FPM CONFIGURATION #================================================= +ynh_print_info "Backing up php-fpm configuration..." ynh_backup "/etc/php/7.0/fpm/pool.d/$app.conf" #================================================= # BACKUP THE MYSQL DATABASE #================================================= +ynh_print_info "Backing up the MySQL database..." ynh_mysql_dump_db "$db_name" > db.sql @@ -57,6 +62,7 @@ ynh_mysql_dump_db "$db_name" > db.sql #================================================= # BACKUP LOGROTATE #================================================= +ynh_print_info "Backing up logrotate configuration..." ynh_backup "/etc/logrotate.d/$app" @@ -69,8 +75,15 @@ ynh_backup "/etc/cron.d/$app" #================================================= # BACKUP THE DATA DIRECTORY #================================================= +ynh_print_info "Backing up data directory..." # The 1 parameter indicates the directory is "big", # so that it won't be backed up before upgrade # This argument has to be the third one. ynh_backup "/home/yunohost.app/${app}/data" "/home/yunohost.app/${app}/data" 1 + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/install b/scripts/install index 2c301c0..0f66303 100755 --- a/scripts/install +++ b/scripts/install @@ -30,6 +30,7 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= +ynh_print_info "Validating installation parameters..." final_path=/var/www/$app test ! -e "$final_path" || ynh_die "This path already contains a folder" @@ -43,6 +44,7 @@ ynh_webpath_register $app $domain $path_url #================================================= # STORE SETTINGS FROM MANIFEST #================================================= +ynh_print_info "Storing installation settings..." ynh_app_setting_set $app domain $domain ynh_app_setting_set $app path $path_url @@ -54,12 +56,14 @@ ynh_app_setting_set $app user_home $user_home #================================================= # INSTALL DEPENDENCIES #================================================= +ynh_print_info "Installing dependencies..." ynh_install_app_dependencies $pkg_dependencies #================================================= # CREATE A MYSQL DATABASE #================================================= +ynh_print_info "Creating a MySQL database..." db_name=$(ynh_sanitize_dbid $app) ynh_app_setting_set $app db_name $db_name @@ -68,6 +72,7 @@ ynh_mysql_setup_db $db_name $db_name #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= +ynh_print_info "Setting up source files..." # Load the last available version source upgrade.d/upgrade.last.sh @@ -85,6 +90,7 @@ ynh_setup_source "$final_path" #================================================= # NGINX CONFIGURATION #================================================= +ynh_print_info "Configuring nginx web server..." # Do not serve .well-known if it's already served on the domain if is_url_handled "https://$domain/.well-known/caldav" ; then @@ -98,6 +104,7 @@ ynh_add_nginx_config #================================================= # CREATE DEDICATED USER #================================================= +ynh_print_info "Configuring system user..." # Create a system user ynh_system_user_create $app @@ -105,6 +112,7 @@ ynh_system_user_create $app #================================================= # PHP-FPM CONFIGURATION #================================================= +ynh_print_info "Configuring php-fpm..." # Create a dedicated php-fpm config ynh_add_fpm_config @@ -123,6 +131,7 @@ mkdir -p "$datadir" #================================================= # INSTALL NEXTCLOUD #================================================= +ynh_print_info "Installing nextcloud..." # Define a function to execute commands with `occ` exec_occ() { @@ -144,6 +153,7 @@ exec_occ maintenance:install \ #================================================= # CONFIGURE NEXTCLOUD #================================================= +ynh_print_info "Configuring nextcloud..." # Ensure that UpdateNotification app is disabled exec_occ app:disable updatenotification @@ -268,6 +278,7 @@ ynh_replace_string "__GROUP__" "$app" ../hooks/post_user_create #================================================= # YUNOHOST MULTIMEDIA INTEGRATION #================================================= +ynh_print_info "Adding multimedia directories..." # Build YunoHost multimedia directories ynh_multimedia_build_main_dir @@ -296,6 +307,7 @@ chmod 755 /home/yunohost.app #================================================= # SETUP LOGROTATE #================================================= +ynh_print_info "Configuring log rotation..." # Use logrotate to manage application logfile(s) ynh_use_logrotate "$datadir/nextcloud.log" @@ -303,6 +315,7 @@ ynh_use_logrotate "$datadir/nextcloud.log" #================================================= # SETUP SSOWAT #================================================= +ynh_print_info "Configuring SSOwat..." ynh_app_setting_set $app unprotected_uris "/" ynh_app_setting_set $app skipped_regex \ @@ -311,5 +324,12 @@ ynh_app_setting_set $app skipped_regex \ #================================================= # RELOAD NGINX #================================================= +ynh_print_info "Reloading nginx web server..." systemctl reload nginx + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_print_info "Installation of $app completed" diff --git a/scripts/remove b/scripts/remove index 907a7e7..de10894 100755 --- a/scripts/remove +++ b/scripts/remove @@ -12,6 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= +ynh_print_info "Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -24,6 +25,7 @@ final_path=$(ynh_app_setting_get $app final_path) #================================================= # REMOVE DEPENDENCIES #================================================= +ynh_print_info "Removing dependencies" # Remove metapackage and its dependencies ynh_remove_app_dependencies @@ -31,6 +33,7 @@ ynh_remove_app_dependencies #================================================= # REMOVE THE MYSQL DATABASE #================================================= +ynh_print_info "Removing the MySQL database" # Remove a database if it exists, along with the associated user ynh_mysql_remove_db $db_name $db_name @@ -38,6 +41,7 @@ ynh_mysql_remove_db $db_name $db_name #================================================= # REMOVE APP MAIN DIR #================================================= +ynh_print_info "Removing app main directory" # Remove the app directory securely ynh_secure_remove "$final_path" @@ -45,6 +49,7 @@ ynh_secure_remove "$final_path" #================================================= # REMOVE NGINX CONFIGURATION #================================================= +ynh_print_info "Removing nginx web server configuration" # Remove the dedicated nginx config ynh_remove_nginx_config @@ -52,6 +57,7 @@ ynh_remove_nginx_config #================================================= # REMOVE PHP-FPM CONFIGURATION #================================================= +ynh_print_info "Removing php-fpm configuration" # Remove the dedicated php-fpm config ynh_remove_fpm_config @@ -59,6 +65,7 @@ ynh_remove_fpm_config #================================================= # REMOVE LOGROTATE CONFIGURATION #================================================= +ynh_print_info "Removing logrotate configuration" # Remove the app-specific logrotate config ynh_remove_logrotate @@ -88,6 +95,13 @@ done #================================================= # REMOVE DEDICATED USER #================================================= +ynh_print_info "Removing the dedicated system user" # Delete a system user ynh_system_user_delete $app + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_print_info "Removal of $app completed" diff --git a/scripts/restore b/scripts/restore index 1a2209c..b077fea 100755 --- a/scripts/restore +++ b/scripts/restore @@ -19,6 +19,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= +ynh_print_info "Loading settings..." app=$YNH_APP_INSTANCE_NAME @@ -30,6 +31,7 @@ db_name=$(ynh_app_setting_get $app db_name) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= +ynh_print_info "Validating restoration parameters..." ynh_webpath_available $domain $path_url \ || ynh_die "Path not available: ${domain}${path_url}" @@ -47,12 +49,14 @@ ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE THE APP MAIN DIR #================================================= +ynh_print_info "Restoring the app main directory..." ynh_restore_file "$final_path" #================================================= # RESTORE THE MYSQL DATABASE #================================================= +ynh_print_info "Restoring the MySQL database..." db_pwd=$(ynh_app_setting_get $app mysqlpwd) ynh_mysql_setup_db $db_name $db_name $db_pwd @@ -61,6 +65,7 @@ ynh_mysql_connect_as $db_name $db_pwd $db_name < ./db.sql #================================================= # RECREATE THE DEDICATED USER #================================================= +ynh_print_info "Recreating the dedicated system user..." # Create the dedicated user (if not existing) ynh_system_user_create $app @@ -76,6 +81,7 @@ ynh_restore_file "/etc/php/7.0/fpm/pool.d/$app.conf" #================================================= # REINSTALL DEPENDENCIES #================================================= +ynh_print_info "Reinstalling dependencies..." # Define and install dependencies ynh_install_app_dependencies $pkg_dependencies @@ -95,6 +101,7 @@ ynh_restore_file "/etc/logrotate.d/$app" #================================================= # RESTORE THE DATA DIRECTORY #================================================= +ynh_print_info "Restoring data directory..." datadir="/home/yunohost.app/$app/data" @@ -127,6 +134,7 @@ done #================================================= # YUNOHOST MULTIMEDIA INTEGRATION #================================================= +ynh_print_info "Adding multimedia directories..." # Build YunoHost multimedia directories ynh_multimedia_build_main_dir @@ -138,6 +146,13 @@ ynh_multimedia_addaccess $app #================================================= # RELOAD NGINX AND PHP-FPM #================================================= +ynh_print_info "Reloading nginx web server and php-fpm..." systemctl reload php7.0-fpm systemctl reload nginx + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_print_info "Restoration completed for $app" diff --git a/scripts/upgrade b/scripts/upgrade index 78bdce9..064d446 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,6 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= +ynh_print_info "Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -25,6 +26,7 @@ user_home=$(ynh_app_setting_get $app user_home) #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= +ynh_print_info "Ensuring downward compatibility..." # If db_name doesn't exist, create it if [ -z $db_name ]; then @@ -44,6 +46,7 @@ ynh_app_setting_delete $app backup_core_only #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= +ynh_print_info "Backing up the app before upgrading (may take a while)..." # Made a backup only after the version 11.0.0 # Before, the datas will be always saved. @@ -104,6 +107,7 @@ path_url=$(ynh_normalize_url_path $path_url) #================================================= # NGINX CONFIGURATION #================================================= +ynh_print_info "Upgrading nginx web server configuration..." ynh_backup_if_checksum_is_different "/etc/nginx/conf.d/$domain.d/$app.conf" @@ -123,6 +127,7 @@ ynh_add_nginx_config #================================================= # CREATE DEDICATED USER #================================================= +ynh_print_info "Making sure dedicated system user exists..." # Create a dedicated user (if not existing) ynh_system_user_create $app @@ -130,6 +135,7 @@ ynh_system_user_create $app #================================================= # PHP-FPM CONFIGURATION #================================================= +ynh_print_info "Upgrading php-fpm configuration..." # Create a dedicated php-fpm config ynh_add_fpm_config @@ -137,6 +143,7 @@ ynh_add_fpm_config #================================================= # UPGRADE DEPENDENCIES #================================================= +ynh_print_info "Upgrading dependencies..." ynh_install_app_dependencies $pkg_dependencies @@ -195,7 +202,7 @@ do ynh_replace_string "__SHA256_SUM__" "$nextcloud_source_sha256" "../conf/app.src" # Create a temporary directory - tmpdir=$(mktemp -d) + tmpdir="$(ynh_smart_mktemp 300)" # Install the next nextcloud version in $tmpdir ynh_setup_source "$tmpdir" @@ -214,6 +221,7 @@ do # Replace the old nextcloud by the new one ynh_secure_remove "$final_path" mv "$tmpdir" "$final_path" + ynh_secure_remove "$tmpdir" # Set write access for the following commands chown -R $app: "$final_path" "$datadir" @@ -234,6 +242,7 @@ done #================================================= # CONFIGURE NEXTCLOUD #================================================= +ynh_print_info "Reconfiguring nextcloud..." # Verify the checksum and backup the file if it's different ynh_backup_if_checksum_is_different "$final_path/config/config.php" @@ -329,6 +338,7 @@ ynh_replace_string "__GROUP__" "$app" ../hooks/post_user_create #================================================= # YUNOHOST MULTIMEDIA INTEGRATION #================================================= +ynh_print_info "Updating multimedia directories..." # Build YunoHost multimedia directories ynh_multimedia_build_main_dir @@ -365,6 +375,7 @@ they are probably disabled and you'll have to manually enable them again." #================================================= # SETUP LOGROTATE #================================================= +ynh_print_info "Upgrading logrotate configuration..." # Use logrotate to manage app-specific logfile(s) ynh_use_logrotate --non-append @@ -374,6 +385,7 @@ ynh_use_logrotate --non-append #================================================= # SETUP SSOWAT #================================================= +ynh_print_info "Upgrading SSOwat configuration..." ynh_app_setting_set $app unprotected_uris "/" ynh_app_setting_set $app skipped_regex \ @@ -382,6 +394,7 @@ ynh_app_setting_set $app skipped_regex \ #================================================= # RELOAD NGINX #================================================= +ynh_print_info "Reloading nginx web server..." systemctl reload nginx @@ -405,3 +418,9 @@ you don't see Nextcloud as installed." 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 +#================================================= + +ynh_print_info "Upgrade of $app completed" diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index 1a77d52..80d65dd 100755 --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -1,10 +1,10 @@ #!/bin/bash # Last available nextcloud version -next_version="15.0.2" +next_version="15.0.4" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="c1f4cc33e39994ddbe6777370b62c30b7ae52136a0530c0b9922770803ca0fea" +nextcloud_source_sha256="f87db047c174f563e391a22c959d9ace767ca14ef0f97fc394f3061fc63d8f77" # This function will only be executed upon applying the last upgrade referenced above last_upgrade_operations () { From 3b16063a827fc22cc3084cc6fa0bcf8936624136 Mon Sep 17 00:00:00 2001 From: "ljf (zamentur)" Date: Tue, 26 Feb 2019 00:33:35 +0100 Subject: [PATCH 041/204] [fix] Copy only app missing in new apps dir --- scripts/upgrade | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/upgrade b/scripts/upgrade index d58f4b0..57add37 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -205,6 +205,7 @@ do # Backup 3rd party applications from the current nextcloud # But do not overwrite if there is any upgrade # (apps directory already exists in Nextcloud archive) + touch -t 197001010000 $final_path/apps/* cp -a --update "$final_path/apps" "$tmpdir" # Replace the old nextcloud by the new one From c71a444a946751fd658a4bb25841b617870d3fc4 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 26 Feb 2019 00:57:24 +0100 Subject: [PATCH 042/204] [fix] Use the old owncloud method to copy apps dir --- scripts/upgrade | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 57add37..06ea0ff 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -49,7 +49,7 @@ fi current_version=$(grep OC_VersionString "$final_path/version.php" | cut -d\' -f2) current_major_version=${current_version%%.*} -if [ $current_major_version -gt 11 ] +if [ $current_major_version -gt 15 ] then # Inform the backup/restore process that it should not save the data directory ynh_app_setting_set $app backup_core_only 1 @@ -205,8 +205,10 @@ do # Backup 3rd party applications from the current nextcloud # But do not overwrite if there is any upgrade # (apps directory already exists in Nextcloud archive) - touch -t 197001010000 $final_path/apps/* - cp -a --update "$final_path/apps" "$tmpdir" + for nc_app_dir in $(sudo ls "${final_path}/apps"); do + [[ ! -d "${tmpdir}/apps/${nc_app_dir}" ]] \ + && cp -a "${final_path}/apps/${nc_app_dir}" "${tmpdir}/apps/${nc_app_dir}" + done # Replace the old nextcloud by the new one ynh_secure_remove "$final_path" From 15f6eb637f7d413906ae4e149c6313c6226b4ef9 Mon Sep 17 00:00:00 2001 From: "ljf (zamentur)" Date: Tue, 26 Feb 2019 00:58:36 +0100 Subject: [PATCH 043/204] [fix] Reset backup on 12 and later version --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 06ea0ff..2d54c82 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -49,7 +49,7 @@ fi current_version=$(grep OC_VersionString "$final_path/version.php" | cut -d\' -f2) current_major_version=${current_version%%.*} -if [ $current_major_version -gt 15 ] +if [ $current_major_version -gt 11 ] then # Inform the backup/restore process that it should not save the data directory ynh_app_setting_set $app backup_core_only 1 From 8bee85518de978e41cec1456dbeb8ac0978708df Mon Sep 17 00:00:00 2001 From: "ljf (zamentur)" Date: Thu, 28 Feb 2019 18:05:10 +0100 Subject: [PATCH 044/204] [enh] Remove sudo and double brackets --- scripts/upgrade | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 2d54c82..e83811c 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -205,8 +205,8 @@ do # Backup 3rd party applications from the current nextcloud # But do not overwrite if there is any upgrade # (apps directory already exists in Nextcloud archive) - for nc_app_dir in $(sudo ls "${final_path}/apps"); do - [[ ! -d "${tmpdir}/apps/${nc_app_dir}" ]] \ + for nc_app_dir in $(ls "${final_path}/apps"); do + [ ! -d "${tmpdir}/apps/${nc_app_dir}" ] \ && cp -a "${final_path}/apps/${nc_app_dir}" "${tmpdir}/apps/${nc_app_dir}" done From 445e8d2a69ec78946a8e20704bfa1be1db07619b Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Sat, 2 Mar 2019 12:17:15 +0100 Subject: [PATCH 045/204] Upgrade to upstream version 15.0.5 --- README.md | 2 +- manifest.json | 2 +- scripts/upgrade.d/upgrade.last.sh | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 865fc0c..728a8a9 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Nextcloud for YunoHost own data. A personal cloud which run on your own server. With Nextcloud you can synchronize your files over your devices. -**Shipped version:** 15.0.4 +**Shipped version:** 15.0.5 [![Install Nextcloud with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=nextcloud) ![](https://raw.githubusercontent.com/nextcloud/screenshots/master/files/Files%20Overview.png) diff --git a/manifest.json b/manifest.json index 43bf976..77642da 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Access & share your files, calendars, contacts, mail & more from any device, on your terms", "fr": "Consultez et partagez vos fichiers, agendas, carnets d'adresses, emails et bien plus depuis les appareils de votre choix, sous vos conditions" }, - "version": "15.0.4~ynh1", + "version": "15.0.5~ynh1", "url": "https://nextcloud.com", "license": "AGPL-3.0", "maintainer": { diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index 80d65dd..e66bb23 100755 --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -1,10 +1,10 @@ #!/bin/bash # Last available nextcloud version -next_version="15.0.4" +next_version="15.0.5" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="f87db047c174f563e391a22c959d9ace767ca14ef0f97fc394f3061fc63d8f77" +nextcloud_source_sha256="4661869b797a340cd967abb3dbe6931b375434e0a44480346a27ccd73250b988" # This function will only be executed upon applying the last upgrade referenced above last_upgrade_operations () { From 3dd34327ca32b7c962dd8c5869d900b0fca8aa29 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Sat, 2 Mar 2019 12:18:33 +0100 Subject: [PATCH 046/204] Update nginx configuration to latest Nextcloud recommendations --- conf/nginx.conf | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 2e085c9..7cdfd8f 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -13,7 +13,7 @@ location ^~ __PATH__ { } # Add headers to serve security related headers - more_set_headers "Strict-Transport-Security: max-age=15768000"; + more_set_headers "Strict-Transport-Security: max-age=15768000; includeSubDomains; preload;"; more_set_headers "X-Content-Type-Options: nosniff"; more_set_headers "X-XSS-Protection: 1; mode=block"; more_set_headers "X-Robots-Tag: none"; @@ -59,9 +59,9 @@ location ^~ __PATH__ { deny all; } - location ~ ^__PATH__/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+|core/templates/40[34])\.php(?:$|/) { + location ~ ^__PATH__/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+|ocm-provider/.+)\.php(/.*|)$ { include fastcgi_params; - fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_split_path_info ^(.+\.php)(/.*|)$; fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param HTTPS on; @@ -71,14 +71,15 @@ location ^~ __PATH__ { fastcgi_intercept_errors on; } - location ~ ^__PATH__/(?:updater|ocs-provider)(?:$|/) { + location ~ ^__PATH__/(?:updater|ocs-provider|ocm-provider)(?:$|/) { try_files $uri/ =404; index index.php; } # Adding the cache control header for js and css files - location ~* \.(?:css|js)$ { - more_set_headers "Cache-Control: public, max-age=7200"; + location ~ ^__PATH__/.+[^/]\.(?:css|js|woff2?|svg|gif)$ { + try_files $uri __PATH__/index.php$request_uri; + more_set_headers "Cache-Control: public, max-age=15778463"; # Add headers to serve security related headers more_set_headers "Strict-Transport-Security: max-age=15768000"; more_set_headers "X-Content-Type-Options: nosniff"; @@ -92,7 +93,7 @@ location ^~ __PATH__ { access_log off; } - location ~* \.(?:svg|gif|png|html|ttf|woff|ico|jpg|jpeg)$ { + location ~* \.(?:png|html|ttf|ico|jpg|jpeg)$ { # Optional: Don't log access to other assets access_log off; } From 0719c177b821312275e25395a3250fd768cf655c Mon Sep 17 00:00:00 2001 From: JimboJoe Date: Tue, 5 Mar 2019 15:37:07 +0100 Subject: [PATCH 047/204] Update scripts/install Co-Authored-By: maniackcrudelis --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 0f66303..19863c4 100755 --- a/scripts/install +++ b/scripts/install @@ -158,7 +158,7 @@ ynh_print_info "Configuring nextcloud..." # Ensure that UpdateNotification app is disabled exec_occ app:disable updatenotification -# Enable ldap plugins +# Enable ldap plugin exec_occ app:enable user_ldap exec_occ ldap:create-empty-config From b7e16f813971dfcba932ab2c8608d2b00976e99d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Martin?= Date: Thu, 7 Mar 2019 10:16:56 +0100 Subject: [PATCH 048/204] change server name in notify --- scripts/install | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/install b/scripts/install index 5bc37bf..cc61767 100755 --- a/scripts/install +++ b/scripts/install @@ -205,6 +205,11 @@ exec_occ config:system:get logout_url >/dev/null 2>&1 \ //-YunoHost- " >> "${final_path}/config/config.php" +#================================================= +# CHANGE HOSTNAME FOR ACTIVITY NOTIFICATIONS +#================================================= +ynh_replace_string "'overwrite.cli.url' => 'http://localhost'," "'overwrite.cli.url' => 'https://${domain}'," "${final_path}/config/config.php" + #================================================= # REMOVE THE TEMPORARY ADMIN AND SET THE TRUE ONE #================================================= From 46c496c6de9a13cc5f1cefbb9bad0197d71db13e Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Thu, 7 Mar 2019 11:51:14 +0100 Subject: [PATCH 049/204] Update install --- scripts/install | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install b/scripts/install index cc61767..a2fc1d9 100755 --- a/scripts/install +++ b/scripts/install @@ -208,6 +208,7 @@ exec_occ config:system:get logout_url >/dev/null 2>&1 \ #================================================= # CHANGE HOSTNAME FOR ACTIVITY NOTIFICATIONS #================================================= + ynh_replace_string "'overwrite.cli.url' => 'http://localhost'," "'overwrite.cli.url' => 'https://${domain}'," "${final_path}/config/config.php" #================================================= From ee0d5457a19d37b15f0640ba27123b4ebb54e9c3 Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Thu, 7 Mar 2019 11:55:02 +0100 Subject: [PATCH 050/204] Modify upgrade script as well --- scripts/upgrade | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index d58f4b0..c56fc18 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -265,6 +265,12 @@ exec_occ config:system:get logout_url >/dev/null 2>&1 \ //-YunoHost- " >> "${final_path}/config/config.php" +#================================================= +# CHANGE HOSTNAME FOR ACTIVITY NOTIFICATIONS +#================================================= + +ynh_replace_string "'overwrite.cli.url' => 'http://localhost'," "'overwrite.cli.url' => 'https://${domain}'," "${final_path}/config/config.php" + #================================================= # MOUNT HOME FOLDERS AS EXTERNAL STORAGE #================================================= From 567e54289aedcc545d4e4732678e433cbbecf1a6 Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Thu, 7 Mar 2019 12:04:27 +0100 Subject: [PATCH 051/204] Keep the code clear and simple... --- scripts/upgrade | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index e83811c..16e3a74 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -205,9 +205,12 @@ do # Backup 3rd party applications from the current nextcloud # But do not overwrite if there is any upgrade # (apps directory already exists in Nextcloud archive) - for nc_app_dir in $(ls "${final_path}/apps"); do - [ ! -d "${tmpdir}/apps/${nc_app_dir}" ] \ - && cp -a "${final_path}/apps/${nc_app_dir}" "${tmpdir}/apps/${nc_app_dir}" + for nc_app_dir in "$(ls "$final_path/apps")" + do + if [ ! -d "$tmpdir/apps/$nc_app_dir" ] + then + cp -a "$final_path/apps/$nc_app_dir" "$tmpdir/apps/$nc_app_dir" + fi done # Replace the old nextcloud by the new one From c064770589db237a8a493dcdb89dc3b9289e89f5 Mon Sep 17 00:00:00 2001 From: JimboJoe Date: Sun, 10 Mar 2019 13:10:08 +0100 Subject: [PATCH 052/204] Update manifest.json Co-Authored-By: maniackcrudelis --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index a146c94..76e3273 100644 --- a/manifest.json +++ b/manifest.json @@ -14,7 +14,7 @@ "email": "apps@yunohost.org" }, "requirements": { - "yunohost": ">= 3.0" + "yunohost": ">= 3.2.0" }, "multi_instance": true, "services": [ From bb0c7fe1e6479cc41dee48b61e6de6a9ebef1b16 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Sat, 16 Mar 2019 19:27:23 +0100 Subject: [PATCH 053/204] Add change_url feature --- check_process | 2 +- scripts/change_url | 118 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 119 insertions(+), 1 deletion(-) create mode 100644 scripts/change_url diff --git a/check_process b/check_process index 1741c5c..486960d 100644 --- a/check_process +++ b/check_process @@ -17,7 +17,7 @@ multi_instance=1 incorrect_path=1 port_already_use=0 - change_url=0 + change_url=1 ;;; Levels Level 1=auto Level 2=auto diff --git a/scripts/change_url b/scripts/change_url new file mode 100644 index 0000000..f645daf --- /dev/null +++ b/scripts/change_url @@ -0,0 +1,118 @@ +#!/bin/bash + +#================================================= +# GENERIC STARTING +#================================================= +# IMPORT GENERIC HELPERS +#================================================= + +source _common.sh +source /usr/share/yunohost/helpers + +#================================================= +# RETRIEVE ARGUMENTS +#================================================= + +old_domain=$YNH_APP_OLD_DOMAIN +old_path=$YNH_APP_OLD_PATH + +new_domain=$YNH_APP_NEW_DOMAIN +new_path=$YNH_APP_NEW_PATH + +app=$YNH_APP_INSTANCE_NAME + +#================================================= +# LOAD SETTINGS +#================================================= +ynh_print_info "Loading installation settings..." + +# Needed for helper "ynh_add_nginx_config" +final_path=$(ynh_app_setting_get $app final_path) + +# Add settings here as needed by your application +#db_name=$(ynh_app_setting_get "$app" db_name) +#db_pwd=$(ynh_app_setting_get $app db_pwd) + +#================================================= +# CHECK WHICH PARTS SHOULD BE CHANGED +#================================================= + +change_domain=0 +if [ "$old_domain" != "$new_domain" ] +then + change_domain=1 +fi + +change_path=0 +if [ "$old_path" != "$new_path" ] +then + change_path=1 +fi + +#================================================= +# STANDARD MODIFICATIONS +#================================================= +# MODIFY URL IN NGINX CONF +#================================================= +ynh_print_info "Updating nginx web server configuration..." + +nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf + +# Change the path in the nginx config file +if [ $change_path -eq 1 ] +then + # Make a backup of the original nginx config file if modified + ynh_backup_if_checksum_is_different "$nginx_conf_path" + # Set global variables for nginx helper + domain="$old_domain" + path_url="$new_path" + # Create a dedicated nginx config + ynh_add_nginx_config +fi + +# Change the domain for nginx +if [ $change_domain -eq 1 ] +then + # Delete file checksum for the old conf file location + ynh_delete_file_checksum "$nginx_conf_path" + mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf + # Store file checksum for the new config file location + ynh_store_file_checksum "/etc/nginx/conf.d/$new_domain.d/$app.conf" +fi + +#================================================= +# SPECIFIC MODIFICATIONS +#================================================= +ynh_print_info "Applying Nextcloud specific modifications..." + +# Define a function to execute commands with `occ` +exec_occ() { + (cd "$final_path" && exec_as "$app" \ + php occ --no-interaction --no-ansi "$@") +} + +if [ $change_domain -eq 1 ] +then + # Change the trusted domain + exec_occ config:system:set trusted_domains 1 --value=${new_domain} + + # Change hostname for activity notifications + ynh_replace_string "'overwrite.cli.url' => 'http://${old_domain}'," "'overwrite.cli.url' => 'https://${new_domain}'," "${final_path}/config/config.php" +fi + +#================================================= + +#================================================= +# GENERIC FINALISATION +#================================================= +# RELOAD NGINX +#================================================= +ynh_print_info "Reloading nginx web server..." + +systemctl reload nginx + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_print_info "Change of URL completed for $app" From e8349d8dc9d919e7577deaf06364f54bb0e14e14 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Sun, 17 Mar 2019 12:43:11 +0100 Subject: [PATCH 054/204] Fix apps directory parsing --- scripts/upgrade | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/upgrade b/scripts/upgrade index 16e3a74..ef3e1e0 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -206,6 +206,7 @@ do # But do not overwrite if there is any upgrade # (apps directory already exists in Nextcloud archive) for nc_app_dir in "$(ls "$final_path/apps")" + for nc_app_dir in "$(ls -1 "$final_path/apps")" do if [ ! -d "$tmpdir/apps/$nc_app_dir" ] then From 3e1f3c2bc1dc5cdb2ae4ce0e65285f02d740d279 Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Sun, 17 Mar 2019 12:53:33 +0100 Subject: [PATCH 055/204] Duplicated 'for' --- scripts/upgrade | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index ef3e1e0..e4a97f3 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -205,7 +205,6 @@ do # Backup 3rd party applications from the current nextcloud # But do not overwrite if there is any upgrade # (apps directory already exists in Nextcloud archive) - for nc_app_dir in "$(ls "$final_path/apps")" for nc_app_dir in "$(ls -1 "$final_path/apps")" do if [ ! -d "$tmpdir/apps/$nc_app_dir" ] From cc08c702240e0ff8ff35abcf0590e928a47323bf Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Wed, 20 Mar 2019 20:22:37 +0100 Subject: [PATCH 056/204] Quickfix for path traversal issue --- conf/nginx.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 2e085c9..a416de2 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -6,7 +6,7 @@ location = /.well-known/caldav { } location ^~ __PATH__ { - alias __FINALPATH__/; + alias __FINALPATH__; if ($scheme = http) { rewrite ^ https://$server_name$request_uri? permanent; From 0be7e16d743ce501dd53ff9fdca203c06595a502 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Wed, 20 Mar 2019 20:56:17 +0100 Subject: [PATCH 057/204] Add `/` at the end of the location + add rewrite rule --- conf/nginx.conf | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index a416de2..6b18d36 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -5,8 +5,9 @@ location = /.well-known/caldav { return 301 https://$server_name__PATH__/remote.php/dav; } -location ^~ __PATH__ { - alias __FINALPATH__; +#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; +location ^~ __PATH__/ { + alias __FINALPATH__/; if ($scheme = http) { rewrite ^ https://$server_name$request_uri? permanent; @@ -42,7 +43,7 @@ location ^~ __PATH__ { #rewrite ^/.well-known/host-meta __PATH__/public.php?service=host-meta last; #rewrite ^/.well-known/host-meta.json __PATH__/public.php?service=host-meta-json last; - location __PATH__ { + location __PATH__/ { rewrite ^ __PATH__/index.php$request_uri; } From 6944dac81a382a2ae9aadd094865a03058442919 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Sat, 23 Mar 2019 21:27:02 +0100 Subject: [PATCH 058/204] Fix directory parsing --- scripts/upgrade | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index e4a97f3..774524c 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -205,13 +205,16 @@ do # Backup 3rd party applications from the current nextcloud # But do not overwrite if there is any upgrade # (apps directory already exists in Nextcloud archive) - for nc_app_dir in "$(ls -1 "$final_path/apps")" + ( + cd $final_path/apps + for nc_app_dir in */ do - if [ ! -d "$tmpdir/apps/$nc_app_dir" ] - then - cp -a "$final_path/apps/$nc_app_dir" "$tmpdir/apps/$nc_app_dir" - fi + if [ ! -d "$tmpdir/apps/$nc_app_dir" ] + then + cp -a "$nc_app_dir" "$tmpdir/apps/$nc_app_dir" + fi done + ) # Replace the old nextcloud by the new one ynh_secure_remove "$final_path" From 5ff310068fff6a8b91394e4874c7ec77b6e3f1b1 Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Sun, 24 Mar 2019 16:46:26 +0100 Subject: [PATCH 059/204] Update pull_request_template.md --- pull_request_template.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pull_request_template.md b/pull_request_template.md index 2342905..1301157 100644 --- a/pull_request_template.md +++ b/pull_request_template.md @@ -19,7 +19,6 @@ - [ ] **Approval (LGTM)** : - [ ] **Approval (LGTM)** : - **CI succeeded** : -[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/nextcloud_ynh%20-BRANCH-%20(Official)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/nextcloud_ynh%20-BRANCH-%20(Official)/) *Please replace '-BRANCH-' in this link for a PR from a local branch.* -or -[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/nextcloud_ynh%20PR-NUM-%20(Official_fork)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/nextcloud_ynh%20PR-NUM-%20(Official_fork)/) *Replace '-NUM-' by the PR number in this link for a PR from a forked repository.* +[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/nextcloud_ynh%20PR-NUM-/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/nextcloud_ynh%20PR-NUM-/) +*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. From 493172ea4dfc812518df575e6b18c982e31a3e7e Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Sun, 24 Mar 2019 22:57:40 +0100 Subject: [PATCH 060/204] Add fail2ban configuration --- manifest.json | 2 +- scripts/_common.sh | 160 ++++++++++++++++++++++++++++++++++++++++++++- scripts/backup | 8 +++ scripts/install | 8 +++ scripts/remove | 8 +++ scripts/restore | 17 +++++ scripts/upgrade | 8 +++ 7 files changed, 207 insertions(+), 4 deletions(-) diff --git a/manifest.json b/manifest.json index cd64223..b4b54e3 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Access & share your files, calendars, contacts, mail & more from any device, on your terms", "fr": "Consultez et partagez vos fichiers, agendas, carnets d'adresses, emails et bien plus depuis les appareils de votre choix, sous vos conditions" }, - "version": "15.0.5~ynh1", + "version": "15.0.5~ynh2", "url": "https://nextcloud.com", "license": "AGPL-3.0", "maintainer": { diff --git a/scripts/_common.sh b/scripts/_common.sh index 4a5a280..64f2467 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,6 +5,160 @@ pkg_dependencies="php-gd php-json php-intl php-mcrypt php-curl php-apcu php-redis php-ldap php-imagick php-zip php-mbstring php-xml imagemagick acl tar smbclient at" +#================================================= +# UNSTABLE HELPERS +#================================================= + +# Create a dedicated fail2ban config (jail and filter conf files) +# +# usage 1: ynh_add_fail2ban_config --logpath=log_file --failregex=filter [--max_retry=max_retry] [--ports=ports] +# | arg: -l, --logpath= - Log file to be checked by fail2ban +# | arg: -r, --failregex= - Failregex to be looked for by fail2ban +# | arg: -m, --max_retry= - Maximum number of retries allowed before banning IP address - default: 3 +# | arg: -p, --ports= - Ports blocked for a banned IP address - default: http,https +# +# ----------------------------------------------------------------------------- +# +# usage 2: ynh_add_fail2ban_config --use_template [--others_var="list of others variables to replace"] +# | arg: -t, --use_template - Use this helper in template mode +# | arg: -v, --others_var= - List of others variables to replace separeted by a space +# | for example : 'var_1 var_2 ...' +# +# This will use a template in ../conf/f2b_jail.conf and ../conf/f2b_filter.conf +# __APP__ by $app +# +# You can dynamically replace others variables by example : +# __VAR_1__ by $var_1 +# __VAR_2__ by $var_2 +# +# Generally your template will look like that by example (for synapse): +# +# f2b_jail.conf: +# [__APP__] +# enabled = true +# port = http,https +# filter = __APP__ +# logpath = /var/log/__APP__/logfile.log +# maxretry = 3 +# +# f2b_filter.conf: +# [INCLUDES] +# before = common.conf +# [Definition] +# +# # Part of regex definition (just used to make more easy to make the global regex) +# __synapse_start_line = .? \- synapse\..+ \- +# +# # Regex definition. +# failregex = ^%(__synapse_start_line)s INFO \- POST\-(\d+)\- \- \d+ \- Received request\: POST /_matrix/client/r0/login\??%(__synapse_start_line)s INFO \- POST\-\1\- Got login request with identifier: \{u'type': u'm.id.user', u'user'\: u'(.+?)'\}, medium\: None, address: None, user\: u'\5'%(__synapse_start_line)s WARNING \- \- (Attempted to login as @\5\:.+ but they do not exist|Failed password login for user @\5\:.+)$ +# +# ignoreregex = +# +# ----------------------------------------------------------------------------- +# +# Note about the "failregex" option: +# regex to match the password failure messages in the logfile. The +# host must be matched by a group named "host". The tag "" can +# be used for standard IP/hostname matching and is only an alias for +# (?:::f{4,6}:)?(?P[\w\-.^_]+) +# +# You can find some more explainations about how to make a regex here : +# https://www.fail2ban.org/wiki/index.php/MANUAL_0_8#Filters +# +# Note that the logfile need to exist before to call this helper !! +# +# To validate your regex you can test with this command: +# fail2ban-regex /var/log/YOUR_LOG_FILE_PATH /etc/fail2ban/filter.d/YOUR_APP.conf +# +# Requires YunoHost version 3.?.? or higher. +ynh_add_fail2ban_config () { + # Declare an array to define the options of this helper. + local legacy_args=lrmptv + declare -Ar args_array=( [l]=logpath= [r]=failregex= [m]=max_retry= [p]=ports= [t]=use_template [v]=others_var=) + local logpath + local failregex + local max_retry + local ports + local others_var + local use_template + # Manage arguments with getopts + ynh_handle_getopts_args "$@" + use_template="${use_template:-0}" + max_retry=${max_retry:-3} + ports=${ports:-http,https} + + finalfail2banjailconf="/etc/fail2ban/jail.d/$app.conf" + finalfail2banfilterconf="/etc/fail2ban/filter.d/$app.conf" + ynh_backup_if_checksum_is_different "$finalfail2banjailconf" + ynh_backup_if_checksum_is_different "$finalfail2banfilterconf" + + if [ $use_template -eq 1 ] + then + # Usage 2, templates + cp ../conf/f2b_jail.conf $finalfail2banjailconf + cp ../conf/f2b_filter.conf $finalfail2banfilterconf + + if [ -n "${app:-}" ] + then + ynh_replace_string "__APP__" "$app" "$finalfail2banjailconf" + ynh_replace_string "__APP__" "$app" "$finalfail2banfilterconf" + fi + + # Replace all other variable given as arguments + for var_to_replace in ${others_var:-}; do + # ${var_to_replace^^} make the content of the variable on upper-cases + # ${!var_to_replace} get the content of the variable named $var_to_replace + ynh_replace_string --match_string="__${var_to_replace^^}__" --replace_string="${!var_to_replace}" --target_file="$finalfail2banjailconf" + ynh_replace_string --match_string="__${var_to_replace^^}__" --replace_string="${!var_to_replace}" --target_file="$finalfail2banfilterconf" + done + + else + # Usage 1, no template. Build a config file from scratch. + test -n "$logpath" || ynh_die "ynh_add_fail2ban_config expects a logfile path as first argument and received nothing." + test -n "$failregex" || ynh_die "ynh_add_fail2ban_config expects a failure regex as second argument and received nothing." + + tee $finalfail2banjailconf < Date: Mon, 25 Mar 2019 19:52:08 +0100 Subject: [PATCH 061/204] Add ynh_systemd_action unstable helper --- scripts/_common.sh | 96 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) diff --git a/scripts/_common.sh b/scripts/_common.sh index 64f2467..1b4d782 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -9,6 +9,102 @@ pkg_dependencies="php-gd php-json php-intl php-mcrypt php-curl php-apcu php-redi # UNSTABLE HELPERS #================================================= +# Start (or other actions) a service, print a log in case of failure and optionnaly wait until the service is completely started +# +# usage: ynh_systemd_action [-n service_name] [-a action] [ [-l "line to match"] [-p log_path] [-t timeout] [-e length] ] +# | arg: -n, --service_name= - Name of the service to start. Default : $app +# | arg: -a, --action= - Action to perform with systemctl. Default: start +# | arg: -l, --line_match= - Line to match - The line to find in the log to attest the service have finished to boot. +# If not defined it don't wait until the service is completely started. +# WARNING: When using --line_match, you should always add `ynh_clean_check_starting` into your +# `ynh_clean_setup` at the beginning of the script. Otherwise, tail will not stop in case of failure +# of the script. The script will then hang forever. +# | arg: -p, --log_path= - Log file - Path to the log file. Default : /var/log/$app/$app.log +# | arg: -t, --timeout= - Timeout - The maximum time to wait before ending the watching. Default : 300 seconds. +# | arg: -e, --length= - Length of the error log : Default : 20 +ynh_systemd_action() { + # Declare an array to define the options of this helper. + declare -Ar args_array=( [n]=service_name= [a]=action= [l]=line_match= [p]=log_path= [t]=timeout= [e]=length= ) + local service_name + local action + local line_match + local length + local log_path + local timeout + + # Manage arguments with getopts + ynh_handle_getopts_args "$@" + + local service_name="${service_name:-$app}" + local action=${action:-start} + local log_path="${log_path:-/var/log/$service_name/$service_name.log}" + local length=${length:-20} + local timeout=${timeout:-300} + + # Start to read the log + if [[ -n "${line_match:-}" ]] + then + local templog="$(mktemp)" + # Following the starting of the app in its log + if [ "$log_path" == "systemd" ] ; then + # Read the systemd journal + journalctl --unit=$service_name --follow --since=-0 --quiet > "$templog" & + # Get the PID of the journalctl command + local pid_tail=$! + else + # Read the specified log file + tail -F -n0 "$log_path" > "$templog" 2>&1 & + # Get the PID of the tail command + local pid_tail=$! + fi + fi + + ynh_print_info --message="${action^} the service $service_name" + + # Use reload-or-restart instead of reload. So it wouldn't fail if the service isn't running. + if [ "$action" == "reload" ]; then + action="reload-or-restart" + fi + + systemctl $action $service_name \ + || ( journalctl --no-pager --lines=$length -u $service_name >&2 \ + ; test -e "$log_path" && echo "--" >&2 && tail --lines=$length "$log_path" >&2 \ + ; false ) + + # Start the timeout and try to find line_match + if [[ -n "${line_match:-}" ]] + then + local i=0 + for i in $(seq 1 $timeout) + do + # Read the log until the sentence is found, that means the app finished to start. Or run until the timeout + if grep --quiet "$line_match" "$templog" + then + ynh_print_info --message="The service $service_name has correctly started." + break + fi + if [ $i -eq 3 ]; then + echo -n "Please wait, the service $service_name is ${action}ing" >&2 + fi + if [ $i -ge 3 ]; then + echo -n "." >&2 + fi + sleep 1 + done + if [ $i -ge 3 ]; then + echo "" >&2 + fi + if [ $i -eq $timeout ] + then + ynh_print_warn --message="The service $service_name didn't fully started before the timeout." + ynh_print_warn --message="Please find here an extract of the end of the log of the service $service_name:" + journalctl --no-pager --lines=$length -u $service_name >&2 + test -e "$log_path" && echo "--" >&2 && tail --lines=$length "$log_path" >&2 + fi + ynh_clean_check_starting + fi +} + # Create a dedicated fail2ban config (jail and filter conf files) # # usage 1: ynh_add_fail2ban_config --logpath=log_file --failregex=filter [--max_retry=max_retry] [--ports=ports] From 3dc9ba202029a899e5aaeda13bded89ff7479eed Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Thu, 4 Apr 2019 16:22:36 +0200 Subject: [PATCH 062/204] [fix] Quick fix for backup_core_only feature with the old backup. --- scripts/upgrade | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index e6de161..6095a5a 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -56,8 +56,16 @@ current_major_version=${current_version%%.*} if [ $current_major_version -gt 11 ] then + # Inform the backup/restore process that it should not save the data directory + # Use only for the previous backup script that doesn't set 'is_big' + ynh_app_setting_set $app backup_core_only 1 + # Backup the current version of the app ynh_backup_before_upgrade + + # Remove the option backup_core_only after the backup. + ynh_app_setting_delete $app backup_core_only + ynh_clean_setup () { # Remove the post migration script before its execution ! ynh_secure_remove "/tmp/owncloud_post_migration.sh" 2>&1 From 4726c546f5d62fd0f2dd7f456c0435ba853a840f Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Thu, 4 Apr 2019 22:18:12 +0200 Subject: [PATCH 063/204] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index cd64223..b4b54e3 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Access & share your files, calendars, contacts, mail & more from any device, on your terms", "fr": "Consultez et partagez vos fichiers, agendas, carnets d'adresses, emails et bien plus depuis les appareils de votre choix, sous vos conditions" }, - "version": "15.0.5~ynh1", + "version": "15.0.5~ynh2", "url": "https://nextcloud.com", "license": "AGPL-3.0", "maintainer": { From acffd4cf383cf31c238fdec3244e8434655b6138 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Thu, 4 Apr 2019 22:28:24 +0200 Subject: [PATCH 064/204] Fix OPcache warnings --- conf/php-fpm.ini | 7 ------- scripts/upgrade | 4 ++++ 2 files changed, 4 insertions(+), 7 deletions(-) delete mode 100644 conf/php-fpm.ini diff --git a/conf/php-fpm.ini b/conf/php-fpm.ini deleted file mode 100644 index 104f242..0000000 --- a/conf/php-fpm.ini +++ /dev/null @@ -1,7 +0,0 @@ -opcache.enable=1 -opcache.enable_cli=1 -opcache.interned_strings_buffer=8 -opcache.max_accelerated_files=10000 -opcache.memory_consumption=128 -opcache.save_comments=1 -opcache.revalidate_freq=1 diff --git a/scripts/upgrade b/scripts/upgrade index d905f64..c600414 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -140,6 +140,10 @@ ynh_print_info "Upgrading php-fpm configuration..." # Create a dedicated php-fpm config ynh_add_fpm_config +# Delete existing ini configuration file (backward compatibility) +if [ -f /etc/php/7.0/fpm/conf.d/20-$app.ini ]; then + ynh_secure_remove /etc/php/7.0/fpm/conf.d/20-$app.ini +fi #================================================= # UPGRADE DEPENDENCIES #================================================= From 779173d6c4fb229d7cb0590be6a5f08c2f55c560 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Thu, 4 Apr 2019 22:28:53 +0200 Subject: [PATCH 065/204] Fix PATH warning --- conf/php-fpm.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf index 74825fa..60ddc95 100644 --- a/conf/php-fpm.conf +++ b/conf/php-fpm.conf @@ -392,7 +392,7 @@ chdir = __FINALPATH__ ;env[TMP] = /tmp ;env[TMPDIR] = /tmp ;env[TEMP] = /tmp - +env[PATH] = $PATH ; Additional php.ini defines, specific to this pool of workers. These settings ; overwrite the values previously defined in the php.ini. The directives are the ; same as the PHP SAPI: From 477391a2031bb6827910c1bc6a6a1feabbdfbdaf Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Thu, 4 Apr 2019 22:29:06 +0200 Subject: [PATCH 066/204] Fix always_populate_raw_post_data warning --- conf/php-fpm.conf | 1 - 1 file changed, 1 deletion(-) diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf index 60ddc95..f13ed6d 100644 --- a/conf/php-fpm.conf +++ b/conf/php-fpm.conf @@ -433,7 +433,6 @@ env[PATH] = $PATH php_value[upload_max_filesize] = 10G php_value[post_max_size] = 10G php_value[default_charset] = UTF-8 -php_value[always_populate_raw_post_data] = -1 php_value[opcache.enable]=1 php_value[opcache.enable_cli]=1 php_value[opcache.interned_strings_buffer]=8 From 2549f0ed40fe217907fc91386d4b4fb97d0aff5b Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Thu, 4 Apr 2019 22:29:43 +0200 Subject: [PATCH 067/204] Fix impossible upload via web interface --- conf/nginx.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 3159d95..6c5d7ec 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -65,7 +65,7 @@ location ^~ __PATH__/ { location ~ ^__PATH__/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+|ocm-provider/.+)\.php(/.*|)$ { include fastcgi_params; - fastcgi_split_path_info ^(.+\.php)(/.*|)$; + fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param HTTPS on; From 64088059de103e2b41bcce9d35e567d57be3fd39 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Thu, 4 Apr 2019 22:29:43 +0200 Subject: [PATCH 068/204] Fix impossible upload via web interface --- conf/nginx.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index b6e4498..52208c0 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -64,7 +64,7 @@ location ^~ __PATH__ { location ~ ^__PATH__/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+|ocm-provider/.+)\.php(/.*|)$ { include fastcgi_params; - fastcgi_split_path_info ^(.+\.php)(/.*|)$; + fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param HTTPS on; From a35a2457ce46ddc788e44062adf1ac8ada558b91 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sat, 6 Apr 2019 00:41:46 +0200 Subject: [PATCH 069/204] Update version number for hotfix about upload (also agreed with Maniack ... sorry folks for the yolocommit to master outside standard procedure :/) --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index b4b54e3..e132a8c 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Access & share your files, calendars, contacts, mail & more from any device, on your terms", "fr": "Consultez et partagez vos fichiers, agendas, carnets d'adresses, emails et bien plus depuis les appareils de votre choix, sous vos conditions" }, - "version": "15.0.5~ynh2", + "version": "15.0.5~ynh3", "url": "https://nextcloud.com", "license": "AGPL-3.0", "maintainer": { From 53929af2e27f2b9990873b104a646d43726a8623 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Wed, 10 Apr 2019 19:38:26 +0200 Subject: [PATCH 070/204] Upgrade to upstream version 15.0.7 --- README.md | 6 +++--- manifest.json | 2 +- scripts/upgrade.d/upgrade.last.sh | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 04b7f45..644bb7e 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to own data. A personal cloud which run on your own server. With Nextcloud you can synchronize your files over your devices. -**Shipped version:** 15.0.5 +**Shipped version:** 15.0.7 ## Screenshots @@ -81,10 +81,10 @@ 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 --verbose +sudo yunohost app upgrade -u https://github.com/YunoHost-Apps/nextcloud_ynh owncloud --debug ``` -The `--verbose` option will let you see the full output. If you encounter any +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 diff --git a/manifest.json b/manifest.json index b4b54e3..6919f99 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Access & share your files, calendars, contacts, mail & more from any device, on your terms", "fr": "Consultez et partagez vos fichiers, agendas, carnets d'adresses, emails et bien plus depuis les appareils de votre choix, sous vos conditions" }, - "version": "15.0.5~ynh2", + "version": "15.0.7~ynh1", "url": "https://nextcloud.com", "license": "AGPL-3.0", "maintainer": { diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index e66bb23..b576bdc 100755 --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -1,10 +1,10 @@ #!/bin/bash # Last available nextcloud version -next_version="15.0.5" +next_version="15.0.7" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="4661869b797a340cd967abb3dbe6931b375434e0a44480346a27ccd73250b988" +nextcloud_source_sha256="3e6158951fa72010ccd50dbeac05d8df162183f7bbc62a1c6c89ed7081fa9d49" # This function will only be executed upon applying the last upgrade referenced above last_upgrade_operations () { From a6ac80820dbc315cda93d5360ee48ea15181a038 Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Mon, 15 Apr 2019 20:55:42 +0200 Subject: [PATCH 071/204] Move from ci-apps-dev to ci-apps-hq --- pull_request_template.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pull_request_template.md b/pull_request_template.md index 1301157..da30b7b 100644 --- a/pull_request_template.md +++ b/pull_request_template.md @@ -19,6 +19,6 @@ - [ ] **Approval (LGTM)** : - [ ] **Approval (LGTM)** : - **CI succeeded** : -[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/nextcloud_ynh%20PR-NUM-/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/nextcloud_ynh%20PR-NUM-/) +[![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-/) *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. From 377037ce45d4e98d15a7bab1623415e592cca1eb Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Mon, 6 May 2019 01:11:18 +0200 Subject: [PATCH 072/204] Handle well-known conflict --- scripts/_common.sh | 33 +++++++++++++++++++++++++++++---- scripts/change_url | 13 +++++++++++++ scripts/install | 11 +++++++---- scripts/restore | 9 +++++++++ scripts/upgrade | 11 +++++++---- 5 files changed, 65 insertions(+), 12 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 1b4d782..d2e19d5 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -272,15 +272,40 @@ exec_as() { fi } +#================================================= + # Check if an URL is already handled # usage: is_url_handled URL is_url_handled() { - local output=($(curl -k -s -o /dev/null \ - -w 'x%{redirect_url} %{http_code}' "$1")) - # It's handled if it does not redirect to the SSO nor return 404 - [[ ! ${output[0]} =~ \/yunohost\/sso\/ && ${output[1]} != 404 ]] + # Declare an array to define the options of this helper. + declare -Ar args_array=( [u]=url= ) + local url + # Manage arguments with getopts + ynh_handle_getopts_args "$@" + + # Try to get the url with curl, and keep the http code and an eventual redirection url. + local curl_output="$(curl --insecure --silent --output /dev/null \ + --write-out '%{http_code};%{redirect_url}' "$url")" + + # Cut the output and keep only the first part to keep the http code + local http_code="${curl_output%%;*}" + # Do the same thing but keep the second part, the redirection url + local redirection="${curl_output#*;}" + + # Return 1 if the url isn't handled. + # Which means either curl got a 404 (or the admin) or the sso. + # A handled url should redirect to a publicly accessible url. + # Return 1 if the url has returned 404 + if [ "$http_code" = "404" ] || [[ $redirection =~ "/yunohost/admin" ]]; then + return 1 + # Return 1 if the url is redirected to the SSO + elif [[ $redirection =~ "/yunohost/sso" ]]; then + return 1 + 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 diff --git a/scripts/change_url b/scripts/change_url index f645daf..5900652 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -100,6 +100,19 @@ then ynh_replace_string "'overwrite.cli.url' => 'http://${old_domain}'," "'overwrite.cli.url' => 'https://${new_domain}'," "${final_path}/config/config.php" fi +if [ $change_domain -eq 1 ] +then + # Check if .well-known is available for this domain + if is_url_handled "https://$domain/.well-known/caldav" || is_url_handled "https://$domain/.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." + + # 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" + ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" + fi +fi + #================================================= #================================================= diff --git a/scripts/install b/scripts/install index f1c431a..b7ad783 100755 --- a/scripts/install +++ b/scripts/install @@ -92,10 +92,13 @@ ynh_setup_source "$final_path" #================================================= ynh_print_info "Configuring nginx web server..." -# Do not serve .well-known if it's already served on the domain -if is_url_handled "https://$domain/.well-known/caldav" ; then - sed -ri '/^location = \/\.well\-known\/(caldav|carddav) \{/,/\}/d' \ - "../conf/nginx.conf" +# Check if .well-known is available for this domain +if is_url_handled "https://$domain/.well-known/caldav" || is_url_handled "https://$domain/.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." + + # Remove lines about .well-known/carddav and caldav with sed. + sed --in-place --regexp-extended '/^location = \/\.well\-known\/(caldav|carddav) \{/,/\}/d' "../conf/nginx.conf" fi # Create a dedicated nginx config diff --git a/scripts/restore b/scripts/restore index c3d55b1..0a28807 100755 --- a/scripts/restore +++ b/scripts/restore @@ -46,6 +46,15 @@ test ! -d $final_path \ ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf" +# Check if .well-known is available for this domain +if is_url_handled "https://$domain/.well-known/caldav" || is_url_handled "https://$domain/.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." + + # 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/$domain.d/$app.conf" +fi + #================================================= # RESTORE THE APP MAIN DIR #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 167bbe0..79dac00 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -123,10 +123,13 @@ ynh_backup_if_checksum_is_different "/etc/nginx/conf.d/$domain.d/$app.conf" ynh_remove_nginx_config ynh_app_setting_delete $app "checksum__etc_nginx_conf.d_$domain.d_$app.conf" || true -# Do not serve .well-known if it's already served on the domain -if is_url_handled "https://$domain/.well-known/caldav" ; then - sed -ri '/^location = \/\.well\-known\/(caldav|carddav) \{/,/\}/d' \ - "../conf/nginx.conf" +# Check if .well-known is available for this domain +if is_url_handled "https://$domain/.well-known/caldav" || is_url_handled "https://$domain/.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." + + # Remove lines about .well-known/carddav and caldav with sed. + sed --in-place --regexp-extended '/^location = \/\.well\-known\/(caldav|carddav) \{/,/\}/d' "../conf/nginx.conf" fi # Create a dedicated nginx config From 57225b8c6af27504d7fc346e29fd34bb6e0348be Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Sun, 12 May 2019 21:40:00 +0200 Subject: [PATCH 073/204] Normalization from example_ynh --- README.md | 7 +- check_process | 13 +- manifest.json | 2 +- scripts/_common.sh | 295 ++-------------------------------- scripts/backup | 43 +++-- scripts/change_url | 32 ++-- scripts/install | 103 ++++++------ scripts/remove | 34 ++-- scripts/restore | 77 +++++---- scripts/upgrade | 388 +++++++++++++++++++++++---------------------- 10 files changed, 359 insertions(+), 635 deletions(-) diff --git a/README.md b/README.md index 644bb7e..16a8a7c 100644 --- a/README.md +++ b/README.md @@ -47,9 +47,9 @@ this package: #### Supported architectures -* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/nextcloud%20%28Official%29.svg)](https://ci-apps.yunohost.org/ci/apps/nextcloud/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/nextcloud%20%28Official%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/nextcloud/) -* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/nextcloud%20%28Official%29.svg)](https://ci-stretch.nohost.me/ci/apps/nextcloud/) +* x86-64b - [![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/) +* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/nextcloud%20%28Apps%29.svg)](https://ci-stretch.nohost.me/ci/apps/nextcloud/) ## Limitations @@ -104,6 +104,7 @@ sudo yunohost app ssowatconf * 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/ --- diff --git a/check_process b/check_process index 486960d..8b4cff8 100644 --- a/check_process +++ b/check_process @@ -19,18 +19,7 @@ port_already_use=0 change_url=1 ;;; Levels - Level 1=auto - Level 2=auto - Level 3=auto -# Level 4: LDAP and http auth - Level 4=1 -# Level 5: https://github.com/YunoHost-Apps/nextcloud_ynh/issues/58 - Level 5=1 - Level 6=auto - Level 7=auto - Level 8=0 - Level 9=0 - Level 10=0 + Level 5=auto ;;; Options Email= Notification=none diff --git a/manifest.json b/manifest.json index 6919f99..da51998 100644 --- a/manifest.json +++ b/manifest.json @@ -14,7 +14,7 @@ "email": "apps@yunohost.org" }, "requirements": { - "yunohost": ">= 3.2.0" + "yunohost": ">= 3.5.0" }, "multi_instance": true, "services": [ diff --git a/scripts/_common.sh b/scripts/_common.sh index d2e19d5..413f729 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,256 +5,6 @@ pkg_dependencies="php-gd php-json php-intl php-mcrypt php-curl php-apcu php-redis php-ldap php-imagick php-zip php-mbstring php-xml imagemagick acl tar smbclient at" -#================================================= -# UNSTABLE HELPERS -#================================================= - -# Start (or other actions) a service, print a log in case of failure and optionnaly wait until the service is completely started -# -# usage: ynh_systemd_action [-n service_name] [-a action] [ [-l "line to match"] [-p log_path] [-t timeout] [-e length] ] -# | arg: -n, --service_name= - Name of the service to start. Default : $app -# | arg: -a, --action= - Action to perform with systemctl. Default: start -# | arg: -l, --line_match= - Line to match - The line to find in the log to attest the service have finished to boot. -# If not defined it don't wait until the service is completely started. -# WARNING: When using --line_match, you should always add `ynh_clean_check_starting` into your -# `ynh_clean_setup` at the beginning of the script. Otherwise, tail will not stop in case of failure -# of the script. The script will then hang forever. -# | arg: -p, --log_path= - Log file - Path to the log file. Default : /var/log/$app/$app.log -# | arg: -t, --timeout= - Timeout - The maximum time to wait before ending the watching. Default : 300 seconds. -# | arg: -e, --length= - Length of the error log : Default : 20 -ynh_systemd_action() { - # Declare an array to define the options of this helper. - declare -Ar args_array=( [n]=service_name= [a]=action= [l]=line_match= [p]=log_path= [t]=timeout= [e]=length= ) - local service_name - local action - local line_match - local length - local log_path - local timeout - - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - - local service_name="${service_name:-$app}" - local action=${action:-start} - local log_path="${log_path:-/var/log/$service_name/$service_name.log}" - local length=${length:-20} - local timeout=${timeout:-300} - - # Start to read the log - if [[ -n "${line_match:-}" ]] - then - local templog="$(mktemp)" - # Following the starting of the app in its log - if [ "$log_path" == "systemd" ] ; then - # Read the systemd journal - journalctl --unit=$service_name --follow --since=-0 --quiet > "$templog" & - # Get the PID of the journalctl command - local pid_tail=$! - else - # Read the specified log file - tail -F -n0 "$log_path" > "$templog" 2>&1 & - # Get the PID of the tail command - local pid_tail=$! - fi - fi - - ynh_print_info --message="${action^} the service $service_name" - - # Use reload-or-restart instead of reload. So it wouldn't fail if the service isn't running. - if [ "$action" == "reload" ]; then - action="reload-or-restart" - fi - - systemctl $action $service_name \ - || ( journalctl --no-pager --lines=$length -u $service_name >&2 \ - ; test -e "$log_path" && echo "--" >&2 && tail --lines=$length "$log_path" >&2 \ - ; false ) - - # Start the timeout and try to find line_match - if [[ -n "${line_match:-}" ]] - then - local i=0 - for i in $(seq 1 $timeout) - do - # Read the log until the sentence is found, that means the app finished to start. Or run until the timeout - if grep --quiet "$line_match" "$templog" - then - ynh_print_info --message="The service $service_name has correctly started." - break - fi - if [ $i -eq 3 ]; then - echo -n "Please wait, the service $service_name is ${action}ing" >&2 - fi - if [ $i -ge 3 ]; then - echo -n "." >&2 - fi - sleep 1 - done - if [ $i -ge 3 ]; then - echo "" >&2 - fi - if [ $i -eq $timeout ] - then - ynh_print_warn --message="The service $service_name didn't fully started before the timeout." - ynh_print_warn --message="Please find here an extract of the end of the log of the service $service_name:" - journalctl --no-pager --lines=$length -u $service_name >&2 - test -e "$log_path" && echo "--" >&2 && tail --lines=$length "$log_path" >&2 - fi - ynh_clean_check_starting - fi -} - -# Create a dedicated fail2ban config (jail and filter conf files) -# -# usage 1: ynh_add_fail2ban_config --logpath=log_file --failregex=filter [--max_retry=max_retry] [--ports=ports] -# | arg: -l, --logpath= - Log file to be checked by fail2ban -# | arg: -r, --failregex= - Failregex to be looked for by fail2ban -# | arg: -m, --max_retry= - Maximum number of retries allowed before banning IP address - default: 3 -# | arg: -p, --ports= - Ports blocked for a banned IP address - default: http,https -# -# ----------------------------------------------------------------------------- -# -# usage 2: ynh_add_fail2ban_config --use_template [--others_var="list of others variables to replace"] -# | arg: -t, --use_template - Use this helper in template mode -# | arg: -v, --others_var= - List of others variables to replace separeted by a space -# | for example : 'var_1 var_2 ...' -# -# This will use a template in ../conf/f2b_jail.conf and ../conf/f2b_filter.conf -# __APP__ by $app -# -# You can dynamically replace others variables by example : -# __VAR_1__ by $var_1 -# __VAR_2__ by $var_2 -# -# Generally your template will look like that by example (for synapse): -# -# f2b_jail.conf: -# [__APP__] -# enabled = true -# port = http,https -# filter = __APP__ -# logpath = /var/log/__APP__/logfile.log -# maxretry = 3 -# -# f2b_filter.conf: -# [INCLUDES] -# before = common.conf -# [Definition] -# -# # Part of regex definition (just used to make more easy to make the global regex) -# __synapse_start_line = .? \- synapse\..+ \- -# -# # Regex definition. -# failregex = ^%(__synapse_start_line)s INFO \- POST\-(\d+)\- \- \d+ \- Received request\: POST /_matrix/client/r0/login\??%(__synapse_start_line)s INFO \- POST\-\1\- Got login request with identifier: \{u'type': u'm.id.user', u'user'\: u'(.+?)'\}, medium\: None, address: None, user\: u'\5'%(__synapse_start_line)s WARNING \- \- (Attempted to login as @\5\:.+ but they do not exist|Failed password login for user @\5\:.+)$ -# -# ignoreregex = -# -# ----------------------------------------------------------------------------- -# -# Note about the "failregex" option: -# regex to match the password failure messages in the logfile. The -# host must be matched by a group named "host". The tag "" can -# be used for standard IP/hostname matching and is only an alias for -# (?:::f{4,6}:)?(?P[\w\-.^_]+) -# -# You can find some more explainations about how to make a regex here : -# https://www.fail2ban.org/wiki/index.php/MANUAL_0_8#Filters -# -# Note that the logfile need to exist before to call this helper !! -# -# To validate your regex you can test with this command: -# fail2ban-regex /var/log/YOUR_LOG_FILE_PATH /etc/fail2ban/filter.d/YOUR_APP.conf -# -# Requires YunoHost version 3.?.? or higher. -ynh_add_fail2ban_config () { - # Declare an array to define the options of this helper. - local legacy_args=lrmptv - declare -Ar args_array=( [l]=logpath= [r]=failregex= [m]=max_retry= [p]=ports= [t]=use_template [v]=others_var=) - local logpath - local failregex - local max_retry - local ports - local others_var - local use_template - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - use_template="${use_template:-0}" - max_retry=${max_retry:-3} - ports=${ports:-http,https} - - finalfail2banjailconf="/etc/fail2ban/jail.d/$app.conf" - finalfail2banfilterconf="/etc/fail2ban/filter.d/$app.conf" - ynh_backup_if_checksum_is_different "$finalfail2banjailconf" - ynh_backup_if_checksum_is_different "$finalfail2banfilterconf" - - if [ $use_template -eq 1 ] - then - # Usage 2, templates - cp ../conf/f2b_jail.conf $finalfail2banjailconf - cp ../conf/f2b_filter.conf $finalfail2banfilterconf - - if [ -n "${app:-}" ] - then - ynh_replace_string "__APP__" "$app" "$finalfail2banjailconf" - ynh_replace_string "__APP__" "$app" "$finalfail2banfilterconf" - fi - - # Replace all other variable given as arguments - for var_to_replace in ${others_var:-}; do - # ${var_to_replace^^} make the content of the variable on upper-cases - # ${!var_to_replace} get the content of the variable named $var_to_replace - ynh_replace_string --match_string="__${var_to_replace^^}__" --replace_string="${!var_to_replace}" --target_file="$finalfail2banjailconf" - ynh_replace_string --match_string="__${var_to_replace^^}__" --replace_string="${!var_to_replace}" --target_file="$finalfail2banfilterconf" - done - - else - # Usage 1, no template. Build a config file from scratch. - test -n "$logpath" || ynh_die "ynh_add_fail2ban_config expects a logfile path as first argument and received nothing." - test -n "$failregex" || ynh_die "ynh_add_fail2ban_config expects a failure regex as second argument and received nothing." - - tee $finalfail2banjailconf < db.sql +ynh_mysql_dump_db --database="$db_name" > db.sql #================================================= # SPECIFIC BACKUP #================================================= # BACKUP LOGROTATE #================================================= -ynh_print_info "Backing up logrotate configuration..." +ynh_script_progression --message="Backing up logrotate configuration..." ynh_backup "/etc/logrotate.d/$app" #================================================= # BACKUP FAIL2BAN CONFIGURATION #================================================= -ynh_print_info "Backing up fail2ban configuration..." +ynh_script_progression --message="Backing up fail2ban configuration..." -ynh_backup "/etc/fail2ban/jail.d/$app.conf" -ynh_backup "/etc/fail2ban/filter.d/$app.conf" +ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf" +ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf" #================================================= # BACKUP THE CRON FILE #================================================= -ynh_backup "/etc/cron.d/$app" +ynh_backup --src_path="/etc/cron.d/$app" #================================================= # BACKUP THE DATA DIRECTORY #================================================= -ynh_print_info "Backing up data directory..." +ynh_script_progression --message="Backing up data directory..." -# The 1 parameter indicates the directory is "big", -# so that it won't be backed up before upgrade -# This argument has to be the third one. -ynh_backup "/home/yunohost.app/${app}/data" "/home/yunohost.app/${app}/data" 1 +ynh_backup --src_path="/home/yunohost.app/${app}/data" --is_big #================================================= # END OF SCRIPT #================================================= -ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." +ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last diff --git a/scripts/change_url b/scripts/change_url index 5900652..83bcb4e 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -24,14 +24,10 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # LOAD SETTINGS #================================================= -ynh_print_info "Loading installation settings..." +ynh_script_progression --message="Loading installation settings..." # Needed for helper "ynh_add_nginx_config" -final_path=$(ynh_app_setting_get $app final_path) - -# Add settings here as needed by your application -#db_name=$(ynh_app_setting_get "$app" db_name) -#db_pwd=$(ynh_app_setting_get $app db_pwd) +final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # CHECK WHICH PARTS SHOULD BE CHANGED @@ -54,7 +50,7 @@ fi #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_print_info "Updating nginx web server configuration..." +ynh_script_progression --message="Updating nginx web server configuration..." --weight=2 nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf @@ -62,7 +58,7 @@ nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf if [ $change_path -eq 1 ] then # Make a backup of the original nginx config file if modified - ynh_backup_if_checksum_is_different "$nginx_conf_path" + ynh_backup_if_checksum_is_different --file="$nginx_conf_path" # Set global variables for nginx helper domain="$old_domain" path_url="$new_path" @@ -74,16 +70,16 @@ fi if [ $change_domain -eq 1 ] then # Delete file checksum for the old conf file location - ynh_delete_file_checksum "$nginx_conf_path" + ynh_delete_file_checksum --file="$nginx_conf_path" mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf # Store file checksum for the new config file location - ynh_store_file_checksum "/etc/nginx/conf.d/$new_domain.d/$app.conf" + ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" fi #================================================= # SPECIFIC MODIFICATIONS #================================================= -ynh_print_info "Applying Nextcloud specific modifications..." +ynh_script_progression --message="Applying Nextcloud specific modifications..." --weight=2 # Define a function to execute commands with `occ` exec_occ() { @@ -94,16 +90,16 @@ exec_occ() { if [ $change_domain -eq 1 ] then # Change the trusted domain - exec_occ config:system:set trusted_domains 1 --value=${new_domain} + exec_occ config:system:set trusted_domains 1 --value=$new_domain # Change hostname for activity notifications - ynh_replace_string "'overwrite.cli.url' => 'http://${old_domain}'," "'overwrite.cli.url' => 'https://${new_domain}'," "${final_path}/config/config.php" + 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" fi if [ $change_domain -eq 1 ] then # Check if .well-known is available for this domain - if is_url_handled "https://$domain/.well-known/caldav" || is_url_handled "https://$domain/.well-known/carddav" + if is_url_handled --url="https://$domain/.well-known/caldav" || is_url_handled --url="https://$domain/.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." @@ -113,19 +109,17 @@ then fi fi -#================================================= - #================================================= # GENERIC FINALISATION #================================================= # RELOAD NGINX #================================================= -ynh_print_info "Reloading nginx web server..." +ynh_script_progression --message="Reloading nginx web server..." -systemctl reload nginx +ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT #================================================= -ynh_print_info "Change of URL completed for $app" +ynh_script_progression --message="Change of URL completed for $app" --last diff --git a/scripts/install b/scripts/install index b7ad783..7556b9d 100755 --- a/scripts/install +++ b/scripts/install @@ -30,70 +30,67 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -ynh_print_info "Validating installation parameters..." +ynh_script_progression --message="Validating installation parameters..." final_path=/var/www/$app -test ! -e "$final_path" || ynh_die "This path already contains a folder" - -# Normalize the url path syntax -path_url=$(ynh_normalize_url_path $path_url) +test ! -e "$final_path" || ynh_die --message="This path already contains a folder" # Register (book) web path -ynh_webpath_register $app $domain $path_url +ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_print_info "Storing installation settings..." +ynh_script_progression --message="Storing installation settings..." -ynh_app_setting_set $app domain $domain -ynh_app_setting_set $app path $path_url -ynh_app_setting_set $app admin $admin -ynh_app_setting_set $app user_home $user_home +ynh_app_setting_set --app=$app --key=domain --value=$domain +ynh_app_setting_set --app=$app --key=path --value=$path_url +ynh_app_setting_set --app=$app --key=admin --value=$admin +ynh_app_setting_set --app=$app --key=user_home --value=$user_home #================================================= # STANDARD MODIFICATIONS #================================================= # INSTALL DEPENDENCIES #================================================= -ynh_print_info "Installing dependencies..." +ynh_script_progression --message="Installing dependencies..." --weight=60 ynh_install_app_dependencies $pkg_dependencies #================================================= # CREATE A MYSQL DATABASE #================================================= -ynh_print_info "Creating a MySQL database..." +ynh_script_progression --message="Creating a MySQL database..." --weight=2 -db_name=$(ynh_sanitize_dbid $app) -ynh_app_setting_set $app db_name $db_name -ynh_mysql_setup_db $db_name $db_name +db_name=$(ynh_sanitize_dbid --db_name=$app) +ynh_app_setting_set --app=$app --key=db_name --value=$db_name +ynh_mysql_setup_db --db_user=$db_name --db_name=$db_name #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_print_info "Setting up source files..." +ynh_script_progression --message="Setting up source files..."5 # 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 "__VERSION__" "$next_version" "../conf/app.src" -ynh_replace_string "__SHA256_SUM__" "$nextcloud_source_sha256" "../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" -ynh_app_setting_set $app final_path $final_path +ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Enable YunoHost patches on Nextcloud sources cp -a ../sources/patches_last_version/* ../sources/patches # Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source "$final_path" +ynh_setup_source --dest_dir="$final_path" #================================================= # NGINX CONFIGURATION #================================================= -ynh_print_info "Configuring nginx web server..." +ynh_script_progression --message="Configuring nginx web server..." --weight=2 # Check if .well-known is available for this domain -if is_url_handled "https://$domain/.well-known/caldav" || is_url_handled "https://$domain/.well-known/carddav" +if is_url_handled --url="https://$domain/.well-known/caldav" || is_url_handled --url="https://$domain/.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." @@ -107,15 +104,15 @@ ynh_add_nginx_config #================================================= # CREATE DEDICATED USER #================================================= -ynh_print_info "Configuring system user..." +ynh_script_progression --message="Configuring system user..." --weight=3 # Create a system user -ynh_system_user_create $app +ynh_system_user_create --username=$app #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_print_info "Configuring php-fpm..." +ynh_script_progression --message="Configuring php-fpm..." --weight=2 # Create a dedicated php-fpm config ynh_add_fpm_config @@ -134,7 +131,7 @@ mkdir -p "$datadir" #================================================= # INSTALL NEXTCLOUD #================================================= -ynh_print_info "Installing nextcloud..." +ynh_script_progression --message="Installing nextcloud..." --weight=30 # Define a function to execute commands with `occ` exec_occ() { @@ -149,14 +146,14 @@ chown -R $app: "$final_path" "$datadir" 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 6)" \ + --admin-user "admin" --admin-pass "$(ynh_string_random --length=6)" \ --data-dir "$datadir" \ - || ynh_die "Unable to install Nextcloud" + || ynh_die --message="Unable to install Nextcloud" #================================================= # CONFIGURE NEXTCLOUD #================================================= -ynh_print_info "Configuring nextcloud..." +ynh_script_progression --message="Configuring nextcloud..." --weight=8 # Ensure that UpdateNotification app is disabled exec_occ app:disable updatenotification @@ -169,12 +166,12 @@ exec_occ ldap:create-empty-config nc_conf="$final_path/config_install.json" cp ../conf/config_install.json "$nc_conf" -ynh_replace_string "__DOMAIN__" "$domain" "$nc_conf" -ynh_replace_string "__DATADIR__" "$datadir" "$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 -rm -f "$nc_conf" +ynh_secure_remove --file="$nc_conf" # Load the additional config file (used also for upgrade) nc_conf="$final_path/config.json" @@ -183,7 +180,7 @@ cp ../conf/config.json "$nc_conf" exec_occ config:import "$nc_conf" # Then remove the config file -rm -f "$nc_conf" +ynh_secure_remove --file="$nc_conf" #================================================= # CHECK THE LDAP CONFIG @@ -191,7 +188,7 @@ rm -f "$nc_conf" # Check LDAP configuration to see if everything worked well exec_occ ldap:test-config \'\' \ - || ynh_die "An error occured during LDAP configuration" + || ynh_die --message="An error occured during LDAP configuration" #================================================= # MOUNT HOME FOLDERS AS EXTERNAL STORAGE @@ -205,7 +202,7 @@ create_external_storage() { local mount_id=`exec_occ files_external:create --output=json \ "$mount_name" 'local' 'null::null' -c "datadir=$datadir" || true` ! [[ $mount_id =~ ^[0-9]+$ ]] \ - && echo "Unable to create external storage" >&2 \ + && ynh_print_warn --message="Unable to create external storage" \ || exec_occ files_external:option "$mount_id" enable_sharing true } @@ -238,14 +235,14 @@ exec_occ config:system:get logout_url >/dev/null 2>&1 \ # CHANGE HOSTNAME FOR ACTIVITY NOTIFICATIONS #================================================= -ynh_replace_string "'overwrite.cli.url' => 'http://localhost'," "'overwrite.cli.url' => 'https://${domain}'," "${final_path}/config/config.php" +ynh_replace_string --match_string="'overwrite.cli.url' => 'http://localhost'," --replace_string="'overwrite.cli.url' => 'https://${domain}'," --target_file="${final_path}/config/config.php" #================================================= # REMOVE THE TEMPORARY ADMIN AND SET THE TRUE ONE #================================================= # Set the user as admin -ynh_mysql_connect_as "$db_name" "$db_pwd" "$db_name" \ +ynh_mysql_connect_as --user=$db_name --password="$db_pwd" --database=$db_name \ <<< "INSERT INTO oc_group_user VALUES ('admin','$admin');" # And delete admin user exec_occ user:delete admin @@ -255,7 +252,7 @@ exec_occ user:delete admin #================================================= # Calculate and store the config file checksum into the app settings -ynh_store_file_checksum "$final_path/config/config.php" +ynh_store_file_checksum --file="$final_path/config/config.php" #================================================= # ADD A CRON JOB @@ -266,8 +263,8 @@ cp -a ../conf/nextcloud.cron "$cron_path" chown root: "$cron_path" chmod 644 "$cron_path" -ynh_replace_string "__USER__" "$app" "$cron_path" -ynh_replace_string "__DESTDIR__" "$final_path" "$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" exec_occ background:cron @@ -282,12 +279,12 @@ exec_occ background:cron #================================================= # Set system group in hooks -ynh_replace_string "__GROUP__" "$app" ../hooks/post_user_create +ynh_replace_string --match_string="__GROUP__" --replace_string="$app" --target_file=../hooks/post_user_create #================================================= # YUNOHOST MULTIMEDIA INTEGRATION #================================================= -ynh_print_info "Adding multimedia directories..." +ynh_script_progression --message="Adding multimedia directories..." --weight=6 # Build YunoHost multimedia directories ynh_multimedia_build_main_dir @@ -316,15 +313,15 @@ chmod 755 /home/yunohost.app #================================================= # SETUP LOGROTATE #================================================= -ynh_print_info "Configuring log rotation..." +ynh_script_progression --message="Configuring log rotation..." # Use logrotate to manage application logfile(s) -ynh_use_logrotate "$datadir/nextcloud.log" +ynh_use_logrotate --logfile="$datadir/nextcloud.log" #================================================= # SETUP FAIL2BAN #================================================= -ynh_print_info "Configuring fail2ban..." +ynh_script_progression --message="Configuring fail2ban..." --weight=8 # Create a dedicated fail2ban config ynh_add_fail2ban_config --logpath="/home/yunohost.app/$app/data/nextcloud.log" --failregex="^.*Login failed: '.*' \(Remote IP: ''.*$" --max_retry=5 @@ -332,21 +329,21 @@ ynh_add_fail2ban_config --logpath="/home/yunohost.app/$app/data/nextcloud.log" - #================================================= # SETUP SSOWAT #================================================= -ynh_print_info "Configuring SSOwat..." +ynh_script_progression --message="Configuring SSOwat..." -ynh_app_setting_set $app unprotected_uris "/" -ynh_app_setting_set $app skipped_regex \ - "$(sed 's/[\.\-]/\%&/g' <<< $domain)/%.well%-known/.*" +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 #================================================= -ynh_print_info "Reloading nginx web server..." +ynh_script_progression --message="Reloading nginx web server..." -systemctl reload nginx +ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT #================================================= -ynh_print_info "Installation of $app completed" +ynh_script_progression --message="Installation of $app completed" --last diff --git a/scripts/remove b/scripts/remove index 934c8a7..9ea5c15 100755 --- a/scripts/remove +++ b/scripts/remove @@ -12,20 +12,20 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_print_info "Loading installation settings..." +ynh_script_progression --message="Loading installation settings..." --weight=2 app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get $app domain) -db_name=$(ynh_app_setting_get $app db_name) -final_path=$(ynh_app_setting_get $app final_path) +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) #================================================= # STANDARD REMOVE #================================================= # REMOVE DEPENDENCIES #================================================= -ynh_print_info "Removing dependencies" +ynh_script_progression --message="Removing dependencies..." --weight=20 # Remove metapackage and its dependencies ynh_remove_app_dependencies @@ -33,23 +33,23 @@ ynh_remove_app_dependencies #================================================= # REMOVE THE MYSQL DATABASE #================================================= -ynh_print_info "Removing the MySQL database" +ynh_script_progression --message="Removing the MySQL database..." --weight=5 # Remove a database if it exists, along with the associated user -ynh_mysql_remove_db $db_name $db_name +ynh_mysql_remove_db --db_user=$db_name --db_name=$db_name #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_print_info "Removing app main directory" +ynh_script_progression --message="Removing app main directory..." --weight=3 # Remove the app directory securely -ynh_secure_remove "$final_path" +ynh_secure_remove --file="$final_path" #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_print_info "Removing nginx web server configuration" +ynh_script_progression --message="Removing nginx web server configuration..." # Remove the dedicated nginx config ynh_remove_nginx_config @@ -57,7 +57,7 @@ ynh_remove_nginx_config #================================================= # REMOVE PHP-FPM CONFIGURATION #================================================= -ynh_print_info "Removing php-fpm configuration" +ynh_script_progression --message="Removing php-fpm configuration..." --weight=2 # Remove the dedicated php-fpm config ynh_remove_fpm_config @@ -65,7 +65,7 @@ ynh_remove_fpm_config #================================================= # REMOVE LOGROTATE CONFIGURATION #================================================= -ynh_print_info "Removing logrotate configuration" +ynh_script_progression --message="Removing logrotate configuration..." # Remove the app-specific logrotate config ynh_remove_logrotate @@ -73,7 +73,7 @@ ynh_remove_logrotate #================================================= # REMOVE FAIL2BAN CONFIGURATION #================================================= -ynh_print_info "Remove fail2ban configuration" +ynh_script_progression --message="Removing fail2ban configuration..." --weight=8 # Remove the dedicated fail2ban config ynh_remove_fail2ban_config @@ -86,7 +86,7 @@ ynh_remove_fail2ban_config # Remove a cron file # TODO: Ensure that cron job is not running (How !?) -ynh_secure_remove "/etc/cron.d/$app" +ynh_secure_remove --file="/etc/cron.d/$app" #================================================= # CLEAN ACL IN HOME DIRECTORIES @@ -103,13 +103,13 @@ done #================================================= # REMOVE DEDICATED USER #================================================= -ynh_print_info "Removing the dedicated system user" +ynh_script_progression --message="Removing the dedicated system user..." # Delete a system user -ynh_system_user_delete $app +ynh_system_user_delete --username=$app #================================================= # END OF SCRIPT #================================================= -ynh_print_info "Removal of $app completed" +ynh_script_progression --message="Removal of $app completed" --last diff --git a/scripts/restore b/scripts/restore index 0a28807..c6c8e7e 100755 --- a/scripts/restore +++ b/scripts/restore @@ -19,24 +19,24 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_print_info "Loading settings..." +ynh_script_progression --message="Loading settings..." app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get $app domain) -path_url=$(ynh_app_setting_get $app path) -final_path=$(ynh_app_setting_get $app final_path) -db_name=$(ynh_app_setting_get $app db_name) +domain=$(ynh_app_setting_get --app=$app --key=domain) +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) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= -ynh_print_info "Validating restoration parameters..." +ynh_script_progression --message="Validating restoration parameters..." --weight=4 -ynh_webpath_available $domain $path_url \ - || ynh_die "Path not available: ${domain}${path_url}" +ynh_webpath_available --domain=$domain --path_url=$path_url \ + || ynh_die --message="Path not available: ${domain}${path_url}" test ! -d $final_path \ - || ynh_die "There is already a directory: $final_path " + || ynh_die --message="There is already a directory: $final_path " #================================================= # STANDARD RESTORATION STEPS @@ -44,10 +44,10 @@ test ! -d $final_path \ # RESTORE THE NGINX CONFIGURATION #================================================= -ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" # Check if .well-known is available for this domain -if is_url_handled "https://$domain/.well-known/caldav" || is_url_handled "https://$domain/.well-known/carddav" +if is_url_handled --url="https://$domain/.well-known/caldav" || is_url_handled --url="https://$domain/.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." @@ -58,39 +58,39 @@ fi #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_print_info "Restoring the app main directory..." +ynh_script_progression --message="Restoring the app main directory..." -ynh_restore_file "$final_path" +ynh_restore_file --origin_path="$final_path" #================================================= # RESTORE THE MYSQL DATABASE #================================================= -ynh_print_info "Restoring the MySQL database..." +ynh_script_progression --message="Restoring the MySQL database..." --weight=9 -db_pwd=$(ynh_app_setting_get $app mysqlpwd) -ynh_mysql_setup_db $db_name $db_name $db_pwd -ynh_mysql_connect_as $db_name $db_pwd $db_name < ./db.sql +db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) +ynh_mysql_setup_db --db_user=$db_name --db_name=$db_name --db_pwd=$db_pwd +ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ./db.sql #================================================= # RECREATE THE DEDICATED USER #================================================= -ynh_print_info "Recreating the dedicated system user..." +ynh_script_progression --message="Recreating the dedicated system user..." --weight=3 # Create the dedicated user (if not existing) -ynh_system_user_create $app +ynh_system_user_create --username=$app #================================================= # RESTORE THE PHP-FPM CONFIGURATION #================================================= -ynh_restore_file "/etc/php/7.0/fpm/pool.d/$app.conf" +ynh_restore_file --origin_path="/etc/php/7.0/fpm/pool.d/$app.conf" #================================================= # SPECIFIC RESTORATION #================================================= # REINSTALL DEPENDENCIES #================================================= -ynh_print_info "Reinstalling dependencies..." +ynh_script_progression --message="Reinstalling dependencies..." --weight=60 # Define and install dependencies ynh_install_app_dependencies $pkg_dependencies @@ -99,30 +99,25 @@ ynh_install_app_dependencies $pkg_dependencies # RESTORE THE CRON FILE #================================================= -ynh_restore_file "/etc/cron.d/$app" +ynh_restore_file --origin_path="/etc/cron.d/$app" #================================================= # BACKUP THE LOGROTATE CONFIGURATION #================================================= -ynh_restore_file "/etc/logrotate.d/$app" +ynh_restore_file --origin_path="/etc/logrotate.d/$app" #================================================= # RESTORE THE DATA DIRECTORY #================================================= -ynh_print_info "Restoring data directory..." +ynh_script_progression --message="Restoring data directory..." --weight=2 datadir="/home/yunohost.app/$app/data" -# The data directory will be restored only if it exists in the backup archive -# So only if it was backup previously. -if [ -d "$YNH_BACKUP_DIR/apps/$app/backup/home/yunohost.app/$app" ] -then - ynh_restore_file "$datadir" -else - # Create app folders - mkdir -p "$datadir" -fi +# 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 + +mkdir -p "$datadir" #================================================= # RESTORE USER RIGHTS @@ -143,7 +138,7 @@ done #================================================= # YUNOHOST MULTIMEDIA INTEGRATION #================================================= -ynh_print_info "Adding multimedia directories..." +ynh_script_progression --message="Adding multimedia directories..." --weight=4 # Build YunoHost multimedia directories ynh_multimedia_build_main_dir @@ -153,10 +148,10 @@ ynh_multimedia_addaccess $app #================================================= # RESTORE THE FAIL2BAN CONFIGURATION #================================================= -ynh_print_info "Restoring the fail2ban configuration..." +ynh_script_progression --message="Restoring the fail2ban configuration..." --weight=7 -ynh_restore_file "/etc/fail2ban/jail.d/$app.conf" -ynh_restore_file "/etc/fail2ban/filter.d/$app.conf" +ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf" +ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf" # Make sure a log file exists (mostly for CI tests) logfile="/home/yunohost.app/$app/data/nextcloud.log" @@ -172,13 +167,13 @@ ynh_systemd_action --action=restart --service_name=fail2ban #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -ynh_print_info "Reloading nginx web server and php-fpm..." +ynh_script_progression --message="Reloading nginx web server and php-fpm..." -systemctl reload php7.0-fpm -systemctl reload nginx +ynh_systemd_action --service_name=php7.0-fpm --action=reload +ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT #================================================= -ynh_print_info "Restoration completed for $app" +ynh_script_progression --message="Restoration completed for $app" --last diff --git a/scripts/upgrade b/scripts/upgrade index 79dac00..423d909 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,41 +12,47 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_print_info "Loading installation settings..." +ynh_script_progression --message="Loading installation settings..." --weight=3 app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get $app domain) -path_url=$(ynh_app_setting_get $app path) -admin=$(ynh_app_setting_get $app admin) -final_path=$(ynh_app_setting_get $app final_path) -db_name=$(ynh_app_setting_get $app db_name) -user_home=$(ynh_app_setting_get $app user_home) +domain=$(ynh_app_setting_get --app=$app --key=domain) +path_url=$(ynh_app_setting_get --app=$app --key=path) +admin=$(ynh_app_setting_get --app=$app --key=admin) +final_path=$(ynh_app_setting_get --app=$app --key=final_path) +db_name=$(ynh_app_setting_get --app=$app --key=db_name) +user_home=$(ynh_app_setting_get --app=$app --key=user_home) + +#================================================= +# CHECK VERSION +#================================================= + +upgrade_type=$(ynh_check_app_version_changed) #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= -ynh_print_info "Ensuring downward compatibility..." +ynh_script_progression --message="Ensuring downward compatibility..." # If db_name doesn't exist, create it -if [ -z $db_name ]; then - db_name=$(ynh_sanitize_dbid $app) - ynh_app_setting_set $app db_name $db_name +if [ -z "$db_name" ]; then + db_name=$(ynh_sanitize_dbid --db_name=$app) + ynh_app_setting_set --app=$app --key=db_name --value=$db_name fi # If final_path doesn't exist, create it -if [ -z $final_path ]; then +if [ -z "$final_path" ]; then final_path=/var/www/$app - ynh_app_setting_set $app final_path $final_path + ynh_app_setting_set --app=$app --key=final_path --value=$final_path fi # Remove the option backup_core_only if it's in the settings.yml file -ynh_app_setting_delete $app backup_core_only +ynh_app_setting_delete --app=$app --key=backup_core_only #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_print_info "Backing up the app before upgrading (may take a while)..." +ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=30 # Made a backup only after the version 11.0.0 # Before, the datas will be always saved. @@ -58,7 +64,7 @@ if [ $current_major_version -gt 11 ] then # Inform the backup/restore process that it should not save the data directory # Use only for the previous backup script that doesn't set 'is_big' - ynh_app_setting_set $app backup_core_only 1 + ynh_app_setting_set --app=$app --key=backup_core_only --value=1 # Backup the current version of the app ynh_backup_before_upgrade @@ -68,7 +74,7 @@ then ynh_clean_setup () { # Remove the post migration script before its execution ! - ynh_secure_remove "/tmp/owncloud_post_migration.sh" 2>&1 + ynh_exec_warn_less ynh_secure_remove --file="/tmp/owncloud_post_migration.sh" # restore it if the upgrade fails ynh_restore_upgradebackup @@ -87,8 +93,8 @@ 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 final_path) - db_name=$(ynh_app_setting_get $app db_name) + 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 @@ -108,23 +114,23 @@ fi #================================================= # Normalize the URL path syntax -path_url=$(ynh_normalize_url_path $path_url) +path_url=$(ynh_normalize_url_path --path_url=$path_url) #================================================= # STANDARD UPGRADE STEPS #================================================= # NGINX CONFIGURATION #================================================= -ynh_print_info "Upgrading nginx web server configuration..." +ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=2 -ynh_backup_if_checksum_is_different "/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_backup_if_checksum_is_different --file="/etc/nginx/conf.d/$domain.d/$app.conf" # Delete current nginx configuration to be able to check if .well-known is already served. ynh_remove_nginx_config -ynh_app_setting_delete $app "checksum__etc_nginx_conf.d_$domain.d_$app.conf" || true +ynh_app_setting_delete --app=$app --key="checksum__etc_nginx_conf.d_$domain.d_$app.conf" # Check if .well-known is available for this domain -if is_url_handled "https://$domain/.well-known/caldav" || is_url_handled "https://$domain/.well-known/carddav" +if is_url_handled --url="https://$domain/.well-known/caldav" || is_url_handled --url="https://$domain/.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." @@ -138,27 +144,28 @@ ynh_add_nginx_config #================================================= # CREATE DEDICATED USER #================================================= -ynh_print_info "Making sure dedicated system user exists..." +ynh_script_progression --message="Making sure dedicated system user exists..." # Create a dedicated user (if not existing) -ynh_system_user_create $app +ynh_system_user_create --username=$app #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_print_info "Upgrading php-fpm configuration..." +ynh_script_progression --message="Upgrading php-fpm configuration..." --weight=2 # Create a dedicated php-fpm config ynh_add_fpm_config # Delete existing ini configuration file (backward compatibility) if [ -f /etc/php/7.0/fpm/conf.d/20-$app.ini ]; then - ynh_secure_remove /etc/php/7.0/fpm/conf.d/20-$app.ini + ynh_secure_remove --file=/etc/php/7.0/fpm/conf.d/20-$app.ini fi + #================================================= # UPGRADE DEPENDENCIES #================================================= -ynh_print_info "Upgrading dependencies..." +ynh_script_progression --message="Upgrading dependencies..." --weight=7 ynh_install_app_dependencies $pkg_dependencies @@ -168,173 +175,177 @@ ynh_install_app_dependencies $pkg_dependencies # MAKE SEQUENTIAL UPGRADES FROM EACH MAJOR # VERSION TO THE NEXT ONE #================================================= -ynh_print_info "Upgrading nextcloud..." -# Define a function to execute commands with `occ` -exec_occ() { - (cd "$final_path" && exec_as "$app" \ - php occ --no-interaction --no-ansi "$@") -} +if [ "$upgrade_type" == "UPGRADE_APP" ] +then + ynh_script_progression --message="Upgrading nextcloud..." --weight=3 -# Load the last available version -source upgrade.d/upgrade.last.sh -last_version=$next_version + # Define a function to execute commands with `occ` + exec_occ() { + (cd "$final_path" && exec_as "$app" \ + php occ --no-interaction --no-ansi "$@") + } -# Define app's data directory -datadir="/home/yunohost.app/$app/data" + # Load the last available version + source upgrade.d/upgrade.last.sh + last_version=$next_version -# Set write access for the following commands -chown -R $app: "$final_path" "$datadir" - -# Print the current version number of nextcloud -exec_occ -V - -# While the current version is not the last version, do an upgrade -while [ "$last_version" != "$current_version" ] -do - - # The major version is the first part of the version number - # major_version=${next_version%%.*} - major_version=${last_version%%.*} - current_major_version=${current_version%%.*} - - # If the current version has the same major version than the next one, - # then it's the last upgrade to do - if [ "$major_version" -eq "$current_major_version" ]; then - current_major_version=last - # Execute the commands dedicated to the last upgrade - last_upgrade_operations - fi - - # Load the value for this version - source upgrade.d/upgrade.$current_major_version.sh - - ynh_print_info "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 "__VERSION__" "$next_version" "../conf/app.src" - ynh_replace_string "__SHA256_SUM__" "$nextcloud_source_sha256" "../conf/app.src" - - # Create a temporary directory - tmpdir="$(ynh_smart_mktemp 300)" - - # Install the next nextcloud version in $tmpdir - ynh_setup_source "$tmpdir" - - # Enable maintenance mode - exec_occ maintenance:mode --on - - # Backup the config file in the temp dir - cp -a "$final_path/config/config.php" "$tmpdir/config/config.php" - - # Backup 3rd party applications from the current nextcloud - # But do not overwrite if there is any upgrade - # (apps directory already exists in Nextcloud archive) - cp -a --update "$final_path/apps" "$tmpdir" - - # Replace the old nextcloud by the new one - ynh_secure_remove "$final_path" - mv "$tmpdir" "$final_path" - ynh_secure_remove "$tmpdir" + # Define app's data directory + datadir="/home/yunohost.app/$app/data" # Set write access for the following commands chown -R $app: "$final_path" "$datadir" - # Upgrade Nextcloud (SUCCESS = 0, UP_TO_DATE = 3) - exec_occ maintenance:mode --off - exec_occ upgrade \ - || ([ $? -eq 3 ] || ynh_die "Unable to upgrade Nextcloud") - - # Get the new current version number - current_version=$(grep OC_VersionString "$final_path/version.php" | cut -d\' -f2) - current_major_version=${current_version%%.*} - # Print the current version number of nextcloud exec_occ -V -done -#================================================= -# CONFIGURE NEXTCLOUD -#================================================= -ynh_print_info "Reconfiguring nextcloud..." + # While the current version is not the last version, do an upgrade + while [ "$last_version" != "$current_version" ] + do -# Verify the checksum and backup the file if it's different -ynh_backup_if_checksum_is_different "$final_path/config/config.php" + # The major version is the first part of the version number + # major_version=${next_version%%.*} + major_version=${last_version%%.*} + current_major_version=${current_version%%.*} -nc_conf="${final_path}/config.json" -cp ../conf/config.json "$nc_conf" + # If the current version has the same major version than the next one, + # then it's the last upgrade to do + if [ "$major_version" -eq "$current_major_version" ]; then + current_major_version=last + # Execute the commands dedicated to the last upgrade + last_upgrade_operations + fi -ynh_replace_string "__DOMAIN__" "$domain" "$nc_conf" -ynh_replace_string "__DATADIR__" "$datadir" "$nc_conf" + # Load the value for this version + source upgrade.d/upgrade.$current_major_version.sh -# Ensure that UpdateNotification app is disabled -exec_occ app:disable updatenotification + ynh_print_info --message="Upgrade to nextcloud $next_version" -# Enable plugins -exec_occ app:enable user_ldap + # 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" -# Load the config file in nextcloud -exec_occ config:import "$nc_conf" + # Create a temporary directory + tmpdir="$(ynh_smart_mktemp min_size=300)" -# Then remove the config file -rm -f "$nc_conf" + # Install the next nextcloud version in $tmpdir + ynh_setup_source --dest_dir="$tmpdir" -#================================================= -# ALLOW USERS TO DISCONNECT FROM NEXTCLOUD -#================================================= + # Enable maintenance mode + exec_occ maintenance:mode --on -# Add dynamic logout URL to the config -exec_occ config:system:get logout_url >/dev/null 2>&1 \ - || echo " -//-YunoHost- -// set logout_url according to main domain -\$main_domain = exec('cat /etc/yunohost/current_host'); -\$CONFIG['logout_url'] = 'https://'.\$main_domain.'/yunohost/sso/?action=logout'; -//-YunoHost- -" >> "$final_path/config/config.php" + # Backup the config file in the temp dir + cp -a "$final_path/config/config.php" "$tmpdir/config/config.php" -#================================================= -# CHANGE HOSTNAME FOR ACTIVITY NOTIFICATIONS -#================================================= + # Backup 3rd party applications from the current nextcloud + # But do not overwrite if there is any upgrade + # (apps directory already exists in Nextcloud archive) + cp -a --update "$final_path/apps" "$tmpdir" -ynh_replace_string "'overwrite.cli.url' => 'http://localhost'," "'overwrite.cli.url' => 'https://${domain}'," "${final_path}/config/config.php" + # Replace the old nextcloud by the new one + ynh_secure_remove --file="$final_path" + mv "$tmpdir" "$final_path" + ynh_secure_remove --file="$tmpdir" -#================================================= -# MOUNT HOME FOLDERS AS EXTERNAL STORAGE -#================================================= + # Set write access for the following commands + chown -R $app: "$final_path" "$datadir" -# Define a function to add an external storage -# Create the external storage for the given folders and enable sharing -create_external_storage() { - local datadir="$1" - local mount_name="$2" - local mount_id=`exec_occ files_external:create --output=json \ - "$mount_name" 'local' 'null::null' -c "datadir=$datadir" || true` - ! [[ $mount_id =~ ^[0-9]+$ ]] \ - && echo "Unable to create external storage" >&2 \ - || exec_occ files_external:option "$mount_id" enable_sharing true -} + # Upgrade Nextcloud (SUCCESS = 0, UP_TO_DATE = 3) + exec_occ maintenance:mode --off + exec_occ upgrade \ + || ([ $? -eq 3 ] || ynh_die --message="Unable to upgrade Nextcloud") -# Enable External Storage and create local mount to home folder as needed -if [ $user_home -eq 1 ]; then - exec_occ app:enable files_external - exec_occ files_external:list --output=json \ - | grep -q '"storage":"\\\\OC\\\\Files\\\\Storage\\\\Local"' \ - || create_external_storage "/home/\$user" "Home" - # Iterate over users to extend their home folder permissions - for u in $(ynh_user_list); do - setfacl --modify g:$app:rwx "/home/$u" || true + # Get the new current version number + current_version=$(grep OC_VersionString "$final_path/version.php" | cut -d\' -f2) + current_major_version=${current_version%%.*} + + # Print the current version number of nextcloud + exec_occ -V done + + #================================================= + # CONFIGURE NEXTCLOUD + #================================================= + ynh_script_progression --message="Reconfiguring nextcloud..." --weight=9 + + # Verify the checksum and backup the file if it's different + 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" + + # Ensure that UpdateNotification app is disabled + exec_occ app:disable updatenotification + + # Enable plugins + exec_occ app:enable user_ldap + + # Load the config file in nextcloud + exec_occ config:import "$nc_conf" + + # Then remove the config file + ynh_secure_remove --file="$nc_conf" + + #================================================= + # ALLOW USERS TO DISCONNECT FROM NEXTCLOUD + #================================================= + + # Add dynamic logout URL to the config + exec_occ config:system:get logout_url >/dev/null 2>&1 \ + || echo " + //-YunoHost- + // set logout_url according to main domain + \$main_domain = exec('cat /etc/yunohost/current_host'); + \$CONFIG['logout_url'] = 'https://'.\$main_domain.'/yunohost/sso/?action=logout'; + //-YunoHost- + " >> "$final_path/config/config.php" + + #================================================= + # 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" + + #================================================= + # MOUNT HOME FOLDERS AS EXTERNAL STORAGE + #================================================= + + # Define a function to add an external storage + # Create the external storage for the given folders and enable sharing + create_external_storage() { + local datadir="$1" + local mount_name="$2" + local mount_id=`exec_occ files_external:create --output=json \ + "$mount_name" 'local' 'null::null' -c "datadir=$datadir" || true` + ! [[ $mount_id =~ ^[0-9]+$ ]] \ + && ynh_print_warn --message="Unable to create external storage" \ + || exec_occ files_external:option "$mount_id" enable_sharing true + } + + # Enable External Storage and create local mount to home folder as needed + if [ $user_home -eq 1 ]; then + exec_occ app:enable files_external + exec_occ files_external:list --output=json \ + | grep -q '"storage":"\\\\OC\\\\Files\\\\Storage\\\\Local"' \ + || create_external_storage "/home/\$user" "Home" + # Iterate over users to extend their home folder permissions + for u in $(ynh_user_list); do + setfacl --modify g:$app:rwx "/home/$u" || true + done + fi + + #================================================= + # STORE THE CHECKSUM OF THE CONFIG FILE + #================================================= + + # Calculate and store the config file checksum into the app settings + ynh_store_file_checksum --file="${final_path}/config/config.php" fi -#================================================= -# STORE THE CHECKSUM OF THE CONFIG FILE -#================================================= - -# Calculate and store the config file checksum into the app settings -ynh_store_file_checksum "${final_path}/config/config.php" - #================================================= # UPDATE THE CRON JOB #================================================= @@ -344,8 +355,8 @@ cp -a ../conf/nextcloud.cron "$cron_path" chown root: "$cron_path" chmod 644 "$cron_path" -ynh_replace_string "__USER__" "$app" "$cron_path" -ynh_replace_string "__DESTDIR__" "$final_path" "$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" exec_occ background:cron @@ -354,12 +365,12 @@ exec_occ background:cron #================================================= # Set system group in hooks -ynh_replace_string "__GROUP__" "$app" ../hooks/post_user_create +ynh_replace_string --match_string="__GROUP__" --replace_string="$app" --target_file=../hooks/post_user_create #================================================= # YUNOHOST MULTIMEDIA INTEGRATION #================================================= -ynh_print_info "Updating multimedia directories..." +ynh_script_progression --message="Updating multimedia directories..." --weight=6 # Build YunoHost multimedia directories ynh_multimedia_build_main_dir @@ -389,14 +400,17 @@ chmod 755 /home/yunohost.app # WARNING ABOUT THIRD-PARTY APPS #================================================= -# Warn about possible disabled apps -ynh_print_warn "Note that if you've installed some third-parties Nextcloud applications, \ -they are probably disabled and you'll have to manually enable them again." +if [ "$upgrade_type" == "UPGRADE_APP" ] +then + # Warn about possible disabled apps + ynh_print_warn --message="Note that if you've installed some third-parties Nextcloud applications, \ + they are probably disabled and you'll have to manually enable them again." +fi #================================================= # SETUP LOGROTATE #================================================= -ynh_print_info "Upgrading logrotate configuration..." +ynh_script_progression --message="Upgrading logrotate configuration..." # Use logrotate to manage app-specific logfile(s) ynh_use_logrotate --non-append @@ -404,7 +418,7 @@ ynh_use_logrotate --non-append #================================================= # SETUP FAIL2BAN #================================================= -ynh_print_info "Reconfiguring fail2ban..." +ynh_script_progression --message="Reconfiguring fail2ban..." --weight=7 # Create a dedicated fail2ban config ynh_add_fail2ban_config --logpath="/home/yunohost.app/$app/data/nextcloud.log" --failregex="^.*Login failed: '.*' \(Remote IP: ''.*$" --max_retry=5 @@ -414,18 +428,18 @@ ynh_add_fail2ban_config --logpath="/home/yunohost.app/$app/data/nextcloud.log" - #================================================= # SETUP SSOWAT #================================================= -ynh_print_info "Upgrading SSOwat configuration..." +ynh_script_progression --message="Upgrading SSOwat configuration..." --weight=2 -ynh_app_setting_set $app unprotected_uris "/" -ynh_app_setting_set $app skipped_regex \ - "$(sed 's/[\.\-]/\%&/g' <<< $domain)/%.well%-known/.*" +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 #================================================= -ynh_print_info "Reloading nginx web server..." +ynh_script_progression --message="Reloading nginx web server..." -systemctl reload nginx +ynh_systemd_action --service_name=nginx --action=reload #================================================= # FINISH MIGRATION PROCESS @@ -433,7 +447,7 @@ systemctl reload nginx if [ $migration_process -eq 1 ] then - ynh_print_info "ownCloud has been successfully migrated to Nextcloud! \ + 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." @@ -441,8 +455,8 @@ 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 "__OLD_APP__" "$old_app" ../conf/$script_post_migration - ynh_replace_string "__NEW_APP__" "$app" ../conf/$script_post_migration + 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) @@ -452,4 +466,4 @@ fi # END OF SCRIPT #================================================= -ynh_print_info "Upgrade of $app completed" +ynh_script_progression --message="Upgrade of $app completed" --last From e60f95660bcba58421d2e1225ccb033ac1de1a81 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Sun, 19 May 2019 11:01:09 +0200 Subject: [PATCH 074/204] Upgrade to upstream version 16.0.1 --- manifest.json | 4 +- scripts/upgrade.d/upgrade.15.sh | 7 +++ scripts/upgrade.d/upgrade.last.sh | 4 +- .../app-00-add-logout_url-conf.patch | 58 +++++-------------- 4 files changed, 24 insertions(+), 49 deletions(-) create mode 100644 scripts/upgrade.d/upgrade.15.sh diff --git a/manifest.json b/manifest.json index da51998..38a4b18 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Access & share your files, calendars, contacts, mail & more from any device, on your terms", "fr": "Consultez et partagez vos fichiers, agendas, carnets d'adresses, emails et bien plus depuis les appareils de votre choix, sous vos conditions" }, - "version": "15.0.7~ynh1", + "version": "16.0.1~ynh1", "url": "https://nextcloud.com", "license": "AGPL-3.0", "maintainer": { @@ -14,7 +14,7 @@ "email": "apps@yunohost.org" }, "requirements": { - "yunohost": ">= 3.5.0" + "yunohost": ">= 3.2.0" }, "multi_instance": true, "services": [ diff --git a/scripts/upgrade.d/upgrade.15.sh b/scripts/upgrade.d/upgrade.15.sh new file mode 100644 index 0000000..a8c2c1c --- /dev/null +++ b/scripts/upgrade.d/upgrade.15.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +# Last available nextcloud version +next_version="16.0.0" + +# Nextcloud tarball checksum sha256 +nextcloud_source_sha256="4532f7028b1d9bf060f75ac4fbbde52a59ecd9c9155f3178a038d3cf3609402e" diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index b576bdc..9ec64be 100755 --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -1,10 +1,10 @@ #!/bin/bash # Last available nextcloud version -next_version="15.0.7" +next_version="16.0.1" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="3e6158951fa72010ccd50dbeac05d8df162183f7bbc62a1c6c89ed7081fa9d49" +nextcloud_source_sha256="a80ce586e9e930b2fba69707311e575346cd4dc4402e84678c730f9930d78aee" # This function will only be executed upon applying the last upgrade referenced above last_upgrade_operations () { diff --git a/sources/patches_last_version/app-00-add-logout_url-conf.patch b/sources/patches_last_version/app-00-add-logout_url-conf.patch index 2e70ba7..c0df1ab 100644 --- a/sources/patches_last_version/app-00-add-logout_url-conf.patch +++ b/sources/patches_last_version/app-00-add-logout_url-conf.patch @@ -1,57 +1,25 @@ - core/Controller/LoginController.php | 25 ++++++++++++++----------- - 1 file changed, 14 insertions(+), 11 deletions(-) - diff --git a/core/Controller/LoginController.php b/core/Controller/LoginController.php -index 182d2bc106..82523e306e 100644 +index 85d3b6b837..e7b9f5fdca 100644 --- a/core/Controller/LoginController.php +++ b/core/Controller/LoginController.php -@@ -95,13 +95,13 @@ class LoginController extends Controller { - * @param Throttler $throttler - */ - public function __construct($appName, -- IRequest $request, -- IUserManager $userManager, -- IConfig $config, -- ISession $session, -- IUserSession $userSession, -- IURLGenerator $urlGenerator, -- ILogger $logger, -+ IRequest $request, -+ IUserManager $userManager, -+ IConfig $config, -+ ISession $session, -+ IUserSession $userSession, -+ IURLGenerator $urlGenerator, -+ ILogger $logger, - Manager $twoFactorManager, - Defaults $defaults, - Throttler $throttler) { -@@ -130,7 +130,10 @@ class LoginController extends Controller { +@@ -130,11 +130,12 @@ class LoginController extends Controller { } $this->userSession->logout(); -- $response = new RedirectResponse($this->urlGenerator->linkToRouteAbsolute('core.login.showLoginForm')); +- $response = new RedirectResponse($this->urlGenerator->linkToRouteAbsolute( +- 'core.login.showLoginForm', +- ['clear' => true] // this param the the code in login.js may be removed when the "Clear-Site-Data" is working in the browsers + $redirectUrl = $this->config->getSystemValue('logout_url', -+ $this->urlGenerator->linkToRouteAbsolute('core.login.showLoginForm') -+ ); ++ $this->urlGenerator->linkToRouteAbsolute( ++ 'core.login.showLoginForm', ++ ['clear' => true] // this param the the code in login.js may be removed when the "Clear-Site-Data" is working in the browsers) + )); +- + $response = new RedirectResponse($redirectUrl); + $this->session->set('clearingExecutionContexts', '1'); + $this->session->close(); $response->addHeader('Clear-Site-Data', '"cache", "storage", "executionContexts"'); - return $response; - } -@@ -303,10 +306,10 @@ class LoginController extends Controller { - $previousUser = $user; - $user = $users[0]->getUID(); - if($user !== $previousUser) { -- $loginResult = $this->userManager->checkPassword($user, $password); -- } -+ $loginResult = $this->userManager->checkPassword($user, $password); - } - } -+ } - - if ($loginResult === false) { - $this->logger->warning('Login failed: \''. $user . -@@ -314,7 +317,7 @@ class LoginController extends Controller { +@@ -329,7 +330,7 @@ class LoginController extends Controller { ['app' => 'core']); return $this->createLoginFailedResponse($user, $originalUser, $redirect_url, self::LOGIN_MSG_INVALIDPASSWORD); From 6d9cea4d24e8b74c4b42bd62b134c15cd52452b7 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Sun, 19 May 2019 13:23:01 +0200 Subject: [PATCH 075/204] Upgrade YunoHost version dependency --- README.md | 2 +- manifest.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 16a8a7c..abf1f74 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to own data. A personal cloud which run on your own server. With Nextcloud you can synchronize your files over your devices. -**Shipped version:** 15.0.7 +**Shipped version:** 16.0.1 ## Screenshots diff --git a/manifest.json b/manifest.json index 38a4b18..da09519 100644 --- a/manifest.json +++ b/manifest.json @@ -14,7 +14,7 @@ "email": "apps@yunohost.org" }, "requirements": { - "yunohost": ">= 3.2.0" + "yunohost": ">= 3.5.0" }, "multi_instance": true, "services": [ From 33c2c7f8740307b6fbb79c1252c158cd84fb7461 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Sat, 6 Jul 2019 22:41:03 +0200 Subject: [PATCH 076/204] Upgrade to upstream version 15.0.9 --- README.md | 2 +- manifest.json | 2 +- scripts/upgrade.d/upgrade.last.sh | 4 +- .../app-00-add-logout_url-conf.patch | 58 ++----------------- 4 files changed, 10 insertions(+), 56 deletions(-) diff --git a/README.md b/README.md index 16a8a7c..2ee59a9 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to own data. A personal cloud which run on your own server. With Nextcloud you can synchronize your files over your devices. -**Shipped version:** 15.0.7 +**Shipped version:** 15.0.9 ## Screenshots diff --git a/manifest.json b/manifest.json index da51998..07e7cac 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Access & share your files, calendars, contacts, mail & more from any device, on your terms", "fr": "Consultez et partagez vos fichiers, agendas, carnets d'adresses, emails et bien plus depuis les appareils de votre choix, sous vos conditions" }, - "version": "15.0.7~ynh1", + "version": "15.0.9~ynh1", "url": "https://nextcloud.com", "license": "AGPL-3.0", "maintainer": { diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index b576bdc..f0da93d 100755 --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -1,10 +1,10 @@ #!/bin/bash # Last available nextcloud version -next_version="15.0.7" +next_version="15.0.9" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="3e6158951fa72010ccd50dbeac05d8df162183f7bbc62a1c6c89ed7081fa9d49" +nextcloud_source_sha256="7b33e210f64fb94c9a92aa31f087136db73bdacd1aaa7df2905bc7c0887edd5c" # This function will only be executed upon applying the last upgrade referenced above last_upgrade_operations () { diff --git a/sources/patches_last_version/app-00-add-logout_url-conf.patch b/sources/patches_last_version/app-00-add-logout_url-conf.patch index 2e70ba7..07a9531 100644 --- a/sources/patches_last_version/app-00-add-logout_url-conf.patch +++ b/sources/patches_last_version/app-00-add-logout_url-conf.patch @@ -1,62 +1,16 @@ - core/Controller/LoginController.php | 25 ++++++++++++++----------- - 1 file changed, 14 insertions(+), 11 deletions(-) - diff --git a/core/Controller/LoginController.php b/core/Controller/LoginController.php -index 182d2bc106..82523e306e 100644 +index f83b03bc90..568e20dcd7 100644 --- a/core/Controller/LoginController.php +++ b/core/Controller/LoginController.php -@@ -95,13 +95,13 @@ class LoginController extends Controller { - * @param Throttler $throttler - */ - public function __construct($appName, -- IRequest $request, -- IUserManager $userManager, -- IConfig $config, -- ISession $session, -- IUserSession $userSession, -- IURLGenerator $urlGenerator, -- ILogger $logger, -+ IRequest $request, -+ IUserManager $userManager, -+ IConfig $config, -+ ISession $session, -+ IUserSession $userSession, -+ IURLGenerator $urlGenerator, -+ ILogger $logger, - Manager $twoFactorManager, - Defaults $defaults, - Throttler $throttler) { @@ -130,7 +130,10 @@ class LoginController extends Controller { } $this->userSession->logout(); - + - $response = new RedirectResponse($this->urlGenerator->linkToRouteAbsolute('core.login.showLoginForm')); + $redirectUrl = $this->config->getSystemValue('logout_url', -+ $this->urlGenerator->linkToRouteAbsolute('core.login.showLoginForm') -+ ); ++ $this->urlGenerator->linkToRouteAbsolute('core.login.showLoginForm')); ++ + $response = new RedirectResponse($redirectUrl); + $this->session->set('clearingExecutionContexts', '1'); + $this->session->close(); $response->addHeader('Clear-Site-Data', '"cache", "storage", "executionContexts"'); - return $response; - } -@@ -303,10 +306,10 @@ class LoginController extends Controller { - $previousUser = $user; - $user = $users[0]->getUID(); - if($user !== $previousUser) { -- $loginResult = $this->userManager->checkPassword($user, $password); -- } -+ $loginResult = $this->userManager->checkPassword($user, $password); - } - } -+ } - - if ($loginResult === false) { - $this->logger->warning('Login failed: \''. $user . -@@ -314,7 +317,7 @@ class LoginController extends Controller { - ['app' => 'core']); - return $this->createLoginFailedResponse($user, $originalUser, - $redirect_url, self::LOGIN_MSG_INVALIDPASSWORD); -- } -+ } - - // TODO: remove password checks from above and let the user session handle failures - // requires https://github.com/owncloud/core/pull/24616 From c21f0ef3fc9f378e9daa23694b8f16df8ab729ba Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Sat, 20 Jul 2019 14:44:07 +0200 Subject: [PATCH 077/204] Upgrade to upstream version 15.0.10 --- README.md | 2 +- manifest.json | 2 +- scripts/upgrade.d/upgrade.last.sh | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 2ee59a9..5d39562 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to own data. A personal cloud which run on your own server. With Nextcloud you can synchronize your files over your devices. -**Shipped version:** 15.0.9 +**Shipped version:** 15.0.10 ## Screenshots diff --git a/manifest.json b/manifest.json index 07e7cac..8230b77 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Access & share your files, calendars, contacts, mail & more from any device, on your terms", "fr": "Consultez et partagez vos fichiers, agendas, carnets d'adresses, emails et bien plus depuis les appareils de votre choix, sous vos conditions" }, - "version": "15.0.9~ynh1", + "version": "15.0.10~ynh1", "url": "https://nextcloud.com", "license": "AGPL-3.0", "maintainer": { diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index f0da93d..6df5d10 100755 --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -1,10 +1,10 @@ #!/bin/bash # Last available nextcloud version -next_version="15.0.9" +next_version="15.0.10" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="7b33e210f64fb94c9a92aa31f087136db73bdacd1aaa7df2905bc7c0887edd5c" +nextcloud_source_sha256="494511fcda6e823e8dfb571fcf3b9ddc433148449acb080104f4165d2f2f4d43" # This function will only be executed upon applying the last upgrade referenced above last_upgrade_operations () { From b60691e6f30382c288606f8859b1ccd7eefa8f81 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Sat, 10 Aug 2019 14:46:34 +0200 Subject: [PATCH 078/204] Fix scope of exec_occ function --- scripts/upgrade | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 8e75255..320381e 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -176,16 +176,16 @@ ynh_install_app_dependencies $pkg_dependencies # VERSION TO THE NEXT ONE #================================================= +# Define a function to execute commands with `occ` +exec_occ() { +(cd "$final_path" && exec_as "$app" \ + php occ --no-interaction --no-ansi "$@") +} + if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading nextcloud..." --weight=3 - # Define a function to execute commands with `occ` - exec_occ() { - (cd "$final_path" && exec_as "$app" \ - php occ --no-interaction --no-ansi "$@") - } - # Load the last available version source upgrade.d/upgrade.last.sh last_version=$next_version From 8482d00f1a43aed960a4e5a91ebb889c4d182b67 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Sat, 10 Aug 2019 17:20:47 +0200 Subject: [PATCH 079/204] Change scope of create_external_storage as well --- scripts/upgrade | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 320381e..f6bdc01 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -182,6 +182,18 @@ exec_occ() { php occ --no-interaction --no-ansi "$@") } +# Define a function to add an external storage +# Create the external storage for the given folders and enable sharing +create_external_storage() { +local datadir="$1" +local mount_name="$2" +local mount_id=`exec_occ files_external:create --output=json \ + "$mount_name" 'local' 'null::null' -c "datadir=$datadir" || true` +! [[ $mount_id =~ ^[0-9]+$ ]] \ + && ynh_print_warn --message="Unable to create external storage" \ + || exec_occ files_external:option "$mount_id" enable_sharing true +} + if [ "$upgrade_type" == "UPGRADE_APP" ] then ynh_script_progression --message="Upgrading nextcloud..." --weight=3 @@ -323,18 +335,6 @@ then # MOUNT HOME FOLDERS AS EXTERNAL STORAGE #================================================= - # Define a function to add an external storage - # Create the external storage for the given folders and enable sharing - create_external_storage() { - local datadir="$1" - local mount_name="$2" - local mount_id=`exec_occ files_external:create --output=json \ - "$mount_name" 'local' 'null::null' -c "datadir=$datadir" || true` - ! [[ $mount_id =~ ^[0-9]+$ ]] \ - && ynh_print_warn --message="Unable to create external storage" \ - || exec_occ files_external:option "$mount_id" enable_sharing true - } - # Enable External Storage and create local mount to home folder as needed if [ $user_home -eq 1 ]; then exec_occ app:enable files_external From b9d8e09fee2538e76b93e86b2829dcd51c7df867 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Sat, 10 Aug 2019 19:28:43 +0200 Subject: [PATCH 080/204] Change also datadir's scope --- scripts/upgrade | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index f6bdc01..2e3f7ec 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -193,6 +193,8 @@ local mount_id=`exec_occ files_external:create --output=json \ && ynh_print_warn --message="Unable to create external storage" \ || exec_occ files_external:option "$mount_id" enable_sharing true } +# Define app's data directory +datadir="/home/yunohost.app/$app/data" if [ "$upgrade_type" == "UPGRADE_APP" ] then @@ -202,9 +204,6 @@ then source upgrade.d/upgrade.last.sh last_version=$next_version - # Define app's data directory - datadir="/home/yunohost.app/$app/data" - # Set write access for the following commands chown -R $app: "$final_path" "$datadir" From a870ce02377788333914baea21face817ac25a06 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Sun, 11 Aug 2019 14:11:28 +0200 Subject: [PATCH 081/204] Avoid OPcache errors (fixes #209) --- conf/php-fpm.conf | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf index f13ed6d..31d62f2 100644 --- a/conf/php-fpm.conf +++ b/conf/php-fpm.conf @@ -433,7 +433,10 @@ env[PATH] = $PATH php_value[upload_max_filesize] = 10G php_value[post_max_size] = 10G php_value[default_charset] = UTF-8 -php_value[opcache.enable]=1 +; OPcache is already activated by default +; php_value[opcache.enable]=1 +; The following parameters are nevertheless recommended for Nextcloud +; see here: https://docs.nextcloud.com/server/15/admin_manual/installation/server_tuning.html#enable-php-opcache php_value[opcache.enable_cli]=1 php_value[opcache.interned_strings_buffer]=8 php_value[opcache.max_accelerated_files]=10000 From ed94f7a3a3d63180e07960c937886aba87f17754 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 13 Aug 2019 18:37:19 +0200 Subject: [PATCH 082/204] Fix typo --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 7556b9d..a9152cd 100755 --- a/scripts/install +++ b/scripts/install @@ -69,7 +69,7 @@ ynh_mysql_setup_db --db_user=$db_name --db_name=$db_name #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Setting up source files..."5 +ynh_script_progression --message="Setting up source files..." # Load the last available version source upgrade.d/upgrade.last.sh From 4318322f6304161f7ba212e9160d6348f66875dd Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Sat, 17 Aug 2019 09:06:49 +0200 Subject: [PATCH 083/204] Upgrade to upstream version 15.0.11 --- README.md | 2 +- manifest.json | 2 +- scripts/upgrade.d/upgrade.last.sh | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5d39562..86e1b19 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to own data. A personal cloud which run on your own server. With Nextcloud you can synchronize your files over your devices. -**Shipped version:** 15.0.10 +**Shipped version:** 15.0.11 ## Screenshots diff --git a/manifest.json b/manifest.json index 8230b77..a774500 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Access & share your files, calendars, contacts, mail & more from any device, on your terms", "fr": "Consultez et partagez vos fichiers, agendas, carnets d'adresses, emails et bien plus depuis les appareils de votre choix, sous vos conditions" }, - "version": "15.0.10~ynh1", + "version": "15.0.11~ynh1", "url": "https://nextcloud.com", "license": "AGPL-3.0", "maintainer": { diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index 6df5d10..2c20cb6 100755 --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -1,10 +1,10 @@ #!/bin/bash # Last available nextcloud version -next_version="15.0.10" +next_version="15.0.11" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="494511fcda6e823e8dfb571fcf3b9ddc433148449acb080104f4165d2f2f4d43" +nextcloud_source_sha256="59cdde8e7a4a15606efc246e37adf6401b0b4a60f33289be8725d675b9c2ae26" # This function will only be executed upon applying the last upgrade referenced above last_upgrade_operations () { From d3028dbe3a903b788d0425cdb03ca945bd4aba68 Mon Sep 17 00:00:00 2001 From: Kay0u Date: Sat, 28 Sep 2019 00:12:29 +0200 Subject: [PATCH 084/204] 17.0.0 --- conf/nginx.conf | 2 +- conf/php-fpm.conf | 5 +- manifest.json | 2 +- scripts/_common.sh | 377 +++++++++++++++++++++++++++++- scripts/backup | 2 +- scripts/change_url | 2 +- scripts/install | 10 +- scripts/remove | 2 + scripts/restore | 4 +- scripts/upgrade | 13 +- scripts/upgrade.d/upgrade.15.sh | 4 +- scripts/upgrade.d/upgrade.16.sh | 16 ++ scripts/upgrade.d/upgrade.last.sh | 4 +- 13 files changed, 422 insertions(+), 21 deletions(-) create mode 100755 scripts/upgrade.d/upgrade.16.sh diff --git a/conf/nginx.conf b/conf/nginx.conf index 6c5d7ec..319ecca 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -71,7 +71,7 @@ location ^~ __PATH__/ { fastcgi_param HTTPS on; fastcgi_param modHeadersAvailable true; fastcgi_param REMOTE_USER $remote_user; - fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock; + fastcgi_pass unix:/var/run/php/php__PHP_VERSION__-fpm-__NAME__.sock; fastcgi_intercept_errors on; } diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf index f13ed6d..1924bbe 100644 --- a/conf/php-fpm.conf +++ b/conf/php-fpm.conf @@ -33,7 +33,7 @@ group = __USER__ ; (IPv6 and IPv4-mapped) on a specific port; ; '/path/to/unix/socket' - to listen on a unix socket. ; Note: This value is mandatory. -listen = /var/run/php/php7.0-fpm-__NAMETOCHANGE__.sock +listen = /var/run/php/php__PHPVERSION__-fpm-__NAMETOCHANGE__.sock ; Set listen(2) backlog. ; Default Value: 511 (-1 on FreeBSD and OpenBSD) @@ -229,7 +229,7 @@ pm.max_spare_servers = 3 ; last request memory: 0 ; ; Note: There is a real-time FPM status monitoring sample web page available -; It's available in: /usr/share/php/7.0/fpm/status.html +; It's available in: /usr/share/php/__PHPVERSION__/fpm/status.html ; ; Note: The value must start with a leading slash (/). The value can be ; anything, but it may not be a good idea to use the .php extension or it @@ -430,6 +430,7 @@ env[PATH] = $PATH ; php_admin_flag[short_open_tag] = On ; Additional php.ini defines, specific to this pool of workers. +php_admin_value[memory_limit] = 512M php_value[upload_max_filesize] = 10G php_value[post_max_size] = 10G php_value[default_charset] = UTF-8 diff --git a/manifest.json b/manifest.json index da09519..c226b22 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Access & share your files, calendars, contacts, mail & more from any device, on your terms", "fr": "Consultez et partagez vos fichiers, agendas, carnets d'adresses, emails et bien plus depuis les appareils de votre choix, sous vos conditions" }, - "version": "16.0.1~ynh1", + "version": "17.0.0~ynh1", "url": "https://nextcloud.com", "license": "AGPL-3.0", "maintainer": { diff --git a/scripts/_common.sh b/scripts/_common.sh index 413f729..827b6d6 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -3,7 +3,10 @@ # COMMON VARIABLES #================================================= -pkg_dependencies="php-gd php-json php-intl php-mcrypt php-curl php-apcu php-redis php-ldap php-imagick php-zip php-mbstring php-xml imagemagick acl tar smbclient at" +pkg_dependencies="imagemagick acl tar smbclient at" + +php_version="7.1" +extra_pkg_dependencies="php${php_version}-gd php${php_version}-json php${php_version}-intl php${php_version}-mcrypt php${php_version}-curl php${php_version}-apcu php${php_version}-redis php${php_version}-ldap php${php_version}-imagick php${php_version}-zip php${php_version}-mbstring php${php_version}-xml php${php_version}-mysql" #================================================= # EXPERIMENTAL HELPERS @@ -381,3 +384,375 @@ ynh_multimedia_addaccess () { groupadd -f multimedia usermod -a -G multimedia $user_name } + +# Install another version of php. +# +# usage: ynh_install_php --phpversion=phpversion [--package=packages] +# | arg: -v, --phpversion - Version of php to install. Can be one of 7.1, 7.2 or 7.3 +# | arg: -p, --package - Additionnal php packages to install +ynh_install_php () { + # Declare an array to define the options of this helper. + local legacy_args=vp + declare -Ar args_array=( [v]=phpversion= [p]=package= ) + local phpversion + local package + # Manage arguments with getopts + ynh_handle_getopts_args "$@" + package=${package:-} + + # Store php_version into the config of this app + ynh_app_setting_set $app php_version $phpversion + + if [ "$phpversion" == "7.0" ] + then + ynh_die --message="Do not use ynh_install_php to install php7.0" + fi + + # Store the ID of this app and the version of php requested for it + echo "$YNH_APP_INSTANCE_NAME:$phpversion" | tee --append "/etc/php/ynh_app_version" + + # Add an extra repository for those packages + ynh_install_extra_repo --repo="https://packages.sury.org/php/ $(lsb_release -sc) main" --key="https://packages.sury.org/php/apt.gpg" --priority=995 --name=extra_php_version + + # Install requested dependencies from this extra repository. + # Install php-fpm first, otherwise php will install apache as a dependency. + ynh_add_app_dependencies --package="php${phpversion}-fpm" + ynh_add_app_dependencies --package="php$phpversion php${phpversion}-common $package" + + # Set php7.0 back as the default version for php-cli. + update-alternatives --set php /usr/bin/php7.0 + + # Remove this extra repository after packages are installed + ynh_remove_extra_repo --name=extra_php_version + + # Advertise service in admin panel + yunohost service add php${phpversion}-fpm --log "/var/log/php${phpversion}-fpm.log" +} + +ynh_remove_php () { + # Get the version of php used by this app + local phpversion=$(ynh_app_setting_get $app php_version) + + if [ "$phpversion" == "7.0" ] || [ -z "$phpversion" ] + then + if [ "$phpversion" == "7.0" ] + then + ynh_print_err "Do not use ynh_remove_php to install php7.0" + fi + return 0 + fi + + # Remove the line for this app + sed --in-place "/$YNH_APP_INSTANCE_NAME:$phpversion/d" "/etc/php/ynh_app_version" + + # If no other app uses this version of php, remove it. + if ! grep --quiet "$phpversion" "/etc/php/ynh_app_version" + then + # Purge php dependences for this version. + ynh_package_autopurge "php$phpversion php${phpversion}-fpm php${phpversion}-common" + # Remove the service from the admin panel + yunohost service remove php${phpversion}-fpm + fi + + # If no other app uses alternate php versions, remove the extra repo for php + if [ ! -s "/etc/php/ynh_app_version" ] + then + ynh_secure_remove /etc/php/ynh_app_version + fi +} + +#================================================= +# FUTURE OFFICIAL HELPERS +#================================================= +# Pin a repository. +# +# usage: ynh_pin_repo --package=packages --pin=pin_filter [--priority=priority_value] [--name=name] [--append] +# | arg: -p, --package - Packages concerned by the pin. Or all, *. +# | arg: -i, --pin - Filter for the pin. +# | arg: -p, --priority - Priority for the pin +# | arg: -n, --name - Name for the files for this repo, $app as default value. +# | arg: -a, --append - Do not overwrite existing files. +# +# See https://manpages.debian.org/stretch/apt/apt_preferences.5.en.html for information about pinning. +# +ynh_pin_repo () { + # Declare an array to define the options of this helper. + local legacy_args=pirna + declare -Ar args_array=( [p]=package= [i]=pin= [r]=priority= [n]=name= [a]=append ) + local package + local pin + local priority + local name + local append + # Manage arguments with getopts + ynh_handle_getopts_args "$@" + package="${package:-*}" + priority=${priority:-50} + name="${name:-$app}" + append=${append:-0} + + if [ $append -eq 1 ] + then + append="tee -a" + else + append="tee" + fi + + mkdir -p "/etc/apt/preferences.d" + echo "Package: $package +Pin: $pin +Pin-Priority: $priority" \ + | $append "/etc/apt/preferences.d/$name" +} + +# Add a repository. +# +# usage: ynh_add_repo --uri=uri --suite=suite --component=component [--name=name] [--append] +# | arg: -u, --uri - Uri of the repository. +# | arg: -s, --suite - Suite of the repository. +# | arg: -c, --component - Component of the repository. +# | arg: -n, --name - Name for the files for this repo, $app as default value. +# | arg: -a, --append - Do not overwrite existing files. +# +# Example for a repo like deb http://forge.yunohost.org/debian/ stretch stable +# uri suite component +# ynh_add_repo --uri=http://forge.yunohost.org/debian/ --suite=stretch --component=stable +# +ynh_add_repo () { + # Declare an array to define the options of this helper. + local legacy_args=uscna + declare -Ar args_array=( [u]=uri= [s]=suite= [c]=component= [n]=name= [a]=append ) + local uri + local suite + local component + local name + local append + # Manage arguments with getopts + ynh_handle_getopts_args "$@" + name="${name:-$app}" + append=${append:-0} + + if [ $append -eq 1 ] + then + append="tee -a" + else + append="tee" + fi + + mkdir -p "/etc/apt/sources.list.d" + # Add the new repo in sources.list.d + echo "deb $uri $suite $component" \ + | $append "/etc/apt/sources.list.d/$name.list" +} + +# Add an extra repository correctly, pin it and get the key. +# +# usage: ynh_install_extra_repo --repo="repo" [--key=key_url] [--priority=priority_value] [--name=name] [--append] +# | arg: -r, --repo - Complete url of the extra repository. +# | arg: -k, --key - url to get the public key. +# | arg: -p, --priority - Priority for the pin +# | arg: -n, --name - Name for the files for this repo, $app as default value. +# | arg: -a, --append - Do not overwrite existing files. +ynh_install_extra_repo () { + # Declare an array to define the options of this helper. + local legacy_args=rkpna + declare -Ar args_array=( [r]=repo= [k]=key= [p]=priority= [n]=name= [a]=append ) + local repo + local key + local priority + local name + local append + # Manage arguments with getopts + ynh_handle_getopts_args "$@" + name="${name:-$app}" + append=${append:-0} + key=${key:-0} + priority=${priority:-} + + if [ $append -eq 1 ] + then + append="--append" + wget_append="tee -a" + else + append="" + wget_append="tee" + fi + + # Split the repository into uri, suite and components. + # Remove "deb " at the beginning of the repo. + repo="${repo#deb }" + + # Get the uri + local uri="$(echo "$repo" | awk '{ print $1 }')" + + # Get the suite + local suite="$(echo "$repo" | awk '{ print $2 }')" + + # Get the components + local component="${repo##$uri $suite }" + + # Add the repository into sources.list.d + ynh_add_repo --uri="$uri" --suite="$suite" --component="$component" --name="$name" $append + + # Pin the new repo with the default priority, so it won't be used for upgrades. + # Build $pin from the uri without http and any sub path + local pin="${uri#*://}" + pin="${pin%%/*}" + # Set a priority only if asked + if [ -n "$priority" ] + then + priority="--priority=$priority" + fi + ynh_pin_repo --package="*" --pin="origin \"$pin\"" $priority --name="$name" $append + + # Get the public key for the repo + if [ -n "$key" ] + then + mkdir -p "/etc/apt/trusted.gpg.d" + wget -q "$key" -O - | gpg --dearmor | $wget_append /etc/apt/trusted.gpg.d/$name.gpg > /dev/null + fi + + # Update the list of package with the new repo + ynh_package_update +} + +# Remove an extra repository and the assiociated configuration. +# +# usage: ynh_remove_extra_repo [--name=name] +# | arg: -n, --name - Name for the files for this repo, $app as default value. +ynh_remove_extra_repo () { + # Declare an array to define the options of this helper. + local legacy_args=n + declare -Ar args_array=( [n]=name= ) + local name + # Manage arguments with getopts + ynh_handle_getopts_args "$@" + name="${name:-$app}" + + ynh_secure_remove "/etc/apt/sources.list.d/$name.list" + ynh_secure_remove "/etc/apt/preferences.d/$name" + ynh_secure_remove "/etc/apt/trusted.gpg.d/$name.gpg" + ynh_secure_remove "/etc/apt/trusted.gpg.d/$name.asc" + + # Update the list of package to exclude the old repo + ynh_package_update +} + +# Install packages from an extra repository properly. +# +# usage: ynh_install_extra_app_dependencies --repo="repo" --package="dep1 dep2" [--key=key_url] [--name=name] +# | arg: -r, --repo - Complete url of the extra repository. +# | arg: -p, --package - The packages to install from this extra repository +# | arg: -k, --key - url to get the public key. +# | arg: -n, --name - Name for the files for this repo, $app as default value. +ynh_install_extra_app_dependencies () { + # Declare an array to define the options of this helper. + local legacy_args=rpkn + declare -Ar args_array=( [r]=repo= [p]=package= [k]=key= [n]=name= ) + local repo + local package + local key + local name + # Manage arguments with getopts + ynh_handle_getopts_args "$@" + name="${name:-$app}" + key=${key:-0} + + # Set a key only if asked + if [ -n "$key" ] + then + key="--key=$key" + fi + # Add an extra repository for those packages + ynh_install_extra_repo --repo="$repo" $key --priority=995 --name=$name + + # Install requested dependencies from this extra repository. + ynh_add_app_dependencies --package="$package" + + # Remove this extra repository after packages are installed + ynh_remove_extra_repo --name=$app +} + +#================================================= + +# patched version of ynh_install_app_dependencies to be used with ynh_add_app_dependencies + +# Define and install dependencies with a equivs control file +# This helper can/should only be called once per app +# +# usage: ynh_install_app_dependencies dep [dep [...]] +# | arg: dep - the package name to install in dependence +# You can give a choice between some package with this syntax : "dep1|dep2" +# Example : ynh_install_app_dependencies dep1 dep2 "dep3|dep4|dep5" +# This mean in the dependence tree : dep1 & dep2 & (dep3 | dep4 | dep5) +# +# Requires YunoHost version 2.6.4 or higher. +ynh_install_app_dependencies () { + local dependencies=$@ + dependencies="$(echo "$dependencies" | sed 's/\([^\<=\>]\)\ \([^(]\)/\1, \2/g')" + dependencies=${dependencies//|/ | } + local manifest_path="../manifest.json" + if [ ! -e "$manifest_path" ]; then + manifest_path="../settings/manifest.json" # Into the restore script, the manifest is not at the same place + fi + + local version=$(grep '\"version\": ' "$manifest_path" | cut -d '"' -f 4) # Retrieve the version number in the manifest file. + if [ ${#version} -eq 0 ]; then + version="1.0" + fi + local dep_app=${app//_/-} # Replace all '_' by '-' + + # Handle specific versions + if [[ "$dependencies" =~ [\<=\>] ]] + then + # Replace version specifications by relationships syntax + # https://www.debian.org/doc/debian-policy/ch-relationships.html + # Sed clarification + # [^(\<=\>] ignore if it begins by ( or < = >. To not apply twice. + # [\<=\>] matches < = or > + # \+ matches one or more occurence of the previous characters, for >= or >>. + # [^,]\+ matches all characters except ',' + # Ex: package>=1.0 will be replaced by package (>= 1.0) + dependencies="$(echo "$dependencies" | sed 's/\([^(\<=\>]\)\([\<=\>]\+\)\([^,]\+\)/\1 (\2 \3)/g')" + fi + + cat > /tmp/${dep_app}-ynh-deps.control << EOF # Make a control file for equivs-build +Section: misc +Priority: optional +Package: ${dep_app}-ynh-deps +Version: ${version} +Depends: ${dependencies} +Architecture: all +Description: Fake package for $app (YunoHost app) dependencies + This meta-package is only responsible of installing its dependencies. +EOF + ynh_package_install_from_equivs /tmp/${dep_app}-ynh-deps.control \ + || ynh_die --message="Unable to install dependencies" # Install the fake package and its dependencies + rm /tmp/${dep_app}-ynh-deps.control + ynh_app_setting_set --app=$app --key=apt_dependencies --value="$dependencies" +} + +ynh_add_app_dependencies () { + # Declare an array to define the options of this helper. + local legacy_args=pr + declare -Ar args_array=( [p]=package= [r]=replace) + local package + local replace + # Manage arguments with getopts + ynh_handle_getopts_args "$@" + replace=${replace:-0} + + local current_dependencies="" + if [ $replace -eq 0 ] + then + local dep_app=${app//_/-} # Replace all '_' by '-' + if ynh_package_is_installed --package="${dep_app}-ynh-deps" + then + current_dependencies="$(dpkg-query --show --showformat='${Depends}' ${dep_app}-ynh-deps) " + fi + + current_dependencies=${current_dependencies// | /|} + fi + + ynh_install_app_dependencies "${current_dependencies}${package}" +} \ No newline at end of file diff --git a/scripts/backup b/scripts/backup index 5dbc43c..2c80fa1 100755 --- a/scripts/backup +++ b/scripts/backup @@ -48,7 +48,7 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= ynh_script_progression --message="Backing up php-fpm configuration..." -ynh_backup --src_path="/etc/php/7.0/fpm/pool.d/$app.conf" +ynh_backup --src_path="/etc/php/$php_version/fpm/pool.d/$app.conf" #================================================= # BACKUP THE MYSQL DATABASE diff --git a/scripts/change_url b/scripts/change_url index 83bcb4e..3b55694 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -63,7 +63,7 @@ then domain="$old_domain" path_url="$new_path" # Create a dedicated nginx config - ynh_add_nginx_config + ynh_add_nginx_config php_version fi # Change the domain for nginx diff --git a/scripts/install b/scripts/install index 7556b9d..f713e22 100755 --- a/scripts/install +++ b/scripts/install @@ -57,6 +57,8 @@ ynh_script_progression --message="Installing dependencies..." --weight=60 ynh_install_app_dependencies $pkg_dependencies +ynh_install_php --phpversion="$php_version" --package="$extra_pkg_dependencies" + #================================================= # CREATE A MYSQL DATABASE #================================================= @@ -99,7 +101,7 @@ then fi # Create a dedicated nginx config -ynh_add_nginx_config +ynh_add_nginx_config php_version #================================================= # CREATE DEDICATED USER @@ -115,7 +117,7 @@ ynh_system_user_create --username=$app ynh_script_progression --message="Configuring php-fpm..." --weight=2 # Create a dedicated php-fpm config -ynh_add_fpm_config +ynh_add_fpm_config --phpversion="$php_version" #================================================= # SPECIFIC SETUP @@ -136,7 +138,7 @@ 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 occ --no-interaction --no-ansi "$@") + php$php_version occ --no-interaction --no-ansi "$@") } # Set write access for the following commands @@ -272,7 +274,7 @@ exec_occ background:cron # POST-INSTALL MAINTENANCE #================================================= -(cd /tmp ; at now + 10 minutes <<< "(cd $final_path ; sudo -u $app php occ db:add-missing-indices ; sudo -u $app php occ db:convert-filecache-bigint -n) > /tmp/${app}_maintenance.log") +(cd /tmp ; at now + 10 minutes <<< "(cd $final_path ; sudo -u $app php${php_version} occ db:add-missing-indices ; sudo -u $app php${php_version} occ db:convert-filecache-bigint -n) > /tmp/${app}_maintenance.log") #================================================= # CONFIGURE THE HOOK FILE FOR USER CREATE diff --git a/scripts/remove b/scripts/remove index 9ea5c15..2da18b5 100755 --- a/scripts/remove +++ b/scripts/remove @@ -30,6 +30,8 @@ ynh_script_progression --message="Removing dependencies..." --weight=20 # Remove metapackage and its dependencies ynh_remove_app_dependencies +ynh_remove_php + #================================================= # REMOVE THE MYSQL DATABASE #================================================= diff --git a/scripts/restore b/scripts/restore index c6c8e7e..233640c 100755 --- a/scripts/restore +++ b/scripts/restore @@ -83,7 +83,7 @@ ynh_system_user_create --username=$app # RESTORE THE PHP-FPM CONFIGURATION #================================================= -ynh_restore_file --origin_path="/etc/php/7.0/fpm/pool.d/$app.conf" +ynh_restore_file --origin_path="/etc/php/$php_version/fpm/pool.d/$app.conf" #================================================= # SPECIFIC RESTORATION @@ -95,6 +95,8 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=60 # Define and install dependencies ynh_install_app_dependencies $pkg_dependencies +ynh_install_php --phpversion="$php_version" --package="$extra_pkg_dependencies" + #================================================= # RESTORE THE CRON FILE #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 423d909..233616b 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -139,7 +139,7 @@ then fi # Create a dedicated nginx config -ynh_add_nginx_config +ynh_add_nginx_config php_version #================================================= # CREATE DEDICATED USER @@ -155,11 +155,11 @@ ynh_system_user_create --username=$app ynh_script_progression --message="Upgrading php-fpm configuration..." --weight=2 # Create a dedicated php-fpm config -ynh_add_fpm_config +ynh_add_fpm_config --phpversion="$php_version" # Delete existing ini configuration file (backward compatibility) -if [ -f /etc/php/7.0/fpm/conf.d/20-$app.ini ]; then - ynh_secure_remove --file=/etc/php/7.0/fpm/conf.d/20-$app.ini +if [ -f /etc/php/$php_version/fpm/conf.d/20-$app.ini ]; then + ynh_secure_remove --file=/etc/php/$php_version/fpm/conf.d/20-$app.ini fi #================================================= @@ -169,6 +169,9 @@ ynh_script_progression --message="Upgrading dependencies..." --weight=7 ynh_install_app_dependencies $pkg_dependencies +ynh_remove_php +ynh_install_php --phpversion="$php_version" --package="$extra_pkg_dependencies" + #================================================= # SPECIFIC UPGRADE #================================================= @@ -183,7 +186,7 @@ then # Define a function to execute commands with `occ` exec_occ() { (cd "$final_path" && exec_as "$app" \ - php occ --no-interaction --no-ansi "$@") + php$php_version occ --no-interaction --no-ansi "$@") } # Load the last available version diff --git a/scripts/upgrade.d/upgrade.15.sh b/scripts/upgrade.d/upgrade.15.sh index a8c2c1c..919c6ad 100644 --- a/scripts/upgrade.d/upgrade.15.sh +++ b/scripts/upgrade.d/upgrade.15.sh @@ -1,7 +1,7 @@ #!/bin/bash # Last available nextcloud version -next_version="16.0.0" +next_version="15.0.11" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="4532f7028b1d9bf060f75ac4fbbde52a59ecd9c9155f3178a038d3cf3609402e" +nextcloud_source_sha256="59cdde8e7a4a15606efc246e37adf6401b0b4a60f33289be8725d675b9c2ae26" diff --git a/scripts/upgrade.d/upgrade.16.sh b/scripts/upgrade.d/upgrade.16.sh new file mode 100755 index 0000000..ec2b0c6 --- /dev/null +++ b/scripts/upgrade.d/upgrade.16.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# Last available nextcloud version +next_version="16.0.5" + +# Nextcloud tarball checksum sha256 +nextcloud_source_sha256="8709c64fa776fd731c8e5f1ab25d592a2e690e5e18a81601cccf363795fae551" + +# This function will only be executed upon applying the last upgrade referenced above +last_upgrade_operations () { + # Patch nextcloud files only for the last version + cp -a ../sources/patches_last_version/* ../sources/patches + + # Execute post-upgrade operations later on + (cd /tmp ; at now + 10 minutes <<< "(cd $final_path ; sudo -u $app php occ db:add-missing-indices ; sudo -u $app php occ db:convert-filecache-bigint -n) > /tmp/${app}_maintenance.log") +} diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index 9ec64be..0cf5c28 100755 --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -1,10 +1,10 @@ #!/bin/bash # Last available nextcloud version -next_version="16.0.1" +next_version="17.0.0" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="a80ce586e9e930b2fba69707311e575346cd4dc4402e84678c730f9930d78aee" +nextcloud_source_sha256="6081421b33ecdb3130b2bfb2293a3f4045aeb0b471ee570e675de3d931a142a6" # This function will only be executed upon applying the last upgrade referenced above last_upgrade_operations () { From 55bf354201dfd8e30b4b06826e1067d78b90f8c1 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Sat, 28 Sep 2019 10:32:33 +0200 Subject: [PATCH 085/204] Upgrade to upstream version 15.0.12 --- README.md | 2 +- manifest.json | 2 +- scripts/upgrade.d/upgrade.last.sh | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 86e1b19..1c68a9a 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to own data. A personal cloud which run on your own server. With Nextcloud you can synchronize your files over your devices. -**Shipped version:** 15.0.11 +**Shipped version:** 15.0.12 ## Screenshots diff --git a/manifest.json b/manifest.json index a774500..fc300a4 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Access & share your files, calendars, contacts, mail & more from any device, on your terms", "fr": "Consultez et partagez vos fichiers, agendas, carnets d'adresses, emails et bien plus depuis les appareils de votre choix, sous vos conditions" }, - "version": "15.0.11~ynh1", + "version": "15.0.12~ynh1", "url": "https://nextcloud.com", "license": "AGPL-3.0", "maintainer": { diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index 2c20cb6..8baa589 100755 --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -1,10 +1,10 @@ #!/bin/bash # Last available nextcloud version -next_version="15.0.11" +next_version="15.0.12" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="59cdde8e7a4a15606efc246e37adf6401b0b4a60f33289be8725d675b9c2ae26" +nextcloud_source_sha256="708966e18c2bacc33ea0dca59449d4c4f9b5ec935f0ef6fa5d02bfe8ae10f682" # This function will only be executed upon applying the last upgrade referenced above last_upgrade_operations () { From 67eaa300177edc89931efc469424ede2cc3ff849 Mon Sep 17 00:00:00 2001 From: Jeremy MANSON Date: Fri, 25 Oct 2019 08:39:06 +0200 Subject: [PATCH 086/204] Urgent security issue in NGINX/php-fpm more information here : https://nextcloud.com/blog/urgent-security-issue-in-nginx-php-fpm/ --- conf/nginx.conf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 6c5d7ec..ec7954b 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -47,7 +47,7 @@ location ^~ __PATH__/ { #rewrite ^/.well-known/host-meta.json __PATH__/public.php?service=host-meta-json last; location __PATH__/ { - rewrite ^ __PATH__/index.php$request_uri; + rewrite ^ __PATH__/index.php; } location = __PATH__/robots.txt { @@ -66,6 +66,7 @@ location ^~ __PATH__/ { location ~ ^__PATH__/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+|ocm-provider/.+)\.php(/.*|)$ { include fastcgi_params; fastcgi_split_path_info ^(.+\.php)(/.+)$; + try_files $fastcgi_script_name =404; fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param HTTPS on; From 91eeac6073909e65ae4a1eacd1dd8191a1e2d5b8 Mon Sep 17 00:00:00 2001 From: Kayou Date: Wed, 6 Nov 2019 18:43:09 +0900 Subject: [PATCH 087/204] Fix upgrade --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 2c3c5a7..adee1a8 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -182,7 +182,7 @@ ynh_install_php --phpversion="$php_version" --package="$extra_pkg_dependencies" # Define a function to execute commands with `occ` exec_occ() { (cd "$final_path" && exec_as "$app" \ - php occ --no-interaction --no-ansi "$@") + php$php_version occ --no-interaction --no-ansi "$@") } # Define a function to add an external storage From 6022bb10fc0536a48f7fab3c218d130fdf4180f0 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Sun, 10 Nov 2019 11:30:44 +0100 Subject: [PATCH 088/204] Upgrade to upstream version 15.0.13 --- README.md | 2 +- manifest.json | 2 +- scripts/upgrade.d/upgrade.last.sh | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1c68a9a..623f479 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to own data. A personal cloud which run on your own server. With Nextcloud you can synchronize your files over your devices. -**Shipped version:** 15.0.12 +**Shipped version:** 15.0.13 ## Screenshots diff --git a/manifest.json b/manifest.json index fc300a4..0cbe377 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Access & share your files, calendars, contacts, mail & more from any device, on your terms", "fr": "Consultez et partagez vos fichiers, agendas, carnets d'adresses, emails et bien plus depuis les appareils de votre choix, sous vos conditions" }, - "version": "15.0.12~ynh1", + "version": "15.0.13~ynh1", "url": "https://nextcloud.com", "license": "AGPL-3.0", "maintainer": { diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index 8baa589..24c4f6c 100755 --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -1,10 +1,10 @@ #!/bin/bash # Last available nextcloud version -next_version="15.0.12" +next_version="15.0.13" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="708966e18c2bacc33ea0dca59449d4c4f9b5ec935f0ef6fa5d02bfe8ae10f682" +nextcloud_source_sha256="ede96f2af9a69a067710a57984e23aac0d8cf491ff91c128920af2482ad87425" # This function will only be executed upon applying the last upgrade referenced above last_upgrade_operations () { From 52bffc479c17cffd897a22617ef303ac9dd3e110 Mon Sep 17 00:00:00 2001 From: maniack Date: Fri, 6 Dec 2019 20:37:01 +0100 Subject: [PATCH 089/204] Use ynh_get_scalable_phpfpm --- conf/extra_php-fpm.conf | 15 +++ config_panel.toml | 26 ++++ scripts/_common.sh | 228 ++++++++++++++++++++++++++++++++++++ scripts/_ynh_add_fpm_config | 128 ++++++++++++++++++++ scripts/config | 97 +++++++++++++++ scripts/install | 3 +- scripts/upgrade | 18 ++- 7 files changed, 513 insertions(+), 2 deletions(-) create mode 100644 conf/extra_php-fpm.conf create mode 100644 config_panel.toml create mode 100644 scripts/_ynh_add_fpm_config create mode 100644 scripts/config diff --git a/conf/extra_php-fpm.conf b/conf/extra_php-fpm.conf new file mode 100644 index 0000000..b626ca2 --- /dev/null +++ b/conf/extra_php-fpm.conf @@ -0,0 +1,15 @@ + +; Additional php.ini defines, specific to this pool of workers. +php_value[upload_max_filesize] = 10G +php_value[post_max_size] = 10G +php_value[default_charset] = UTF-8 +; OPcache is already activated by default +; php_value[opcache.enable]=1 +; The following parameters are nevertheless recommended for Nextcloud +; see here: https://docs.nextcloud.com/server/15/admin_manual/installation/server_tuning.html#enable-php-opcache +php_value[opcache.enable_cli]=1 +php_value[opcache.interned_strings_buffer]=8 +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 diff --git a/config_panel.toml b/config_panel.toml new file mode 100644 index 0000000..b88c83e --- /dev/null +++ b/config_panel.toml @@ -0,0 +1,26 @@ +version = "0.1" +name = "Nextcloud configuration panel" + +[main] +name = "Nextcloud configuration" + + [main.php_fpm_config] + name = "PHP-FPM configuration" + + [main.php_fpm_config.footprint] + 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 ?" + 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 ?" + 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/scripts/_common.sh b/scripts/_common.sh index 413f729..249fb61 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -339,6 +339,234 @@ ynh_smart_mktemp () { echo "$(sudo mktemp --directory --tmpdir="$tmpdir")" } +#================================================= + +# Check the amount of available RAM +# +# usage: ynh_check_ram [--required=RAM required in Mb] [--no_swap|--only_swap] [--free_ram] +# | arg: -r, --required= - Amount of RAM required in Mb. The helper will return 0 is there's enough RAM, or 1 otherwise. +# If --required isn't set, the helper will print the amount of RAM, in Mb. +# | arg: -s, --no_swap - Ignore swap +# | arg: -o, --only_swap - Ignore real RAM, consider only swap. +# | arg: -f, --free_ram - Count only free RAM, not the total amount of RAM available. +ynh_check_ram () { + # Declare an array to define the options of this helper. + declare -Ar args_array=( [r]=required= [s]=no_swap [o]=only_swap [f]=free_ram ) + local required + local no_swap + local only_swap + # Manage arguments with getopts + ynh_handle_getopts_args "$@" + required=${required:-} + no_swap=${no_swap:-0} + only_swap=${only_swap:-0} + + local total_ram=$(vmstat --stats --unit M | grep "total memory" | awk '{print $1}') + local total_swap=$(vmstat --stats --unit M | grep "total swap" | awk '{print $1}') + local total_ram_swap=$(( total_ram + total_swap )) + + local free_ram=$(vmstat --stats --unit M | grep "free memory" | awk '{print $1}') + local free_swap=$(vmstat --stats --unit M | grep "free swap" | awk '{print $1}') + local free_ram_swap=$(( free_ram + free_swap )) + + # Use the total amount of ram + local ram=$total_ram_swap + if [ $free_ram -eq 1 ] + then + # Use the total amount of free ram + ram=$free_ram_swap + if [ $no_swap -eq 1 ] + then + # Use only the amount of free ram + ram=$free_ram + elif [ $only_swap -eq 1 ] + then + # Use only the amount of free swap + ram=$free_swap + fi + else + if [ $no_swap -eq 1 ] + then + # Use only the amount of free ram + ram=$total_ram + elif [ $only_swap -eq 1 ] + then + # Use only the amount of free swap + ram=$total_swap + fi + fi + + if [ -n "$required" ] + then + # Return 1 if the amount of ram isn't enough. + if [ $ram -lt $required ] + then + return 1 + else + return 0 + fi + + # If no RAM is required, return the amount of available ram. + else + echo $ram + fi +} + +#================================================= + +# Define the values to configure php-fpm +# +# usage: ynh_get_scalable_phpfpm --usage=usage --footprint=footprint [--print] +# | arg: -f, --footprint - Memory footprint of the service (low/medium/high). +# low - Less than 20Mb of ram by pool. +# medium - Between 20Mb and 40Mb of ram by pool. +# high - More than 40Mb of ram by pool. +# Or specify exactly the footprint, the load of the service as Mb by pool instead of having a standard value. +# To have this value, use the following command and stress the service. +# watch -n0.5 ps -o user,cmd,%cpu,rss -u APP +# +# | arg: -u, --usage - Expected usage of the service (low/medium/high). +# low - Personal usage, behind the sso. +# medium - Low usage, few people or/and publicly accessible. +# high - High usage, frequently visited website. +# +# | arg: -p, --print - Print the result +# +# +# +# The footprint of the service will be used to defined the maximum footprint we can allow, which is half the maximum RAM. +# So it will be used to defined 'pm.max_children' +# A lower value for the footprint will allow more children for 'pm.max_children'. And so for +# 'pm.start_servers', 'pm.min_spare_servers' and 'pm.max_spare_servers' which are defined from the +# value of 'pm.max_children' +# NOTE: 'pm.max_children' can't exceed 4 times the number of processor's cores. +# +# The usage value will defined the way php will handle the children for the pool. +# A value set as 'low' will set the process manager to 'ondemand'. Children will start only if the +# service is used, otherwise no child will stay alive. This config gives the lower footprint when the +# service is idle. But will use more proc since it has to start a child as soon it's used. +# Set as 'medium', the process manager will be at dynamic. If the service is idle, a number of children +# equal to pm.min_spare_servers will stay alive. So the service can be quick to answer to any request. +# The number of children can grow if needed. The footprint can stay low if the service is idle, but +# not null. The impact on the proc is a little bit less than 'ondemand' as there's always a few +# children already available. +# Set as 'high', the process manager will be set at 'static'. There will be always as many children as +# 'pm.max_children', the footprint is important (but will be set as maximum a quarter of the maximum +# RAM) but the impact on the proc is lower. The service will be quick to answer as there's always many +# children ready to answer. +ynh_get_scalable_phpfpm () { + local legacy_args=ufp + # Declare an array to define the options of this helper. + declare -Ar args_array=( [u]=usage= [f]=footprint= [p]=print ) + local usage + local footprint + local print + # Manage arguments with getopts + ynh_handle_getopts_args "$@" + # Set all characters as lowercase + footprint=${footprint,,} + usage=${usage,,} + print=${print:-0} + + if [ "$footprint" = "low" ] + then + footprint=20 + elif [ "$footprint" = "medium" ] + then + footprint=35 + elif [ "$footprint" = "high" ] + then + footprint=50 + fi + + # Define the way the process manager handle child processes. + if [ "$usage" = "low" ] + then + php_pm=ondemand + elif [ "$usage" = "medium" ] + then + php_pm=dynamic + elif [ "$usage" = "high" ] + then + php_pm=static + else + ynh_die --message="Does not recognize '$usage' as an usage value." + fi + + # Get the total of RAM available, except swap. + local max_ram=$(ynh_check_ram --no_swap) + + less0() { + # Do not allow value below 1 + if [ $1 -le 0 ] + then + echo 1 + else + echo $1 + fi + } + + # Define pm.max_children + # The value of pm.max_children is the total amount of ram divide by 2 and divide again by the footprint of a pool for this app. + # So if php-fpm start the maximum of children, it won't exceed half of the ram. + php_max_children=$(( $max_ram / 2 / $footprint )) + # If process manager is set as static, use half less children. + # Used as static, there's always as many children as the value of pm.max_children + if [ "$php_pm" = "static" ] + then + php_max_children=$(( $php_max_children / 2 )) + fi + php_max_children=$(less0 $php_max_children) + + # To not overload the proc, limit the number of children to 4 times the number of cores. + local core_number=$(nproc) + local max_proc=$(( $core_number * 4 )) + if [ $php_max_children -gt $max_proc ] + then + php_max_children=$max_proc + fi + + if [ "$php_pm" = "dynamic" ] + then + # Define pm.start_servers, pm.min_spare_servers and pm.max_spare_servers for a dynamic process manager + php_min_spare_servers=$(( $php_max_children / 8 )) + php_min_spare_servers=$(less0 $php_min_spare_servers) + + php_max_spare_servers=$(( $php_max_children / 2 )) + php_max_spare_servers=$(less0 $php_max_spare_servers) + + php_start_servers=$(( $php_min_spare_servers + ( $php_max_spare_servers - $php_min_spare_servers ) /2 )) + php_start_servers=$(less0 $php_start_servers) + else + php_min_spare_servers=0 + php_max_spare_servers=0 + php_start_servers=0 + fi + + if [ $print -eq 1 ] + then + ynh_debug --message="Footprint=${footprint}Mb by pool." + ynh_debug --message="Process manager=$php_pm" + ynh_debug --message="Max RAM=${max_ram}Mb" + if [ "$php_pm" != "static" ]; then + ynh_debug --message="\nMax estimated footprint=$(( $php_max_children * $footprint ))" + ynh_debug --message="Min estimated footprint=$(( $php_min_spare_servers * $footprint ))" + fi + if [ "$php_pm" = "dynamic" ]; then + ynh_debug --message="Estimated average footprint=$(( $php_max_spare_servers * $footprint ))" + elif [ "$php_pm" = "static" ]; then + ynh_debug --message="Estimated footprint=$(( $php_max_children * $footprint ))" + fi + ynh_debug --message="\nRaw php-fpm values:" + ynh_debug --message="pm.max_children = $php_max_children" + if [ "$php_pm" = "dynamic" ]; then + ynh_debug --message="pm.start_servers = $php_start_servers" + ynh_debug --message="pm.min_spare_servers = $php_min_spare_servers" + ynh_debug --message="pm.max_spare_servers = $php_max_spare_servers" + fi + fi +} + #================================================= # FUTURE OFFICIAL HELPERS #================================================= diff --git a/scripts/_ynh_add_fpm_config b/scripts/_ynh_add_fpm_config new file mode 100644 index 0000000..9d4dacf --- /dev/null +++ b/scripts/_ynh_add_fpm_config @@ -0,0 +1,128 @@ +#!/bin/bash + +# Create a dedicated php-fpm config +# +# usage 1: ynh_add_fpm_config [--phpversion=7.X] [--use_template] +# | arg: -v, --phpversion - Version of php to use. +# | arg: -t, --use_template - Use this helper in template mode. +# +# ----------------------------------------------------------------------------- +# +# usage 2: ynh_add_fpm_config [--phpversion=7.X] --usage=usage --footprint=footprint +# | arg: -v, --phpversion - Version of php to use.# +# | arg: -f, --footprint - Memory footprint of the service (low/medium/high). +# low - Less than 20Mb of ram by pool. +# medium - Between 20Mb and 40Mb of ram by pool. +# high - More than 40Mb of ram by pool. +# Or specify exactly the footprint, the load of the service as Mb by pool instead of having a standard value. +# To have this value, use the following command and stress the service. +# watch -n0.5 ps -o user,cmd,%cpu,rss -u APP +# +# | arg: -u, --usage - Expected usage of the service (low/medium/high). +# low - Personal usage, behind the sso. +# medium - Low usage, few people or/and publicly accessible. +# high - High usage, frequently visited website. +# +# Requires YunoHost version 2.7.2 or higher. +ynh_add_fpm_config () { + # Declare an array to define the options of this helper. + local legacy_args=vtuf + declare -Ar args_array=( [v]=phpversion= [t]=use_template [u]=usage= [f]=footprint= ) + local phpversion + local use_template + local usage + local footprint + # Manage arguments with getopts + ynh_handle_getopts_args "$@" + # The default behaviour is to use the template. + use_template="${use_template:-1}" + usage="${usage:-}" + footprint="${footprint:-}" + if [ -n "$usage" ] || [ -n "$footprint" ]; then + use_template=0 + fi + + # Configure PHP-FPM 7.0 by default + phpversion="${phpversion:-7.0}" + + local fpm_config_dir="/etc/php/$phpversion/fpm" + local fpm_service="php${phpversion}-fpm" + # Configure PHP-FPM 5 on Debian Jessie + if [ "$(ynh_get_debian_release)" == "jessie" ]; then + fpm_config_dir="/etc/php5/fpm" + fpm_service="php5-fpm" + fi + ynh_app_setting_set --app=$app --key=fpm_config_dir --value="$fpm_config_dir" + ynh_app_setting_set --app=$app --key=fpm_service --value="$fpm_service" + finalphpconf="$fpm_config_dir/pool.d/$app.conf" + ynh_backup_if_checksum_is_different --file="$finalphpconf" + + if [ $use_template -eq 1 ] + then + # Usage 1, use the template in ../conf/php-fpm.conf + sudo cp ../conf/php-fpm.conf "$finalphpconf" + ynh_replace_string --match_string="__NAMETOCHANGE__" --replace_string="$app" --target_file="$finalphpconf" + ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$finalphpconf" + ynh_replace_string --match_string="__USER__" --replace_string="$app" --target_file="$finalphpconf" + ynh_replace_string --match_string="__PHPVERSION__" --replace_string="$phpversion" --target_file="$finalphpconf" + + else + # Usage 2, generate a php-fpm config file with ynh_get_scalable_phpfpm + ynh_get_scalable_phpfpm --usage=$usage --footprint=$footprint + + # Copy the default file + sudo cp "$fpm_config_dir/pool.d/www.conf" "$finalphpconf" + + # Replace standard variables into the default file + ynh_replace_string --match_string="^\[www\]" --replace_string="[$app]" --target_file="$finalphpconf" + ynh_replace_string --match_string=".*listen = .*" --replace_string="listen = /var/run/php/php7.0-fpm-$app.sock" --target_file="$finalphpconf" + ynh_replace_string --match_string="^user = .*" --replace_string="user = $app" --target_file="$finalphpconf" + ynh_replace_string --match_string="^group = .*" --replace_string="group = $app" --target_file="$finalphpconf" + ynh_replace_string --match_string=".*chdir = .*" --replace_string="chdir = $final_path" --target_file="$finalphpconf" + + # Configure fpm children + ynh_replace_string --match_string=".*pm = .*" --replace_string="pm = $php_pm" --target_file="$finalphpconf" + ynh_replace_string --match_string=".*pm.max_children = .*" --replace_string="pm.max_children = $php_max_children" --target_file="$finalphpconf" + ynh_replace_string --match_string=".*pm.max_requests = .*" --replace_string="pm.max_requests = 500" --target_file="$finalphpconf" + ynh_replace_string --match_string=".*request_terminate_timeout = .*" --replace_string="request_terminate_timeout = 1d" --target_file="$finalphpconf" + if [ "$php_pm" = "dynamic" ] + then + ynh_replace_string --match_string=".*pm.start_servers = .*" --replace_string="pm.start_servers = $php_start_servers" --target_file="$finalphpconf" + ynh_replace_string --match_string=".*pm.min_spare_servers = .*" --replace_string="pm.min_spare_servers = $php_min_spare_servers" --target_file="$finalphpconf" + ynh_replace_string --match_string=".*pm.max_spare_servers = .*" --replace_string="pm.max_spare_servers = $php_max_spare_servers" --target_file="$finalphpconf" + elif [ "$php_pm" = "ondemand" ] + then + ynh_replace_string --match_string=".*pm.process_idle_timeout = .*" --replace_string="pm.process_idle_timeout = 10s" --target_file="$finalphpconf" + fi + + # Comment unused parameters + if [ "$php_pm" != "dynamic" ] + then + ynh_replace_string --match_string=".*\(pm.start_servers = .*\)" --replace_string=";\1" --target_file="$finalphpconf" + ynh_replace_string --match_string=".*\(pm.min_spare_servers = .*\)" --replace_string=";\1" --target_file="$finalphpconf" + ynh_replace_string --match_string=".*\(pm.max_spare_servers = .*\)" --replace_string=";\1" --target_file="$finalphpconf" + fi + if [ "$php_pm" != "ondemand" ] + then + ynh_replace_string --match_string=".*\(pm.process_idle_timeout = .*\)" --replace_string=";\1" --target_file="$finalphpconf" + fi + + # Concatene the extra config. + if [ -e ../conf/extra_php-fpm.conf ]; then + cat ../conf/extra_php-fpm.conf >> "$finalphpconf" + fi + fi + sudo chown root: "$finalphpconf" + ynh_store_file_checksum --file="$finalphpconf" + + if [ -e "../conf/php-fpm.ini" ] + then + echo "Packagers ! Please do not use a separate php ini file, merge your directives in the pool file instead." >&2 + finalphpini="$fpm_config_dir/conf.d/20-$app.ini" + ynh_backup_if_checksum_is_different "$finalphpini" + sudo cp ../conf/php-fpm.ini "$finalphpini" + sudo chown root: "$finalphpini" + ynh_store_file_checksum "$finalphpini" + fi + ynh_systemd_action --service_name=$fpm_service --action=reload +} diff --git a/scripts/config b/scripts/config new file mode 100644 index 0000000..b0314f0 --- /dev/null +++ b/scripts/config @@ -0,0 +1,97 @@ +#!/bin/bash + +#================================================= +# GENERIC STARTING +#================================================= +# IMPORT GENERIC HELPERS +#================================================= + +source _common.sh +source /usr/share/yunohost/helpers +source _ynh_add_fpm_config + +#================================================= +# RETRIEVE ARGUMENTS +#================================================= + +app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID} + +#================================================= +# LOAD VALUES +#================================================= + +# Load the real value from the app config or elsewhere. +# Then get the value from the form. +# If the form has a value for a variable, take the value from the form, +# Otherwise, keep the value from the app config. + +# Footprint for php-fpm +old_fpm_footprint="$(ynh_app_setting_get --app=$app --key=fpm_footprint)" +fpm_footprint="${YNH_CONFIG_MAIN_PHP_FPM_CONFIG_FOOTPRINT:-$old_fpm_footprint}" + +# Free footprint value for php-fpm +# Check if fpm_footprint is an integer +if [ "$fpm_footprint" -eq "$fpm_footprint" ] 2> /dev/null +then + # If fpm_footprint is an integer, that's a numeric value for the footprint + old_free_footprint=$fpm_footprint + fpm_footprint=specific +else + old_free_footprint=0 +fi +free_footprint="${YNH_CONFIG_MAIN_PHP_FPM_CONFIG_FREE_FOOTPRINT:-$old_free_footprint}" + +# Usage for php-fpm +old_fpm_usage="$(ynh_app_setting_get --app=$app --key=fpm_usage)" +fpm_usage="${YNH_CONFIG_MAIN_PHP_FPM_CONFIG_USAGE:-$old_fpm_usage}" + +#================================================= +# SHOW_CONFIG FUNCTION FOR 'SHOW' COMMAND +#================================================= + +show_config() { + # here you are supposed to read some config file/database/other then print the values + # ynh_return "YNH_CONFIG_${PANEL_ID}_${SECTION_ID}_${OPTION_ID}=value" + + ynh_return "YNH_CONFIG_MAIN_PHP_FPM_CONFIG_FOOTPRINT=$fpm_footprint" + ynh_return "YNH_CONFIG_MAIN_PHP_FPM_CONFIG_FREE_FOOTPRINT=$free_footprint" + ynh_return "YNH_CONFIG_MAIN_PHP_FPM_CONFIG_USAGE=$fpm_usage" +} + +#================================================= +# MODIFY THE CONFIGURATION +#================================================= + +apply_config() { + + #================================================= + # RECONFIGURE PHP-FPM + #================================================= + + if [ "$fpm_usage" != "$old_fpm_usage" ] || [ "$fpm_footprint" != "$old_fpm_footprint" ] || [ "$free_footprint" != "$old_free_footprint" ] + then + # If fpm_footprint is set to 'specific', use $free_footprint value. + if [ "$fpm_footprint" = "specific" ] + then + fpm_footprint=$free_footprint + fi + + if [ "$fpm_footprint" != "0" ] + then + ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint + else + ynh_print_err --message="When selecting 'specific', you have to set a footprint value into the field below." + fi + fi +} + +#================================================= +# GENERIC FINALIZATION +#================================================= +# SELECT THE ACTION FOLLOWING THE GIVEN ARGUMENT +#================================================= + +case $1 in + show) show_config;; + apply) apply_config;; +esac diff --git a/scripts/install b/scripts/install index a9152cd..377e82d 100755 --- a/scripts/install +++ b/scripts/install @@ -8,6 +8,7 @@ source _common.sh source /usr/share/yunohost/helpers +source _ynh_add_fpm_config #================================================= # MANAGE SCRIPT FAILURE @@ -115,7 +116,7 @@ ynh_system_user_create --username=$app ynh_script_progression --message="Configuring php-fpm..." --weight=2 # Create a dedicated php-fpm config -ynh_add_fpm_config +ynh_add_fpm_config --usage=medium --footprint=high #================================================= # SPECIFIC SETUP diff --git a/scripts/upgrade b/scripts/upgrade index 2e3f7ec..c436f71 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -8,6 +8,7 @@ source _common.sh source /usr/share/yunohost/helpers +source _ynh_add_fpm_config #================================================= # LOAD SETTINGS @@ -23,6 +24,9 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) db_name=$(ynh_app_setting_get --app=$app --key=db_name) user_home=$(ynh_app_setting_get --app=$app --key=user_home) +fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint) +fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage) + #================================================= # CHECK VERSION #================================================= @@ -49,6 +53,18 @@ 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 +# If fpm_footprint doesn't exist, create it +if [ -z "$fpm_footprint" ]; then + fpm_footprint=high + ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint +fi + +# If fpm_usage doesn't exist, create it +if [ -z "$fpm_usage" ]; then + fpm_usage=medium + ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage +fi + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -155,7 +171,7 @@ ynh_system_user_create --username=$app ynh_script_progression --message="Upgrading php-fpm configuration..." --weight=2 # Create a dedicated php-fpm config -ynh_add_fpm_config +ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint # Delete existing ini configuration file (backward compatibility) if [ -f /etc/php/7.0/fpm/conf.d/20-$app.ini ]; then From ddf88db7d9299cc9a9753f829366e6e2d7b22475 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Thu, 19 Dec 2019 16:15:25 +0100 Subject: [PATCH 090/204] Upgrade to upstream version 15.0.14 --- README.md | 2 +- manifest.json | 2 +- scripts/upgrade.d/upgrade.last.sh | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 623f479..a7c334d 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to own data. A personal cloud which run on your own server. With Nextcloud you can synchronize your files over your devices. -**Shipped version:** 15.0.13 +**Shipped version:** 15.0.14 ## Screenshots diff --git a/manifest.json b/manifest.json index 0cbe377..4aaacf5 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Access & share your files, calendars, contacts, mail & more from any device, on your terms", "fr": "Consultez et partagez vos fichiers, agendas, carnets d'adresses, emails et bien plus depuis les appareils de votre choix, sous vos conditions" }, - "version": "15.0.13~ynh1", + "version": "15.0.14~ynh1", "url": "https://nextcloud.com", "license": "AGPL-3.0", "maintainer": { diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index 24c4f6c..b06bacc 100755 --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -1,10 +1,10 @@ #!/bin/bash # Last available nextcloud version -next_version="15.0.13" +next_version="15.0.14" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="ede96f2af9a69a067710a57984e23aac0d8cf491ff91c128920af2482ad87425" +nextcloud_source_sha256="6916f3ae828ee481f79a53a722c631be1ee1dc319180492ea8459f526516f2a7" # This function will only be executed upon applying the last upgrade referenced above last_upgrade_operations () { From ab21540c7489d01baa5e8702ded8d05c776a9cfb Mon Sep 17 00:00:00 2001 From: ljf Date: Sun, 26 Jan 2020 14:49:19 +0100 Subject: [PATCH 091/204] [enh] Upgrade to 18.0.0 --- README.md | 5 ++--- manifest.json | 2 +- scripts/upgrade.d/upgrade.17.sh | 16 ++++++++++++++++ scripts/upgrade.d/upgrade.last.sh | 4 ++-- 4 files changed, 21 insertions(+), 6 deletions(-) create mode 100755 scripts/upgrade.d/upgrade.17.sh diff --git a/README.md b/README.md index 17b28b2..2aeec1b 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to own data. A personal cloud which run on your own server. With Nextcloud you can synchronize your files over your devices. -**Shipped version:** 17.0.0 +**Shipped version:** 18.0.0 ## Screenshots @@ -27,7 +27,7 @@ you can synchronize your files over your devices. ## Documentation - * Official documentation: https://docs.nextcloud.com/server/15/user_manual/ + * Official documentation: https://docs.nextcloud.com/server/18/user_manual/ * YunoHost documentation: https://github.com/YunoHost/doc/blob/master/app_nextcloud_fr.md ## YunoHost specific features @@ -49,7 +49,6 @@ this package: * x86-64b - [![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/) -* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/nextcloud%20%28Apps%29.svg)](https://ci-stretch.nohost.me/ci/apps/nextcloud/) ## Limitations diff --git a/manifest.json b/manifest.json index c226b22..c44ff48 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Access & share your files, calendars, contacts, mail & more from any device, on your terms", "fr": "Consultez et partagez vos fichiers, agendas, carnets d'adresses, emails et bien plus depuis les appareils de votre choix, sous vos conditions" }, - "version": "17.0.0~ynh1", + "version": "18.0.0~ynh1", "url": "https://nextcloud.com", "license": "AGPL-3.0", "maintainer": { diff --git a/scripts/upgrade.d/upgrade.17.sh b/scripts/upgrade.d/upgrade.17.sh new file mode 100755 index 0000000..0cf5c28 --- /dev/null +++ b/scripts/upgrade.d/upgrade.17.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# Last available nextcloud version +next_version="17.0.0" + +# Nextcloud tarball checksum sha256 +nextcloud_source_sha256="6081421b33ecdb3130b2bfb2293a3f4045aeb0b471ee570e675de3d931a142a6" + +# This function will only be executed upon applying the last upgrade referenced above +last_upgrade_operations () { + # Patch nextcloud files only for the last version + cp -a ../sources/patches_last_version/* ../sources/patches + + # Execute post-upgrade operations later on + (cd /tmp ; at now + 10 minutes <<< "(cd $final_path ; sudo -u $app php occ db:add-missing-indices ; sudo -u $app php occ db:convert-filecache-bigint -n) > /tmp/${app}_maintenance.log") +} diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index 0cf5c28..a18a141 100755 --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -1,10 +1,10 @@ #!/bin/bash # Last available nextcloud version -next_version="17.0.0" +next_version="18.0.0" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="6081421b33ecdb3130b2bfb2293a3f4045aeb0b471ee570e675de3d931a142a6" +nextcloud_source_sha256="194095a5586d84040bc455f77b8aa6c80f9a6a6dd713c9aebdad046713d4267b" # This function will only be executed upon applying the last upgrade referenced above last_upgrade_operations () { From 1a76a85fcdc6706c4f1799af6874a2853224301a Mon Sep 17 00:00:00 2001 From: ljf Date: Sun, 26 Jan 2020 14:49:52 +0100 Subject: [PATCH 092/204] [enh] Add some missing apps dependencies --- scripts/_common.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 827b6d6..4293190 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -6,7 +6,7 @@ pkg_dependencies="imagemagick acl tar smbclient at" php_version="7.1" -extra_pkg_dependencies="php${php_version}-gd php${php_version}-json php${php_version}-intl php${php_version}-mcrypt php${php_version}-curl php${php_version}-apcu php${php_version}-redis php${php_version}-ldap php${php_version}-imagick php${php_version}-zip php${php_version}-mbstring php${php_version}-xml php${php_version}-mysql" +extra_pkg_dependencies="php${php_version}-bz2 php${php_version}-imap php${php_version}-smbclient php${php_version}-gmp php${php_version}-gd php${php_version}-json php${php_version}-intl php${php_version}-mcrypt php${php_version}-curl php${php_version}-apcu php${php_version}-redis php${php_version}-ldap php${php_version}-imagick php${php_version}-zip php${php_version}-mbstring php${php_version}-xml php${php_version}-mysql" #================================================= # EXPERIMENTAL HELPERS @@ -755,4 +755,4 @@ ynh_add_app_dependencies () { fi ynh_install_app_dependencies "${current_dependencies}${package}" -} \ No newline at end of file +} From d860ba45a07fbffae759816549580698ccee7c7f Mon Sep 17 00:00:00 2001 From: ljf Date: Sun, 26 Jan 2020 15:34:04 +0100 Subject: [PATCH 093/204] [enh] Add some missing apps dependencies --- scripts/_common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 4293190..787235b 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,7 +5,7 @@ pkg_dependencies="imagemagick acl tar smbclient at" -php_version="7.1" +php_version="7.2" extra_pkg_dependencies="php${php_version}-bz2 php${php_version}-imap php${php_version}-smbclient php${php_version}-gmp php${php_version}-gd php${php_version}-json php${php_version}-intl php${php_version}-mcrypt php${php_version}-curl php${php_version}-apcu php${php_version}-redis php${php_version}-ldap php${php_version}-imagick php${php_version}-zip php${php_version}-mbstring php${php_version}-xml php${php_version}-mysql" #================================================= From c864e086625363d91dde6ba78a652011a991a027 Mon Sep 17 00:00:00 2001 From: ljf Date: Sun, 26 Jan 2020 16:42:45 +0100 Subject: [PATCH 094/204] [fix] php7.2-mcrypt doesn't exist --- scripts/_common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 787235b..f3597e7 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -6,7 +6,7 @@ pkg_dependencies="imagemagick acl tar smbclient at" php_version="7.2" -extra_pkg_dependencies="php${php_version}-bz2 php${php_version}-imap php${php_version}-smbclient php${php_version}-gmp php${php_version}-gd php${php_version}-json php${php_version}-intl php${php_version}-mcrypt php${php_version}-curl php${php_version}-apcu php${php_version}-redis php${php_version}-ldap php${php_version}-imagick php${php_version}-zip php${php_version}-mbstring php${php_version}-xml php${php_version}-mysql" +extra_pkg_dependencies="php${php_version}-bz2 php${php_version}-imap php${php_version}-smbclient php${php_version}-gmp php${php_version}-gd php${php_version}-json php${php_version}-intl php${php_version}-curl php${php_version}-apcu php${php_version}-redis php${php_version}-ldap php${php_version}-imagick php${php_version}-zip php${php_version}-mbstring php${php_version}-xml php${php_version}-mysql" #================================================= # EXPERIMENTAL HELPERS From 4678cc52aa41dfc467c2fe4df314546ec5df0949 Mon Sep 17 00:00:00 2001 From: ljf Date: Thu, 6 Feb 2020 22:39:02 +0100 Subject: [PATCH 095/204] [fix] New nginx config for nextcloud 18 --- conf/nginx.conf | 60 +++++++++++++++++++++++++++++++++++++------------ 1 file changed, 46 insertions(+), 14 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 4634c6e..9a9b78c 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -4,6 +4,18 @@ location = /.well-known/carddav { location = /.well-known/caldav { return 301 https://$server_name__PATH__/remote.php/dav; } +location = /.well-known/host-meta { + return 301 $scheme://$host:$server_port__PATH__/public.php?service=host-meta; +} +location = /.well-known/host-meta.json { + return 301 $scheme://$host:$server_port__PATH__/public.php?service=host-meta-json; +} +location = /.well-known/webfinger { + return 301 $scheme://$host:$server_port__PATH__/public.php?service=webfinger; +} +location = /.well-known/nodeinfo { + return 301 $scheme://$host:$server_port__PATH__/public.php?service=nodeinfo; +} #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; location ^~ __PATH__/ { @@ -41,11 +53,6 @@ location ^~ __PATH__/ { error_page 403 __PATH__/core/templates/403.php; error_page 404 __PATH__/core/templates/404.php; - # The following 2 rules are only needed for the user_webfinger app. - # Uncomment it if you're planning to use this app. - #rewrite ^/.well-known/host-meta __PATH__/public.php?service=host-meta last; - #rewrite ^/.well-known/host-meta.json __PATH__/public.php?service=host-meta-json last; - location __PATH__/ { rewrite ^ __PATH__/index.php; } @@ -63,26 +70,50 @@ location ^~ __PATH__/ { deny all; } - location ~ ^__PATH__/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+|ocm-provider/.+)\.php(/.*|)$ { - include fastcgi_params; - fastcgi_split_path_info ^(.+\.php)(/.+)$; + location ~ ^__PATH__/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|oc[ms]-provider/.+)\.php(?:$|/)$ { + fastcgi_split_path_info ^(.+?\.php)(/.*|)$; + set $path_info $fastcgi_path_info; try_files $fastcgi_script_name =404; - fastcgi_param SCRIPT_FILENAME $request_filename; - fastcgi_param PATH_INFO $fastcgi_path_info; + include fastcgi_params; + + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_INFO $path_info; fastcgi_param HTTPS on; + # Avoid sending the security headers twice fastcgi_param modHeadersAvailable true; - fastcgi_param REMOTE_USER $remote_user; + # Enable pretty urls + fastcgi_param front_controller_active true; fastcgi_pass unix:/var/run/php/php__PHP_VERSION__-fpm-__NAME__.sock; fastcgi_intercept_errors on; + fastcgi_request_buffering off; + fastcgi_param REMOTE_USER $remote_user; } - location ~ ^__PATH__/(?:updater|ocs-provider|ocm-provider)(?:$|/) { + location ~ ^__PATH__/(?:updater|oc[ms]-provider)(?:$|/) { try_files $uri/ =404; index index.php; } + location = __PATH__/core/js/oc.js { + rewrite ^ /index.php$request_uri; + } + + location = __PATH__/core/preview.png { + rewrite ^ /index.php$request_uri; + } + + location ~* ^__PATH__/(?:css|js)/ { + rewrite ^ /index.php$request_uri; + } + + location ~* ^__PATH__/apps/theming/img/core/filetypes/ { + rewrite ^ /index.php$request_uri; + } + + + # Adding the cache control header for js and css files - location ~ ^__PATH__/.+[^/]\.(?:css|js|woff2?|svg|gif)$ { + location ~ \.(?:css|js|woff2?|svg|gif)$ { try_files $uri __PATH__/index.php$request_uri; more_set_headers "Cache-Control: public, max-age=15778463"; # Add headers to serve security related headers @@ -98,7 +129,8 @@ location ^~ __PATH__/ { access_log off; } - location ~* \.(?:png|html|ttf|ico|jpg|jpeg)$ { + location ~* \.(?:png|html|ttf|ico|jpg|jpeg|bcmap)$ { + try_files $uri /index.php$request_uri; # Optional: Don't log access to other assets access_log off; } From 3b22e1cb02d7a923d743a3709f9e3a11df1819b8 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Sun, 16 Feb 2020 10:33:19 +0100 Subject: [PATCH 096/204] Fix subfolder installation --- conf/nginx.conf | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 9a9b78c..08a19e5 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -70,13 +70,13 @@ location ^~ __PATH__/ { deny all; } - location ~ ^__PATH__/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|oc[ms]-provider/.+)\.php(?:$|/)$ { + location ~ ^__PATH__/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|oc[ms]-provider/.+)\.php(/.*|)$ { fastcgi_split_path_info ^(.+?\.php)(/.*|)$; set $path_info $fastcgi_path_info; try_files $fastcgi_script_name =404; include fastcgi_params; - - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + + fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_param PATH_INFO $path_info; fastcgi_param HTTPS on; # Avoid sending the security headers twice @@ -95,19 +95,19 @@ location ^~ __PATH__/ { } location = __PATH__/core/js/oc.js { - rewrite ^ /index.php$request_uri; + rewrite ^ __PATH__/index.php$request_uri; } location = __PATH__/core/preview.png { - rewrite ^ /index.php$request_uri; + rewrite ^ __PATH__/index.php$request_uri; } location ~* ^__PATH__/(?:css|js)/ { - rewrite ^ /index.php$request_uri; + rewrite ^ __PATH__/index.php$request_uri; } - + location ~* ^__PATH__/apps/theming/img/core/filetypes/ { - rewrite ^ /index.php$request_uri; + rewrite ^ __PATH__/index.php$request_uri; } @@ -130,7 +130,7 @@ location ^~ __PATH__/ { } location ~* \.(?:png|html|ttf|ico|jpg|jpeg|bcmap)$ { - try_files $uri /index.php$request_uri; + try_files $uri __PATH__/index.php$request_uri; # Optional: Don't log access to other assets access_log off; } From 46a5f7515b504d755e2cc8a07ccff2b259b5765e Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Sun, 16 Feb 2020 11:54:07 +0100 Subject: [PATCH 097/204] Upgrade to upstream version 18.0.1 --- README.md | 2 +- manifest.json | 2 +- scripts/upgrade.d/upgrade.last.sh | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a7d1a99..1a824fc 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ own data. A personal cloud which run on your own server. With Nextcloud you can synchronize your files over your devices. -**Shipped version:** 18.0.0 +**Shipped version:** 18.0.1 ## Screenshots diff --git a/manifest.json b/manifest.json index c44ff48..152293a 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Access & share your files, calendars, contacts, mail & more from any device, on your terms", "fr": "Consultez et partagez vos fichiers, agendas, carnets d'adresses, emails et bien plus depuis les appareils de votre choix, sous vos conditions" }, - "version": "18.0.0~ynh1", + "version": "18.0.1~ynh1", "url": "https://nextcloud.com", "license": "AGPL-3.0", "maintainer": { diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index a18a141..436062a 100755 --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -1,10 +1,10 @@ #!/bin/bash # Last available nextcloud version -next_version="18.0.0" +next_version="18.0.1" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="194095a5586d84040bc455f77b8aa6c80f9a6a6dd713c9aebdad046713d4267b" +nextcloud_source_sha256="770faf34b8f0d81273623daed4d64ec7919c38dfeb07328b613058addbed19c0" # This function will only be executed upon applying the last upgrade referenced above last_upgrade_operations () { From 87fdec25e752e5b38575a6f755b145541cd16997 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Sun, 16 Feb 2020 14:29:19 +0100 Subject: [PATCH 098/204] Small patch fix --- .../app-00-add-logout_url-conf.patch | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/sources/patches_last_version/app-00-add-logout_url-conf.patch b/sources/patches_last_version/app-00-add-logout_url-conf.patch index c0df1ab..919f2d4 100644 --- a/sources/patches_last_version/app-00-add-logout_url-conf.patch +++ b/sources/patches_last_version/app-00-add-logout_url-conf.patch @@ -1,8 +1,8 @@ diff --git a/core/Controller/LoginController.php b/core/Controller/LoginController.php -index 85d3b6b837..e7b9f5fdca 100644 +index 13aef8f67a..55d8dbf9d1 100644 --- a/core/Controller/LoginController.php +++ b/core/Controller/LoginController.php -@@ -130,11 +130,12 @@ class LoginController extends Controller { +@@ -119,11 +119,12 @@ class LoginController extends Controller { } $this->userSession->logout(); @@ -18,13 +18,4 @@ index 85d3b6b837..e7b9f5fdca 100644 + $response = new RedirectResponse($redirectUrl); $this->session->set('clearingExecutionContexts', '1'); $this->session->close(); - $response->addHeader('Clear-Site-Data', '"cache", "storage", "executionContexts"'); -@@ -329,7 +330,7 @@ class LoginController extends Controller { - ['app' => 'core']); - return $this->createLoginFailedResponse($user, $originalUser, - $redirect_url, self::LOGIN_MSG_INVALIDPASSWORD); -- } -+ } - // TODO: remove password checks from above and let the user session handle failures - // requires https://github.com/owncloud/core/pull/24616 From 463640dcd54c64a947f81943f3ce9d1aaffc37bf Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Sun, 16 Feb 2020 15:28:50 +0100 Subject: [PATCH 099/204] Fix change_url --- scripts/change_url | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/change_url b/scripts/change_url index 3b55694..dbc7d66 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -84,7 +84,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" \ - php occ --no-interaction --no-ansi "$@") + php${php_version} occ --no-interaction --no-ansi "$@") } if [ $change_domain -eq 1 ] From 5310fd9f3ac905f7a565cdf4b4b4c8db46e9bd86 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Wed, 19 Feb 2020 07:11:40 +0100 Subject: [PATCH 100/204] Fix upgrade from previous version --- check_process | 6 +++--- scripts/_ynh_add_fpm_config | 18 ++++++++++++++++++ scripts/upgrade | 20 ++++++++++---------- scripts/upgrade.d/upgrade.15.sh | 4 ++-- scripts/upgrade.d/upgrade.16.sh | 13 ++----------- scripts/upgrade.d/upgrade.17.sh | 13 ++----------- 6 files changed, 37 insertions(+), 37 deletions(-) diff --git a/check_process b/check_process index 8b4cff8..afc9dec 100644 --- a/check_process +++ b/check_process @@ -12,7 +12,7 @@ setup_private=0 setup_public=0 upgrade=1 - upgrade=1 from_commit=1cdb9ea1619c6acaaa90bae88b5c4bed5084a2a7 + upgrade=1 from_commit=9c57c2f78f3da979d587d708eb9379ffaa41bcfa backup_restore=1 multi_instance=1 incorrect_path=1 @@ -24,6 +24,6 @@ Email= Notification=none ;;; Upgrade options - ; commit=1cdb9ea1619c6acaaa90bae88b5c4bed5084a2a7 - name= Fix Debian Stretch dependencies by installing php-apcu, php-mbstring … + ; commit=9c57c2f78f3da979d587d708eb9379ffaa41bcfa + name=Do not use too much process for php (#247) manifest_arg=domain=DOMAIN&path=PATH&admin=USER&user_home=1& diff --git a/scripts/_ynh_add_fpm_config b/scripts/_ynh_add_fpm_config index 9d4dacf..cfe2232 100644 --- a/scripts/_ynh_add_fpm_config +++ b/scripts/_ynh_add_fpm_config @@ -125,4 +125,22 @@ ynh_add_fpm_config () { ynh_store_file_checksum "$finalphpini" fi ynh_systemd_action --service_name=$fpm_service --action=reload + + # Clean other php version config files for this app. Used for migration purpose. + if [ -e "/etc/php5/fpm/pool.d/$app.conf" ] + then + ynh_secure_remove --file="/etc/php5/fpm/pool.d/$app.conf" + ynh_systemd_action --service_name=php5-fpm --action=reload + fi + for i in `seq 0 4` + do + if [ "$phpversion" != "7.$i" ] + then + if [ -e "/etc/php/7.$i/fpm/pool.d/$app.conf" ] + then + ynh_secure_remove --file="/etc/php/7.$i/fpm/pool.d/$app.conf" + ynh_systemd_action --service_name=php7.$i-fpm --action=reload + fi + fi + done } diff --git a/scripts/upgrade b/scripts/upgrade index cac237d..47d9a0c 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -132,6 +132,16 @@ fi # Normalize the URL path syntax path_url=$(ynh_normalize_url_path --path_url=$path_url) +#================================================= +# UPGRADE DEPENDENCIES +#================================================= +ynh_script_progression --message="Upgrading dependencies..." --weight=7 + +ynh_install_app_dependencies $pkg_dependencies + +ynh_remove_php +ynh_install_php --phpversion="$php_version" --package="$extra_pkg_dependencies" + #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -178,16 +188,6 @@ if [ -f /etc/php/$php_version/fpm/conf.d/20-$app.ini ]; then ynh_secure_remove --file=/etc/php/$php_version/fpm/conf.d/20-$app.ini fi -#================================================= -# UPGRADE DEPENDENCIES -#================================================= -ynh_script_progression --message="Upgrading dependencies..." --weight=7 - -ynh_install_app_dependencies $pkg_dependencies - -ynh_remove_php -ynh_install_php --phpversion="$php_version" --package="$extra_pkg_dependencies" - #================================================= # SPECIFIC UPGRADE #================================================= diff --git a/scripts/upgrade.d/upgrade.15.sh b/scripts/upgrade.d/upgrade.15.sh index 919c6ad..a8c2c1c 100644 --- a/scripts/upgrade.d/upgrade.15.sh +++ b/scripts/upgrade.d/upgrade.15.sh @@ -1,7 +1,7 @@ #!/bin/bash # Last available nextcloud version -next_version="15.0.11" +next_version="16.0.0" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="59cdde8e7a4a15606efc246e37adf6401b0b4a60f33289be8725d675b9c2ae26" +nextcloud_source_sha256="4532f7028b1d9bf060f75ac4fbbde52a59ecd9c9155f3178a038d3cf3609402e" diff --git a/scripts/upgrade.d/upgrade.16.sh b/scripts/upgrade.d/upgrade.16.sh index ec2b0c6..cb0d88a 100755 --- a/scripts/upgrade.d/upgrade.16.sh +++ b/scripts/upgrade.d/upgrade.16.sh @@ -1,16 +1,7 @@ #!/bin/bash # Last available nextcloud version -next_version="16.0.5" +next_version="17.0.0" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="8709c64fa776fd731c8e5f1ab25d592a2e690e5e18a81601cccf363795fae551" - -# This function will only be executed upon applying the last upgrade referenced above -last_upgrade_operations () { - # Patch nextcloud files only for the last version - cp -a ../sources/patches_last_version/* ../sources/patches - - # Execute post-upgrade operations later on - (cd /tmp ; at now + 10 minutes <<< "(cd $final_path ; sudo -u $app php occ db:add-missing-indices ; sudo -u $app php occ db:convert-filecache-bigint -n) > /tmp/${app}_maintenance.log") -} +nextcloud_source_sha256="6081421b33ecdb3130b2bfb2293a3f4045aeb0b471ee570e675de3d931a142a6" diff --git a/scripts/upgrade.d/upgrade.17.sh b/scripts/upgrade.d/upgrade.17.sh index 0cf5c28..35200da 100755 --- a/scripts/upgrade.d/upgrade.17.sh +++ b/scripts/upgrade.d/upgrade.17.sh @@ -1,16 +1,7 @@ #!/bin/bash # Last available nextcloud version -next_version="17.0.0" +next_version="18.0.0" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="6081421b33ecdb3130b2bfb2293a3f4045aeb0b471ee570e675de3d931a142a6" - -# This function will only be executed upon applying the last upgrade referenced above -last_upgrade_operations () { - # Patch nextcloud files only for the last version - cp -a ../sources/patches_last_version/* ../sources/patches - - # Execute post-upgrade operations later on - (cd /tmp ; at now + 10 minutes <<< "(cd $final_path ; sudo -u $app php occ db:add-missing-indices ; sudo -u $app php occ db:convert-filecache-bigint -n) > /tmp/${app}_maintenance.log") -} +nextcloud_source_sha256="194095a5586d84040bc455f77b8aa6c80f9a6a6dd713c9aebdad046713d4267b" From fb3559ea4a3cef2abdc9ca9903c1d6b06bc75fe2 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Sat, 22 Feb 2020 18:33:10 +0100 Subject: [PATCH 101/204] Rename variable to YNH_PHP_VERSION --- conf/nginx.conf | 2 +- scripts/_common.sh | 6 +++--- scripts/_ynh_add_fpm_config | 4 ++-- scripts/backup | 2 +- scripts/change_url | 4 ++-- scripts/install | 10 +++++----- scripts/remove | 2 -- scripts/restore | 7 ++++--- scripts/upgrade | 15 +++++++-------- 9 files changed, 25 insertions(+), 27 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 08a19e5..8f2b3fb 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -83,7 +83,7 @@ location ^~ __PATH__/ { fastcgi_param modHeadersAvailable true; # Enable pretty urls fastcgi_param front_controller_active true; - fastcgi_pass unix:/var/run/php/php__PHP_VERSION__-fpm-__NAME__.sock; + fastcgi_pass unix:/var/run/php/php__YNH_PHP_VERSION__-fpm-__NAME__.sock; fastcgi_intercept_errors on; fastcgi_request_buffering off; fastcgi_param REMOTE_USER $remote_user; diff --git a/scripts/_common.sh b/scripts/_common.sh index c654615..433d870 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,8 +5,8 @@ pkg_dependencies="imagemagick acl tar smbclient at" -php_version="7.2" -extra_pkg_dependencies="php${php_version}-bz2 php${php_version}-imap php${php_version}-smbclient php${php_version}-gmp php${php_version}-gd php${php_version}-json php${php_version}-intl php${php_version}-curl php${php_version}-apcu php${php_version}-redis php${php_version}-ldap php${php_version}-imagick php${php_version}-zip php${php_version}-mbstring php${php_version}-xml php${php_version}-mysql" +YNH_PHP_VERSION="7.3" +extra_pkg_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" #================================================= # EXPERIMENTAL HELPERS @@ -332,7 +332,7 @@ ynh_smart_mktemp () { elif is_there_enough_space /var; then local tmpdir=/var elif is_there_enough_space /; then - local tmpdir=/ + local tmpdir=/ elif is_there_enough_space /home; then local tmpdir=/home else diff --git a/scripts/_ynh_add_fpm_config b/scripts/_ynh_add_fpm_config index cfe2232..487c044 100644 --- a/scripts/_ynh_add_fpm_config +++ b/scripts/_ynh_add_fpm_config @@ -43,7 +43,7 @@ ynh_add_fpm_config () { fi # Configure PHP-FPM 7.0 by default - phpversion="${phpversion:-7.0}" + phpversion="${phpversion:-$YNH_PHP_VERSION}" local fpm_config_dir="/etc/php/$phpversion/fpm" local fpm_service="php${phpversion}-fpm" @@ -75,7 +75,7 @@ ynh_add_fpm_config () { # Replace standard variables into the default file ynh_replace_string --match_string="^\[www\]" --replace_string="[$app]" --target_file="$finalphpconf" - ynh_replace_string --match_string=".*listen = .*" --replace_string="listen = /var/run/php/php7.0-fpm-$app.sock" --target_file="$finalphpconf" + ynh_replace_string --match_string=".*listen = .*" --replace_string="listen = /var/run/php/php$phpversion-fpm-$app.sock" --target_file="$finalphpconf" ynh_replace_string --match_string="^user = .*" --replace_string="user = $app" --target_file="$finalphpconf" ynh_replace_string --match_string="^group = .*" --replace_string="group = $app" --target_file="$finalphpconf" ynh_replace_string --match_string=".*chdir = .*" --replace_string="chdir = $final_path" --target_file="$finalphpconf" diff --git a/scripts/backup b/scripts/backup index 2c80fa1..68ae4ee 100755 --- a/scripts/backup +++ b/scripts/backup @@ -48,7 +48,7 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= ynh_script_progression --message="Backing up php-fpm configuration..." -ynh_backup --src_path="/etc/php/$php_version/fpm/pool.d/$app.conf" +ynh_backup --src_path="/etc/php/$YNH_PHP_VERSION/fpm/pool.d/$app.conf" #================================================= # BACKUP THE MYSQL DATABASE diff --git a/scripts/change_url b/scripts/change_url index dbc7d66..1f92a0e 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -63,7 +63,7 @@ then domain="$old_domain" path_url="$new_path" # Create a dedicated nginx config - ynh_add_nginx_config php_version + ynh_add_nginx_config YNH_PHP_VERSION fi # Change the domain for nginx @@ -84,7 +84,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" \ - php${php_version} occ --no-interaction --no-ansi "$@") + php${YNH_PHP_VERSION} occ --no-interaction --no-ansi "$@") } if [ $change_domain -eq 1 ] diff --git a/scripts/install b/scripts/install index 9cd9c40..e6b6c93 100755 --- a/scripts/install +++ b/scripts/install @@ -58,7 +58,7 @@ ynh_script_progression --message="Installing dependencies..." --weight=60 ynh_install_app_dependencies $pkg_dependencies -ynh_install_php --phpversion="$php_version" --package="$extra_pkg_dependencies" +ynh_install_php --phpversion="$YNH_PHP_VERSION" --package="$extra_pkg_dependencies" #================================================= # CREATE A MYSQL DATABASE @@ -102,7 +102,7 @@ then fi # Create a dedicated nginx config -ynh_add_nginx_config php_version +ynh_add_nginx_config YNH_PHP_VERSION #================================================= # CREATE DEDICATED USER @@ -118,7 +118,7 @@ ynh_system_user_create --username=$app ynh_script_progression --message="Configuring php-fpm..." --weight=2 # Create a dedicated php-fpm config -ynh_add_fpm_config --phpversion="$php_version" +ynh_add_fpm_config --usage=medium --footprint=high #================================================= # SPECIFIC SETUP @@ -139,7 +139,7 @@ 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$php_version occ --no-interaction --no-ansi "$@") + php$YNH_PHP_VERSION occ --no-interaction --no-ansi "$@") } # Set write access for the following commands @@ -275,7 +275,7 @@ exec_occ background:cron # POST-INSTALL MAINTENANCE #================================================= -(cd /tmp ; at now + 10 minutes <<< "(cd $final_path ; sudo -u $app php${php_version} occ db:add-missing-indices ; sudo -u $app php${php_version} occ db:convert-filecache-bigint -n) > /tmp/${app}_maintenance.log") +(cd /tmp ; at now + 10 minutes <<< "(cd $final_path ; sudo -u $app php${YNH_PHP_VERSION} occ db:add-missing-indices ; sudo -u $app php${YNH_PHP_VERSION} occ db:convert-filecache-bigint -n) > /tmp/${app}_maintenance.log") #================================================= # CONFIGURE THE HOOK FILE FOR USER CREATE diff --git a/scripts/remove b/scripts/remove index 2da18b5..9ea5c15 100755 --- a/scripts/remove +++ b/scripts/remove @@ -30,8 +30,6 @@ ynh_script_progression --message="Removing dependencies..." --weight=20 # Remove metapackage and its dependencies ynh_remove_app_dependencies -ynh_remove_php - #================================================= # REMOVE THE MYSQL DATABASE #================================================= diff --git a/scripts/restore b/scripts/restore index 233640c..3538a74 100755 --- a/scripts/restore +++ b/scripts/restore @@ -8,6 +8,7 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers +source _ynh_add_fpm_config #================================================= # MANAGE SCRIPT FAILURE @@ -83,7 +84,7 @@ ynh_system_user_create --username=$app # RESTORE THE PHP-FPM CONFIGURATION #================================================= -ynh_restore_file --origin_path="/etc/php/$php_version/fpm/pool.d/$app.conf" +ynh_restore_file --origin_path="/etc/php/$YNH_PHP_VERSION/fpm/pool.d/$app.conf" #================================================= # SPECIFIC RESTORATION @@ -95,7 +96,7 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=60 # Define and install dependencies ynh_install_app_dependencies $pkg_dependencies -ynh_install_php --phpversion="$php_version" --package="$extra_pkg_dependencies" +ynh_install_php --phpversion="$YNH_PHP_VERSION" --package="$extra_pkg_dependencies" #================================================= # RESTORE THE CRON FILE @@ -171,7 +172,7 @@ ynh_systemd_action --action=restart --service_name=fail2ban #================================================= ynh_script_progression --message="Reloading nginx web server and php-fpm..." -ynh_systemd_action --service_name=php7.0-fpm --action=reload +ynh_systemd_action --service_name=php${YNH_PHP_VERSION}-fpm --action=reload ynh_systemd_action --service_name=nginx --action=reload #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 47d9a0c..4a72bde 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -139,8 +139,7 @@ ynh_script_progression --message="Upgrading dependencies..." --weight=7 ynh_install_app_dependencies $pkg_dependencies -ynh_remove_php -ynh_install_php --phpversion="$php_version" --package="$extra_pkg_dependencies" +ynh_install_php --phpversion="$YNH_PHP_VERSION" --package="$extra_pkg_dependencies" #================================================= # STANDARD UPGRADE STEPS @@ -152,7 +151,7 @@ ynh_script_progression --message="Upgrading nginx web server configuration..." - ynh_backup_if_checksum_is_different --file="/etc/nginx/conf.d/$domain.d/$app.conf" # Delete current nginx configuration to be able to check if .well-known is already served. -ynh_remove_nginx_config +ynh_remove_nginx_config $YNH_PHP_VERSION ynh_app_setting_delete --app=$app --key="checksum__etc_nginx_conf.d_$domain.d_$app.conf" # Check if .well-known is available for this domain @@ -165,7 +164,7 @@ then fi # Create a dedicated nginx config -ynh_add_nginx_config php_version +ynh_add_nginx_config YNH_PHP_VERSION #================================================= # CREATE DEDICATED USER @@ -181,11 +180,11 @@ ynh_system_user_create --username=$app ynh_script_progression --message="Upgrading php-fpm configuration..." --weight=2 # Create a dedicated php-fpm config -ynh_add_fpm_config --phpversion="$php_version" +ynh_add_fpm_config --phpversion="$YNH_PHP_VERSION" --usage=medium --footprint=high # Delete existing ini configuration file (backward compatibility) -if [ -f /etc/php/$php_version/fpm/conf.d/20-$app.ini ]; then - ynh_secure_remove --file=/etc/php/$php_version/fpm/conf.d/20-$app.ini +if [ -f /etc/php/$YNH_PHP_VERSION/fpm/conf.d/20-$app.ini ]; then + ynh_secure_remove --file=/etc/php/$YNH_PHP_VERSION/fpm/conf.d/20-$app.ini fi #================================================= @@ -198,7 +197,7 @@ fi # Define a function to execute commands with `occ` exec_occ() { (cd "$final_path" && exec_as "$app" \ - php$php_version occ --no-interaction --no-ansi "$@") + php$YNH_PHP_VERSION occ --no-interaction --no-ansi "$@") } # Define a function to add an external storage From f6e729863829ac0076ec7ebea56ffacac0a44512 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Sun, 23 Feb 2020 17:05:37 +0100 Subject: [PATCH 102/204] Fix PATH warning --- conf/extra_php-fpm.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/conf/extra_php-fpm.conf b/conf/extra_php-fpm.conf index b626ca2..66334c5 100644 --- a/conf/extra_php-fpm.conf +++ b/conf/extra_php-fpm.conf @@ -1,5 +1,6 @@ ; Additional php.ini defines, specific to this pool of workers. +env[PATH] = $PATH php_value[upload_max_filesize] = 10G php_value[post_max_size] = 10G php_value[default_charset] = UTF-8 From 95ceb5c8a2cfe6bb56ef9a9666b4fbf19e415eac Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Sun, 23 Feb 2020 17:50:05 +0100 Subject: [PATCH 103/204] add missing dependency, update ynh_install_php helper --- scripts/_common.sh | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 433d870..b8aca99 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -6,7 +6,7 @@ pkg_dependencies="imagemagick acl tar smbclient at" YNH_PHP_VERSION="7.3" -extra_pkg_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" +extra_pkg_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" #================================================= # EXPERIMENTAL HELPERS @@ -616,7 +616,7 @@ ynh_multimedia_addaccess () { # Install another version of php. # # usage: ynh_install_php --phpversion=phpversion [--package=packages] -# | arg: -v, --phpversion - Version of php to install. Can be one of 7.1, 7.2 or 7.3 +# | arg: -v, --phpversion - Version of php to install. # | arg: -p, --package - Additionnal php packages to install ynh_install_php () { # Declare an array to define the options of this helper. @@ -628,12 +628,12 @@ ynh_install_php () { ynh_handle_getopts_args "$@" package=${package:-} - # Store php_version into the config of this app - ynh_app_setting_set $app php_version $phpversion + # Store phpversion into the config of this app + ynh_app_setting_set $app phpversion $phpversion if [ "$phpversion" == "7.0" ] then - ynh_die --message="Do not use ynh_install_php to install php7.0" + ynh_die "Do not use ynh_install_php to install php7.0" fi # Store the ID of this app and the version of php requested for it @@ -650,16 +650,20 @@ ynh_install_php () { # Set php7.0 back as the default version for php-cli. update-alternatives --set php /usr/bin/php7.0 - # Remove this extra repository after packages are installed - ynh_remove_extra_repo --name=extra_php_version + # Pin this extra repository after packages are installed to prevent sury of doing shit + ynh_pin_repo --package="*" --pin="origin \"packages.sury.org\"" 200 --name=extra_php_version + ynh_pin_repo --package="php7.0*" --pin="origin \"packages.sury.org\"" 600 --name=extra_php_version --append # Advertise service in admin panel yunohost service add php${phpversion}-fpm --log "/var/log/php${phpversion}-fpm.log" } +# Remove the specific version of php used by the app. +# +# usage: ynh_install_php ynh_remove_php () { # Get the version of php used by this app - local phpversion=$(ynh_app_setting_get $app php_version) + local phpversion=$(ynh_app_setting_get $app phpversion) if [ "$phpversion" == "7.0" ] || [ -z "$phpversion" ] then From 4e12728808198c21996fa2396fdf5372348353bd Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Sun, 23 Feb 2020 17:50:24 +0100 Subject: [PATCH 104/204] Fix cron and maintenance jobs --- conf/nextcloud.cron | 2 +- scripts/install | 1 + scripts/upgrade | 1 + scripts/upgrade.d/upgrade.last.sh | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/conf/nextcloud.cron b/conf/nextcloud.cron index 93fde63..3a63ff5 100644 --- a/conf/nextcloud.cron +++ b/conf/nextcloud.cron @@ -1 +1 @@ -*/15 * * * * __USER__ /usr/bin/php -f __DESTDIR__/cron.php +*/15 * * * * __USER__ /usr/bin/php__YNH_PHP_VERSION__ -f __DESTDIR__/cron.php diff --git a/scripts/install b/scripts/install index e6b6c93..f3325a4 100755 --- a/scripts/install +++ b/scripts/install @@ -268,6 +268,7 @@ 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="$YNH_PHP_VERSION" --target_file="$cron_path" exec_occ background:cron diff --git a/scripts/upgrade b/scripts/upgrade index 4a72bde..c099227 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -383,6 +383,7 @@ 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="$YNH_PHP_VERSION" --target_file="$cron_path" exec_occ background:cron diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index 436062a..02fa0cb 100755 --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -12,5 +12,5 @@ last_upgrade_operations () { cp -a ../sources/patches_last_version/* ../sources/patches # Execute post-upgrade operations later on - (cd /tmp ; at now + 10 minutes <<< "(cd $final_path ; sudo -u $app php occ db:add-missing-indices ; sudo -u $app php occ db:convert-filecache-bigint -n) > /tmp/${app}_maintenance.log") + (cd /tmp ; at now + 10 minutes <<< "(cd $final_path ; sudo -u $app php${YNH_PHP_VERSION} occ db:add-missing-indices ; sudo -u $app php${YNH_PHP_VERSION} occ db:convert-filecache-bigint -n) > /tmp/${app}_maintenance.log") } From 1faf07a91bf08c5aede4278d8d30f723098d8f77 Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Mon, 24 Feb 2020 13:55:01 +0100 Subject: [PATCH 105/204] Update scripts/_common.sh Co-Authored-By: Kayou --- scripts/_common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index b8aca99..ee29946 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -651,7 +651,7 @@ ynh_install_php () { update-alternatives --set php /usr/bin/php7.0 # Pin this extra repository after packages are installed to prevent sury of doing shit - ynh_pin_repo --package="*" --pin="origin \"packages.sury.org\"" 200 --name=extra_php_version + ynh_pin_repo --package="*" --pin="origin \"packages.sury.org\"" --priority=200 --name=extra_php_version ynh_pin_repo --package="php7.0*" --pin="origin \"packages.sury.org\"" 600 --name=extra_php_version --append # Advertise service in admin panel From 01a77284e2935556d0f516526b928784102d62de Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Mon, 24 Feb 2020 13:55:17 +0100 Subject: [PATCH 106/204] Update scripts/_common.sh Co-Authored-By: Kayou --- scripts/_common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index ee29946..7ce6410 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -652,7 +652,7 @@ ynh_install_php () { # Pin this extra repository after packages are installed to prevent sury of doing shit ynh_pin_repo --package="*" --pin="origin \"packages.sury.org\"" --priority=200 --name=extra_php_version - ynh_pin_repo --package="php7.0*" --pin="origin \"packages.sury.org\"" 600 --name=extra_php_version --append + ynh_pin_repo --package="php7.0*" --pin="origin \"packages.sury.org\"" --priority=600 --name=extra_php_version --append # Advertise service in admin panel yunohost service add php${phpversion}-fpm --log "/var/log/php${phpversion}-fpm.log" From 5870b3c44846648514e03f31df3dddda0f260b55 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Sat, 7 Mar 2020 22:11:02 +0100 Subject: [PATCH 107/204] Fix PHP-FPM parameters in upgrade --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index c099227..a25f171 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -180,7 +180,7 @@ ynh_system_user_create --username=$app ynh_script_progression --message="Upgrading php-fpm configuration..." --weight=2 # Create a dedicated php-fpm config -ynh_add_fpm_config --phpversion="$YNH_PHP_VERSION" --usage=medium --footprint=high +ynh_add_fpm_config --phpversion="$YNH_PHP_VERSION" --usage=$fpm_usage --footprint=$fpm_footprint # Delete existing ini configuration file (backward compatibility) if [ -f /etc/php/$YNH_PHP_VERSION/fpm/conf.d/20-$app.ini ]; then From f92563342ebc9ef2505927f1b499ac54c9b3f2f9 Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Tue, 10 Mar 2020 20:59:08 +0100 Subject: [PATCH 108/204] Fix sury pin --- scripts/_common.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 7ce6410..1e63791 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -733,7 +733,8 @@ ynh_pin_repo () { mkdir -p "/etc/apt/preferences.d" echo "Package: $package Pin: $pin -Pin-Priority: $priority" \ +Pin-Priority: $priority +" \ | $append "/etc/apt/preferences.d/$name" } From e4d3e4beb3e3b1fe3190420fe9e53a339c84454b Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Sat, 14 Mar 2020 12:55:28 +0100 Subject: [PATCH 109/204] Upgrade to upstream version 18.0.2 --- README.md | 2 +- manifest.json | 2 +- scripts/upgrade.d/upgrade.last.sh | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1a824fc..f0153fe 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ own data. A personal cloud which run on your own server. With Nextcloud you can synchronize your files over your devices. -**Shipped version:** 18.0.1 +**Shipped version:** 18.0.2 ## Screenshots diff --git a/manifest.json b/manifest.json index 152293a..9976a6e 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Access & share your files, calendars, contacts, mail & more from any device, on your terms", "fr": "Consultez et partagez vos fichiers, agendas, carnets d'adresses, emails et bien plus depuis les appareils de votre choix, sous vos conditions" }, - "version": "18.0.1~ynh1", + "version": "18.0.2~ynh1", "url": "https://nextcloud.com", "license": "AGPL-3.0", "maintainer": { diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index 02fa0cb..24a1692 100755 --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -1,10 +1,10 @@ #!/bin/bash # Last available nextcloud version -next_version="18.0.1" +next_version="18.0.2" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="770faf34b8f0d81273623daed4d64ec7919c38dfeb07328b613058addbed19c0" +nextcloud_source_sha256="d033660923dd27106ec64bff0e3afa2f595bd1b9661b7ea7882a1a33006ecb81" # This function will only be executed upon applying the last upgrade referenced above last_upgrade_operations () { From 062f8b739916e683073e31135130af981792b98a Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Sat, 14 Mar 2020 12:55:58 +0100 Subject: [PATCH 110/204] Fix PHP memory limit warning --- conf/extra_php-fpm.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/conf/extra_php-fpm.conf b/conf/extra_php-fpm.conf index 66334c5..4b0d12d 100644 --- a/conf/extra_php-fpm.conf +++ b/conf/extra_php-fpm.conf @@ -1,6 +1,7 @@ ; Additional php.ini defines, specific to this pool of workers. env[PATH] = $PATH +php_admin_value[memory_limit] = 512M php_value[upload_max_filesize] = 10G php_value[post_max_size] = 10G php_value[default_charset] = UTF-8 From f6a4218b76f3022ffab3eb3ff289f85fb7bf10f2 Mon Sep 17 00:00:00 2001 From: Kay0u Date: Tue, 17 Mar 2020 00:35:43 +0100 Subject: [PATCH 111/204] update is_url_handled --- scripts/_common.sh | 10 ++++++---- scripts/change_url | 2 +- scripts/install | 2 +- scripts/restore | 2 +- scripts/upgrade | 2 +- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 1e63791..7b84705 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -28,17 +28,19 @@ exec_as() { #================================================= # Check if an URL is already handled -# usage: is_url_handled URL +# usage: is_url_handled --domain=DOMAIN --path=PATH_URI is_url_handled() { # Declare an array to define the options of this helper. - declare -Ar args_array=( [u]=url= ) - local url + local legacy_args=dp + declare -Ar args_array=( [d]=domain= [p]=path= ) + local domain + local path # Manage arguments with getopts ynh_handle_getopts_args "$@" # Try to get the url with curl, and keep the http code and an eventual redirection url. local curl_output="$(curl --insecure --silent --output /dev/null \ - --write-out '%{http_code};%{redirect_url}' "$url")" + --write-out '%{http_code};%{redirect_url}' https://127.0.0.1$path --header "Host: $domain" --resolve $domain:443:127.0.0.1)" # Cut the output and keep only the first part to keep the http code local http_code="${curl_output%%;*}" diff --git a/scripts/change_url b/scripts/change_url index 1f92a0e..c9f7a9c 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -99,7 +99,7 @@ fi if [ $change_domain -eq 1 ] then # Check if .well-known is available for this domain - if is_url_handled --url="https://$domain/.well-known/caldav" || is_url_handled --url="https://$domain/.well-known/carddav" + if is_url_handled --domain="$domain" --path="/.well-known/caldav" || is_url_handled --domain="$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." diff --git a/scripts/install b/scripts/install index f3325a4..5c80e56 100755 --- a/scripts/install +++ b/scripts/install @@ -93,7 +93,7 @@ ynh_setup_source --dest_dir="$final_path" ynh_script_progression --message="Configuring nginx web server..." --weight=2 # Check if .well-known is available for this domain -if is_url_handled --url="https://$domain/.well-known/caldav" || is_url_handled --url="https://$domain/.well-known/carddav" +if is_url_handled --domain="$domain" --path="/.well-known/caldav" || is_url_handled --domain="$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." diff --git a/scripts/restore b/scripts/restore index 3538a74..c62be63 100755 --- a/scripts/restore +++ b/scripts/restore @@ -48,7 +48,7 @@ test ! -d $final_path \ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" # Check if .well-known is available for this domain -if is_url_handled --url="https://$domain/.well-known/caldav" || is_url_handled --url="https://$domain/.well-known/carddav" +if is_url_handled --domain="$domain" --path="/.well-known/caldav" || is_url_handled --domain="$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." diff --git a/scripts/upgrade b/scripts/upgrade index a25f171..bcc8182 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -155,7 +155,7 @@ ynh_remove_nginx_config $YNH_PHP_VERSION ynh_app_setting_delete --app=$app --key="checksum__etc_nginx_conf.d_$domain.d_$app.conf" # Check if .well-known is available for this domain -if is_url_handled --url="https://$domain/.well-known/caldav" || is_url_handled --url="https://$domain/.well-known/carddav" +if is_url_handled --domain="$domain" --path="/.well-known/caldav" || is_url_handled --domain="$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." From 82194e82a72fd71b79736b3f080e30778867b37e Mon Sep 17 00:00:00 2001 From: Kay0u Date: Sat, 21 Mar 2020 01:38:11 +0100 Subject: [PATCH 112/204] Don't use parentheses --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index bcc8182..7d35478 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -292,7 +292,7 @@ then # Upgrade Nextcloud (SUCCESS = 0, UP_TO_DATE = 3) exec_occ maintenance:mode --off exec_occ upgrade \ - || ([ $? -eq 3 ] || ynh_die --message="Unable to upgrade Nextcloud") + || [ $? -eq 3 ] || ynh_die --message="Unable to upgrade Nextcloud" # Get the new current version number current_version=$(grep OC_VersionString "$final_path/version.php" | cut -d\' -f2) From 5d0436199b1675b60d99d8d39ee2f1ac52f1df5f Mon Sep 17 00:00:00 2001 From: Kayou Date: Tue, 24 Mar 2020 20:56:04 +0100 Subject: [PATCH 113/204] fix caldav/carddav detection --- scripts/upgrade | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index bcc8182..0f0da06 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -151,9 +151,11 @@ ynh_script_progression --message="Upgrading nginx web server configuration..." - ynh_backup_if_checksum_is_different --file="/etc/nginx/conf.d/$domain.d/$app.conf" # Delete current nginx configuration to be able to check if .well-known is already served. -ynh_remove_nginx_config $YNH_PHP_VERSION +ynh_remove_nginx_config ynh_app_setting_delete --app=$app --key="checksum__etc_nginx_conf.d_$domain.d_$app.conf" +ynh_systemd_action --service_name=nginx --action=reload + # 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" then From 02554f94e5065a9a8c7d4e50d366a5f8f7eb4242 Mon Sep 17 00:00:00 2001 From: Kayou Date: Tue, 24 Mar 2020 21:13:51 +0100 Subject: [PATCH 114/204] Update _common.sh --- scripts/_common.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/_common.sh b/scripts/_common.sh index 7b84705..47253f1 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -38,6 +38,9 @@ is_url_handled() { # Manage arguments with getopts ynh_handle_getopts_args "$@" + # Wait untils nginx has fully reloaded (avoid curl fail with http2) + sleep 2 + # Try to get the url with curl, and keep the http code and an eventual redirection url. local curl_output="$(curl --insecure --silent --output /dev/null \ --write-out '%{http_code};%{redirect_url}' https://127.0.0.1$path --header "Host: $domain" --resolve $domain:443:127.0.0.1)" From d1a2528c43d63760874256d57bca3670b789c39a Mon Sep 17 00:00:00 2001 From: Kay0u Date: Wed, 25 Mar 2020 01:22:21 +0100 Subject: [PATCH 115/204] Move sleep --- scripts/_common.sh | 3 --- scripts/upgrade | 5 ++++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 47253f1..7b84705 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -38,9 +38,6 @@ is_url_handled() { # Manage arguments with getopts ynh_handle_getopts_args "$@" - # Wait untils nginx has fully reloaded (avoid curl fail with http2) - sleep 2 - # Try to get the url with curl, and keep the http code and an eventual redirection url. local curl_output="$(curl --insecure --silent --output /dev/null \ --write-out '%{http_code};%{redirect_url}' https://127.0.0.1$path --header "Host: $domain" --resolve $domain:443:127.0.0.1)" diff --git a/scripts/upgrade b/scripts/upgrade index 0f0da06..9045c6f 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -146,7 +146,7 @@ ynh_install_php --phpversion="$YNH_PHP_VERSION" --package="$extra_pkg_dependenci #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=2 +ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=3 ynh_backup_if_checksum_is_different --file="/etc/nginx/conf.d/$domain.d/$app.conf" @@ -156,6 +156,9 @@ ynh_app_setting_delete --app=$app --key="checksum__etc_nginx_conf.d_$domain.d_$a ynh_systemd_action --service_name=nginx --action=reload +# Wait untils nginx has fully reloaded +sleep 1 + # 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" then From 2d1e0c0c44ba8aecee8a85e46db4bd27484c97bc Mon Sep 17 00:00:00 2001 From: Kay0u Date: Wed, 25 Mar 2020 13:59:01 +0100 Subject: [PATCH 116/204] wait nginx --- scripts/upgrade | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 9045c6f..95ba8fc 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -146,7 +146,7 @@ ynh_install_php --phpversion="$YNH_PHP_VERSION" --package="$extra_pkg_dependenci #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=3 +ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=2 ynh_backup_if_checksum_is_different --file="/etc/nginx/conf.d/$domain.d/$app.conf" @@ -154,10 +154,8 @@ ynh_backup_if_checksum_is_different --file="/etc/nginx/conf.d/$domain.d/$app.con ynh_remove_nginx_config ynh_app_setting_delete --app=$app --key="checksum__etc_nginx_conf.d_$domain.d_$app.conf" -ynh_systemd_action --service_name=nginx --action=reload - # Wait untils nginx has fully reloaded -sleep 1 +ynh_systemd_action --service_name=nginx --action=reload --line_match="Reloaded" --log_path="systemd" # 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" From 05977de8e1378a196c760eb259068e53026aead0 Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Sat, 28 Mar 2020 12:44:22 +0100 Subject: [PATCH 117/204] Add an action to disable maintenance mode --- actions.toml | 8 +++++ scripts/actions/disable_maintenance | 52 +++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 actions.toml create mode 100755 scripts/actions/disable_maintenance diff --git a/actions.toml b/actions.toml new file mode 100644 index 0000000..38c52a8 --- /dev/null +++ b/actions.toml @@ -0,0 +1,8 @@ +[disable_maintenance] +name = "Disable the maintenance mode of Nextcloud" +command = "/bin/bash scripts/actions/disable_maintenance" +# user = "root" # optional +# cwd = "/" # optional +# accepted_return_codes = [0, 1, 2, 3] # optional +accepted_return_codes = [0] +description = "Disable the maintenance mode of Nextcloud if you're stuck after an upgrade" diff --git a/scripts/actions/disable_maintenance b/scripts/actions/disable_maintenance new file mode 100755 index 0000000..0c2c8b2 --- /dev/null +++ b/scripts/actions/disable_maintenance @@ -0,0 +1,52 @@ +#!/bin/bash + +#================================================= +# GENERIC STARTING +#================================================= +# IMPORT GENERIC HELPERS +#================================================= + +source scripts/_common.sh +source /usr/share/yunohost/helpers + +#================================================= +# RETRIEVE ARGUMENTS +#================================================= + +app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID} + +final_path=$(ynh_app_setting_get --app=$app --key=final_path) + +#================================================= +# CHECK IF ARGUMENTS ARE CORRECT +#================================================= + +#================================================= +# CHECK IF AN ACTION HAS TO BE DONE +#================================================= + +# Check the current status of the maintenance mode + +if [ "$(grep "maintenance" "$final_path/config/config.php" | awk '{print $3}' | cut -d',' -f1)" != "true" ] +then + ynh_die --message="Nextcloud isn't currently under maintenance." --ret_code=0 +fi + +#================================================= +# SPECIFIC ACTION +#================================================= +# DISABLE THE MAINTENANCE MODE +#================================================= + +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 +) + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_script_progression --message="Execution completed" --last From 1f41e28254e293beb1d7a800370eeb852bafbf9e Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Sat, 28 Mar 2020 14:23:26 +0100 Subject: [PATCH 118/204] Upgrade to upstream version 18.0.3 --- README.md | 2 +- manifest.json | 2 +- scripts/upgrade.d/upgrade.last.sh | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f0153fe..f6f7994 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ own data. A personal cloud which run on your own server. With Nextcloud you can synchronize your files over your devices. -**Shipped version:** 18.0.2 +**Shipped version:** 18.0.3 ## Screenshots diff --git a/manifest.json b/manifest.json index 9976a6e..5f79407 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Access & share your files, calendars, contacts, mail & more from any device, on your terms", "fr": "Consultez et partagez vos fichiers, agendas, carnets d'adresses, emails et bien plus depuis les appareils de votre choix, sous vos conditions" }, - "version": "18.0.2~ynh1", + "version": "18.0.3~ynh1", "url": "https://nextcloud.com", "license": "AGPL-3.0", "maintainer": { diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index 24a1692..4da3883 100755 --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -1,10 +1,10 @@ #!/bin/bash # Last available nextcloud version -next_version="18.0.2" +next_version="18.0.3" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="d033660923dd27106ec64bff0e3afa2f595bd1b9661b7ea7882a1a33006ecb81" +nextcloud_source_sha256="7b67e709006230f90f95727f9fa92e8c73a9e93458b22103293120f9cb50fd72" # This function will only be executed upon applying the last upgrade referenced above last_upgrade_operations () { From 9b7b2e766213d85104e59090cb5ad0fb5b9052bf Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Sun, 29 Mar 2020 13:49:09 +0200 Subject: [PATCH 119/204] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f0153fe..0f3fcc1 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Nextcloud for YunoHost -[![Integration level](https://dash.yunohost.org/integration/nextcloud.svg)](https://dash.yunohost.org/appci/app/nextcloud) +[![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) [![Install Nextcloud with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=nextcloud) > *This package allow you to install Nextcloud quickly and simply on a YunoHost server. @@ -36,13 +36,13 @@ you can synchronize your files over your devices. In addition to Nextcloud core features, the following are made available with this package: - * Integrate with YunoHost users and SSO - i.e. logout button + * 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 + not already served - i.e by Baïkal #### Multi-users support From 31ae53dc0e72d735df337996da6522178c44ad25 Mon Sep 17 00:00:00 2001 From: lapineige Date: Sun, 29 Mar 2020 17:54:49 +0200 Subject: [PATCH 120/204] Documentation link + how to use occ command - Add a link to Nextcloud documentation - Explain how to use occ command with Yunohost config --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 0f3fcc1..a5e3778 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,14 @@ Following symlinks is not allowed ('/home/yunohost.multimedia/user/Share' -> '/h ## Additionnal informations +#### `occ` command usage + +If you need/want to use Nextcloud `occ` command¹, you need to be in `/var/www/nextcloud/` folder, 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. Since Nextcloud 18 Yunohost use php7.3, before it was 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 :) + #### Migrate from ownCloud **This is not considered as stable yet, please do it with care and only for @@ -104,6 +112,7 @@ sudo yunohost app ssowatconf * Report a bug: https://github.com/YunoHost-Apps/nextcloud_ynh/issues * Nextcloud website: https://nextcloud.com/ + * Nextcloud documentation: https://docs.nextcloud.com/ * Nextcloud repository: https://github.com/nextcloud/server * YunoHost website: https://yunohost.org/ From 30a3d9ceab1ef4a2b7d897fee53221cee09ab6ec Mon Sep 17 00:00:00 2001 From: "ljf (zamentur)" Date: Wed, 1 Apr 2020 03:40:07 +0200 Subject: [PATCH 121/204] [fix] Backward compatibility for NC 14 or older --- scripts/upgrade | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 8d109b4..77fd66e 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -199,8 +199,15 @@ fi # Define a function to execute commands with `occ` exec_occ() { + # Backward compatibility to upgrade from NC14 or older version + if [ $current_major_version -gt 14 ] + then + NEXTCLOUD_PHP_VERSION=$YNH_PHP_VERSION + else + NEXTCLOUD_PHP_VERSION="7.0" + fi (cd "$final_path" && exec_as "$app" \ - php$YNH_PHP_VERSION occ --no-interaction --no-ansi "$@") + php$NEXTCLOUD_PHP_VERSION occ --no-interaction --no-ansi "$@") } # Define a function to add an external storage From e821c6c06b89db4619d3355f35e6101dff15731f Mon Sep 17 00:00:00 2001 From: "ljf (zamentur)" Date: Wed, 1 Apr 2020 03:54:51 +0200 Subject: [PATCH 122/204] [fix] "last" don't pass correctly --- scripts/upgrade | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 77fd66e..895e79c 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -200,11 +200,11 @@ fi # Define a function to execute commands with `occ` exec_occ() { # Backward compatibility to upgrade from NC14 or older version - if [ $current_major_version -gt 14 ] + if [ $current_major_version -lt 15 ] then - NEXTCLOUD_PHP_VERSION=$YNH_PHP_VERSION - else NEXTCLOUD_PHP_VERSION="7.0" + else + NEXTCLOUD_PHP_VERSION=$YNH_PHP_VERSION fi (cd "$final_path" && exec_as "$app" \ php$NEXTCLOUD_PHP_VERSION occ --no-interaction --no-ansi "$@") From de430e91acbe45eecd3aef6590c7ce762381fb6a Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Wed, 1 Apr 2020 12:23:19 +0200 Subject: [PATCH 123/204] Update upgrade --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 895e79c..5d832b6 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -204,7 +204,7 @@ exec_occ() { then NEXTCLOUD_PHP_VERSION="7.0" else - NEXTCLOUD_PHP_VERSION=$YNH_PHP_VERSION + NEXTCLOUD_PHP_VERSION=$YNH_PHP_VERSION fi (cd "$final_path" && exec_as "$app" \ php$NEXTCLOUD_PHP_VERSION occ --no-interaction --no-ansi "$@") From fb648fc9cf436b98ea95859aab2942b429709961 Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Wed, 1 Apr 2020 17:38:30 +0200 Subject: [PATCH 124/204] Fix nginx conf --- conf/nginx.conf | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 8f2b3fb..c4b73e1 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -4,18 +4,24 @@ location = /.well-known/carddav { location = /.well-known/caldav { return 301 https://$server_name__PATH__/remote.php/dav; } -location = /.well-known/host-meta { - return 301 $scheme://$host:$server_port__PATH__/public.php?service=host-meta; -} -location = /.well-known/host-meta.json { - return 301 $scheme://$host:$server_port__PATH__/public.php?service=host-meta-json; -} -location = /.well-known/webfinger { - return 301 $scheme://$host:$server_port__PATH__/public.php?service=webfinger; -} -location = /.well-known/nodeinfo { - return 301 $scheme://$host:$server_port__PATH__/public.php?service=nodeinfo; -} + +# The following 2 rules are only needed for the user_webfinger app. +# Uncomment it if you're planning to use this app. +#location = /.well-known/host-meta { +# return 301 $scheme://$host:$server_port__PATH__/public.php?service=host-meta; +#} +#location = /.well-known/host-meta.json { +# return 301 $scheme://$host:$server_port__PATH__/public.php?service=host-meta-json; +#} + +# The following 2 rules are only needed for the Social app. +# Uncomment it if you're planning to use this app. +#location = /.well-known/webfinger { +# return 301 $scheme://$host:$server_port__PATH__/public.php?service=webfinger; +#} +#location = /.well-known/nodeinfo { +# return 301 $scheme://$host:$server_port__PATH__/public.php?service=nodeinfo; +#} #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; location ^~ __PATH__/ { From 5bfea04d15eed4cec0bec30ff53fa3a7eac4f752 Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Sun, 12 Apr 2020 00:41:21 +0200 Subject: [PATCH 125/204] Migrate to new php helpers --- conf/php-fpm.conf | 446 -------------------------- manifest.json | 2 +- scripts/_common.sh | 605 ------------------------------------ scripts/_ynh_add_fpm_config | 146 --------- scripts/config | 3 +- scripts/install | 9 +- scripts/restore | 28 +- scripts/upgrade | 7 +- 8 files changed, 23 insertions(+), 1223 deletions(-) delete mode 100644 conf/php-fpm.conf delete mode 100644 scripts/_ynh_add_fpm_config diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf deleted file mode 100644 index 33dcb5e..0000000 --- a/conf/php-fpm.conf +++ /dev/null @@ -1,446 +0,0 @@ -; Start a new pool named 'www'. -; the variable $pool can be used in any directive and will be replaced by the -; pool name ('www' here) -[__NAMETOCHANGE__] - -; Per pool prefix -; It only applies on the following directives: -; - 'access.log' -; - 'slowlog' -; - 'listen' (unixsocket) -; - 'chroot' -; - 'chdir' -; - 'php_values' -; - 'php_admin_values' -; When not set, the global prefix (or /usr) applies instead. -; Note: This directive can also be relative to the global prefix. -; Default Value: none -;prefix = /path/to/pools/$pool - -; Unix user/group of processes -; Note: The user is mandatory. If the group is not set, the default user's group -; will be used. -user = __USER__ -group = __USER__ - -; The address on which to accept FastCGI requests. -; Valid syntaxes are: -; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on -; a specific port; -; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on -; a specific port; -; 'port' - to listen on a TCP socket to all addresses -; (IPv6 and IPv4-mapped) on a specific port; -; '/path/to/unix/socket' - to listen on a unix socket. -; Note: This value is mandatory. -listen = /var/run/php/php__PHPVERSION__-fpm-__NAMETOCHANGE__.sock - -; Set listen(2) backlog. -; Default Value: 511 (-1 on FreeBSD and OpenBSD) -;listen.backlog = 511 - -; Set permissions for unix socket, if one is used. In Linux, read/write -; permissions must be set in order to allow connections from a web server. Many -; BSD-derived systems allow connections regardless of permissions. -; Default Values: user and group are set as the running user -; mode is set to 0660 -listen.owner = www-data -listen.group = www-data -;listen.mode = 0660 -; When POSIX Access Control Lists are supported you can set them using -; these options, value is a comma separated list of user/group names. -; When set, listen.owner and listen.group are ignored -;listen.acl_users = -;listen.acl_groups = - -; List of addresses (IPv4/IPv6) of FastCGI clients which are allowed to connect. -; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original -; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address -; must be separated by a comma. If this value is left blank, connections will be -; accepted from any ip address. -; Default Value: any -;listen.allowed_clients = 127.0.0.1 - -; Specify the nice(2) priority to apply to the pool processes (only if set) -; The value can vary from -19 (highest priority) to 20 (lower priority) -; Note: - It will only work if the FPM master process is launched as root -; - The pool processes will inherit the master process priority -; unless it specified otherwise -; Default Value: no set -; process.priority = -19 - -; Set the process dumpable flag (PR_SET_DUMPABLE prctl) even if the process user -; or group is differrent than the master process user. It allows to create process -; core dump and ptrace the process for the pool user. -; Default Value: no -; process.dumpable = yes - -; Choose how the process manager will control the number of child processes. -; Possible Values: -; static - a fixed number (pm.max_children) of child processes; -; dynamic - the number of child processes are set dynamically based on the -; following directives. With this process management, there will be -; always at least 1 children. -; pm.max_children - the maximum number of children that can -; be alive at the same time. -; pm.start_servers - the number of children created on startup. -; pm.min_spare_servers - the minimum number of children in 'idle' -; state (waiting to process). If the number -; of 'idle' processes is less than this -; number then some children will be created. -; pm.max_spare_servers - the maximum number of children in 'idle' -; state (waiting to process). If the number -; of 'idle' processes is greater than this -; number then some children will be killed. -; ondemand - no children are created at startup. Children will be forked when -; new requests will connect. The following parameter are used: -; pm.max_children - the maximum number of children that -; can be alive at the same time. -; pm.process_idle_timeout - The number of seconds after which -; an idle process will be killed. -; Note: This value is mandatory. -pm = dynamic - -; The number of child processes to be created when pm is set to 'static' and the -; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'. -; This value sets the limit on the number of simultaneous requests that will be -; served. Equivalent to the ApacheMaxClients directive with mpm_prefork. -; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP -; CGI. The below defaults are based on a server without much resources. Don't -; forget to tweak pm.* to fit your needs. -; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand' -; Note: This value is mandatory. -pm.max_children = 10 - -; The number of child processes created on startup. -; Note: Used only when pm is set to 'dynamic' -; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2 -pm.start_servers = 2 - -; The desired minimum number of idle server processes. -; Note: Used only when pm is set to 'dynamic' -; Note: Mandatory when pm is set to 'dynamic' -pm.min_spare_servers = 1 - -; The desired maximum number of idle server processes. -; Note: Used only when pm is set to 'dynamic' -; Note: Mandatory when pm is set to 'dynamic' -pm.max_spare_servers = 3 - -; The number of seconds after which an idle process will be killed. -; Note: Used only when pm is set to 'ondemand' -; Default Value: 10s -;pm.process_idle_timeout = 10s; - -; The number of requests each child process should execute before respawning. -; This can be useful to work around memory leaks in 3rd party libraries. For -; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS. -; Default Value: 0 -;pm.max_requests = 500 - -; The URI to view the FPM status page. If this value is not set, no URI will be -; recognized as a status page. It shows the following informations: -; pool - the name of the pool; -; process manager - static, dynamic or ondemand; -; start time - the date and time FPM has started; -; start since - number of seconds since FPM has started; -; accepted conn - the number of request accepted by the pool; -; listen queue - the number of request in the queue of pending -; connections (see backlog in listen(2)); -; max listen queue - the maximum number of requests in the queue -; of pending connections since FPM has started; -; listen queue len - the size of the socket queue of pending connections; -; idle processes - the number of idle processes; -; active processes - the number of active processes; -; total processes - the number of idle + active processes; -; max active processes - the maximum number of active processes since FPM -; has started; -; max children reached - number of times, the process limit has been reached, -; when pm tries to start more children (works only for -; pm 'dynamic' and 'ondemand'); -; Value are updated in real time. -; Example output: -; pool: www -; process manager: static -; start time: 01/Jul/2011:17:53:49 +0200 -; start since: 62636 -; accepted conn: 190460 -; listen queue: 0 -; max listen queue: 1 -; listen queue len: 42 -; idle processes: 4 -; active processes: 11 -; total processes: 15 -; max active processes: 12 -; max children reached: 0 -; -; By default the status page output is formatted as text/plain. Passing either -; 'html', 'xml' or 'json' in the query string will return the corresponding -; output syntax. Example: -; http://www.foo.bar/status -; http://www.foo.bar/status?json -; http://www.foo.bar/status?html -; http://www.foo.bar/status?xml -; -; By default the status page only outputs short status. Passing 'full' in the -; query string will also return status for each pool process. -; Example: -; http://www.foo.bar/status?full -; http://www.foo.bar/status?json&full -; http://www.foo.bar/status?html&full -; http://www.foo.bar/status?xml&full -; The Full status returns for each process: -; pid - the PID of the process; -; state - the state of the process (Idle, Running, ...); -; start time - the date and time the process has started; -; start since - the number of seconds since the process has started; -; requests - the number of requests the process has served; -; request duration - the duration in µs of the requests; -; request method - the request method (GET, POST, ...); -; request URI - the request URI with the query string; -; content length - the content length of the request (only with POST); -; user - the user (PHP_AUTH_USER) (or '-' if not set); -; script - the main script called (or '-' if not set); -; last request cpu - the %cpu the last request consumed -; it's always 0 if the process is not in Idle state -; because CPU calculation is done when the request -; processing has terminated; -; last request memory - the max amount of memory the last request consumed -; it's always 0 if the process is not in Idle state -; because memory calculation is done when the request -; processing has terminated; -; If the process is in Idle state, then informations are related to the -; last request the process has served. Otherwise informations are related to -; the current request being served. -; Example output: -; ************************ -; pid: 31330 -; state: Running -; start time: 01/Jul/2011:17:53:49 +0200 -; start since: 63087 -; requests: 12808 -; request duration: 1250261 -; request method: GET -; request URI: /test_mem.php?N=10000 -; content length: 0 -; user: - -; script: /home/fat/web/docs/php/test_mem.php -; last request cpu: 0.00 -; last request memory: 0 -; -; Note: There is a real-time FPM status monitoring sample web page available -; It's available in: /usr/share/php/__PHPVERSION__/fpm/status.html -; -; Note: The value must start with a leading slash (/). The value can be -; anything, but it may not be a good idea to use the .php extension or it -; may conflict with a real PHP file. -; Default Value: not set -;pm.status_path = /status - -; The ping URI to call the monitoring page of FPM. If this value is not set, no -; URI will be recognized as a ping page. This could be used to test from outside -; that FPM is alive and responding, or to -; - create a graph of FPM availability (rrd or such); -; - remove a server from a group if it is not responding (load balancing); -; - trigger alerts for the operating team (24/7). -; Note: The value must start with a leading slash (/). The value can be -; anything, but it may not be a good idea to use the .php extension or it -; may conflict with a real PHP file. -; Default Value: not set -;ping.path = /ping - -; This directive may be used to customize the response of a ping request. The -; response is formatted as text/plain with a 200 response code. -; Default Value: pong -;ping.response = pong - -; The access log file -; Default: not set -;access.log = log/$pool.access.log - -; The access log format. -; The following syntax is allowed -; %%: the '%' character -; %C: %CPU used by the request -; it can accept the following format: -; - %{user}C for user CPU only -; - %{system}C for system CPU only -; - %{total}C for user + system CPU (default) -; %d: time taken to serve the request -; it can accept the following format: -; - %{seconds}d (default) -; - %{miliseconds}d -; - %{mili}d -; - %{microseconds}d -; - %{micro}d -; %e: an environment variable (same as $_ENV or $_SERVER) -; it must be associated with embraces to specify the name of the env -; variable. Some exemples: -; - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e -; - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e -; %f: script filename -; %l: content-length of the request (for POST request only) -; %m: request method -; %M: peak of memory allocated by PHP -; it can accept the following format: -; - %{bytes}M (default) -; - %{kilobytes}M -; - %{kilo}M -; - %{megabytes}M -; - %{mega}M -; %n: pool name -; %o: output header -; it must be associated with embraces to specify the name of the header: -; - %{Content-Type}o -; - %{X-Powered-By}o -; - %{Transfert-Encoding}o -; - .... -; %p: PID of the child that serviced the request -; %P: PID of the parent of the child that serviced the request -; %q: the query string -; %Q: the '?' character if query string exists -; %r: the request URI (without the query string, see %q and %Q) -; %R: remote IP address -; %s: status (response code) -; %t: server time the request was received -; it can accept a strftime(3) format: -; %d/%b/%Y:%H:%M:%S %z (default) -; The strftime(3) format must be encapsuled in a %{}t tag -; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t -; %T: time the log has been written (the request has finished) -; it can accept a strftime(3) format: -; %d/%b/%Y:%H:%M:%S %z (default) -; The strftime(3) format must be encapsuled in a %{}t tag -; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t -; %u: remote user -; -; Default: "%R - %u %t \"%m %r\" %s" -;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%" - -; The log file for slow requests -; Default Value: not set -; Note: slowlog is mandatory if request_slowlog_timeout is set -;slowlog = log/$pool.log.slow - -; The timeout for serving a single request after which a PHP backtrace will be -; dumped to the 'slowlog' file. A value of '0s' means 'off'. -; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) -; Default Value: 0 -;request_slowlog_timeout = 0 - -; The timeout for serving a single request after which the worker process will -; be killed. This option should be used when the 'max_execution_time' ini option -; does not stop script execution for some reason. A value of '0' means 'off'. -; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) -; Default Value: 0 -request_terminate_timeout = 1d - -; Set open file descriptor rlimit. -; Default Value: system defined value -;rlimit_files = 1024 - -; Set max core size rlimit. -; Possible Values: 'unlimited' or an integer greater or equal to 0 -; Default Value: system defined value -;rlimit_core = 0 - -; Chroot to this directory at the start. This value must be defined as an -; absolute path. When this value is not set, chroot is not used. -; Note: you can prefix with '$prefix' to chroot to the pool prefix or one -; of its subdirectories. If the pool prefix is not set, the global prefix -; will be used instead. -; Note: chrooting is a great security feature and should be used whenever -; possible. However, all PHP paths will be relative to the chroot -; (error_log, sessions.save_path, ...). -; Default Value: not set -;chroot = - -; Chdir to this directory at the start. -; Note: relative path can be used. -; Default Value: current directory or / when chroot -chdir = __FINALPATH__ - -; Redirect worker stdout and stderr into main error log. If not set, stdout and -; stderr will be redirected to /dev/null according to FastCGI specs. -; Note: on highloaded environement, this can cause some delay in the page -; process time (several ms). -; Default Value: no -;catch_workers_output = yes - -; Clear environment in FPM workers -; Prevents arbitrary environment variables from reaching FPM worker processes -; by clearing the environment in workers before env vars specified in this -; pool configuration are added. -; Setting to "no" will make all environment variables available to PHP code -; via getenv(), $_ENV and $_SERVER. -; Default Value: yes -;clear_env = no - -; Limits the extensions of the main script FPM will allow to parse. This can -; prevent configuration mistakes on the web server side. You should only limit -; FPM to .php extensions to prevent malicious users to use other extensions to -; execute php code. -; Note: set an empty value to allow all extensions. -; Default Value: .php -;security.limit_extensions = .php .php3 .php4 .php5 .php7 - -; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from -; the current environment. -; Default Value: clean env -;env[HOSTNAME] = $HOSTNAME -;env[PATH] = /usr/local/bin:/usr/bin:/bin -;env[TMP] = /tmp -;env[TMPDIR] = /tmp -;env[TEMP] = /tmp -env[PATH] = $PATH -; Additional php.ini defines, specific to this pool of workers. These settings -; overwrite the values previously defined in the php.ini. The directives are the -; same as the PHP SAPI: -; php_value/php_flag - you can set classic ini defines which can -; be overwritten from PHP call 'ini_set'. -; php_admin_value/php_admin_flag - these directives won't be overwritten by -; PHP call 'ini_set' -; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no. - -; Defining 'extension' will load the corresponding shared extension from -; extension_dir. Defining 'disable_functions' or 'disable_classes' will not -; overwrite previously defined php.ini values, but will append the new value -; instead. - -; Note: path INI options can be relative and will be expanded with the prefix -; (pool, global or /usr) - -; Default Value: nothing is defined by default except the values in php.ini and -; specified at startup with the -d argument -;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com -;php_flag[display_errors] = off -;php_admin_value[error_log] = /var/log/fpm-php.www.log -;php_admin_flag[log_errors] = on -;php_admin_value[memory_limit] = 32M - -; Common values to change to increase file upload limit -; php_admin_value[upload_max_filesize] = 50M -; php_admin_value[post_max_size] = 50M -; php_admin_flag[mail.add_x_header] = Off - -; Other common parameters -; php_admin_value[max_execution_time] = 600 -; php_admin_value[max_input_time] = 300 -; php_admin_value[memory_limit] = 256M -; php_admin_flag[short_open_tag] = On - -; Additional php.ini defines, specific to this pool of workers. -php_admin_value[memory_limit] = 512M -php_value[upload_max_filesize] = 10G -php_value[post_max_size] = 10G -php_value[default_charset] = UTF-8 -; OPcache is already activated by default -; php_value[opcache.enable]=1 -; The following parameters are nevertheless recommended for Nextcloud -; see here: https://docs.nextcloud.com/server/15/admin_manual/installation/server_tuning.html#enable-php-opcache -php_value[opcache.enable_cli]=1 -php_value[opcache.interned_strings_buffer]=8 -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 diff --git a/manifest.json b/manifest.json index 5f79407..350b62f 100644 --- a/manifest.json +++ b/manifest.json @@ -14,7 +14,7 @@ "email": "apps@yunohost.org" }, "requirements": { - "yunohost": ">= 3.5.0" + "yunohost": ">= 3.8.0" }, "multi_instance": true, "services": [ diff --git a/scripts/_common.sh b/scripts/_common.sh index 7b84705..2b5a5c9 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -344,234 +344,6 @@ ynh_smart_mktemp () { echo "$(sudo mktemp --directory --tmpdir="$tmpdir")" } -#================================================= - -# Check the amount of available RAM -# -# usage: ynh_check_ram [--required=RAM required in Mb] [--no_swap|--only_swap] [--free_ram] -# | arg: -r, --required= - Amount of RAM required in Mb. The helper will return 0 is there's enough RAM, or 1 otherwise. -# If --required isn't set, the helper will print the amount of RAM, in Mb. -# | arg: -s, --no_swap - Ignore swap -# | arg: -o, --only_swap - Ignore real RAM, consider only swap. -# | arg: -f, --free_ram - Count only free RAM, not the total amount of RAM available. -ynh_check_ram () { - # Declare an array to define the options of this helper. - declare -Ar args_array=( [r]=required= [s]=no_swap [o]=only_swap [f]=free_ram ) - local required - local no_swap - local only_swap - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - required=${required:-} - no_swap=${no_swap:-0} - only_swap=${only_swap:-0} - - local total_ram=$(vmstat --stats --unit M | grep "total memory" | awk '{print $1}') - local total_swap=$(vmstat --stats --unit M | grep "total swap" | awk '{print $1}') - local total_ram_swap=$(( total_ram + total_swap )) - - local free_ram=$(vmstat --stats --unit M | grep "free memory" | awk '{print $1}') - local free_swap=$(vmstat --stats --unit M | grep "free swap" | awk '{print $1}') - local free_ram_swap=$(( free_ram + free_swap )) - - # Use the total amount of ram - local ram=$total_ram_swap - if [ $free_ram -eq 1 ] - then - # Use the total amount of free ram - ram=$free_ram_swap - if [ $no_swap -eq 1 ] - then - # Use only the amount of free ram - ram=$free_ram - elif [ $only_swap -eq 1 ] - then - # Use only the amount of free swap - ram=$free_swap - fi - else - if [ $no_swap -eq 1 ] - then - # Use only the amount of free ram - ram=$total_ram - elif [ $only_swap -eq 1 ] - then - # Use only the amount of free swap - ram=$total_swap - fi - fi - - if [ -n "$required" ] - then - # Return 1 if the amount of ram isn't enough. - if [ $ram -lt $required ] - then - return 1 - else - return 0 - fi - - # If no RAM is required, return the amount of available ram. - else - echo $ram - fi -} - -#================================================= - -# Define the values to configure php-fpm -# -# usage: ynh_get_scalable_phpfpm --usage=usage --footprint=footprint [--print] -# | arg: -f, --footprint - Memory footprint of the service (low/medium/high). -# low - Less than 20Mb of ram by pool. -# medium - Between 20Mb and 40Mb of ram by pool. -# high - More than 40Mb of ram by pool. -# Or specify exactly the footprint, the load of the service as Mb by pool instead of having a standard value. -# To have this value, use the following command and stress the service. -# watch -n0.5 ps -o user,cmd,%cpu,rss -u APP -# -# | arg: -u, --usage - Expected usage of the service (low/medium/high). -# low - Personal usage, behind the sso. -# medium - Low usage, few people or/and publicly accessible. -# high - High usage, frequently visited website. -# -# | arg: -p, --print - Print the result -# -# -# -# The footprint of the service will be used to defined the maximum footprint we can allow, which is half the maximum RAM. -# So it will be used to defined 'pm.max_children' -# A lower value for the footprint will allow more children for 'pm.max_children'. And so for -# 'pm.start_servers', 'pm.min_spare_servers' and 'pm.max_spare_servers' which are defined from the -# value of 'pm.max_children' -# NOTE: 'pm.max_children' can't exceed 4 times the number of processor's cores. -# -# The usage value will defined the way php will handle the children for the pool. -# A value set as 'low' will set the process manager to 'ondemand'. Children will start only if the -# service is used, otherwise no child will stay alive. This config gives the lower footprint when the -# service is idle. But will use more proc since it has to start a child as soon it's used. -# Set as 'medium', the process manager will be at dynamic. If the service is idle, a number of children -# equal to pm.min_spare_servers will stay alive. So the service can be quick to answer to any request. -# The number of children can grow if needed. The footprint can stay low if the service is idle, but -# not null. The impact on the proc is a little bit less than 'ondemand' as there's always a few -# children already available. -# Set as 'high', the process manager will be set at 'static'. There will be always as many children as -# 'pm.max_children', the footprint is important (but will be set as maximum a quarter of the maximum -# RAM) but the impact on the proc is lower. The service will be quick to answer as there's always many -# children ready to answer. -ynh_get_scalable_phpfpm () { - local legacy_args=ufp - # Declare an array to define the options of this helper. - declare -Ar args_array=( [u]=usage= [f]=footprint= [p]=print ) - local usage - local footprint - local print - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - # Set all characters as lowercase - footprint=${footprint,,} - usage=${usage,,} - print=${print:-0} - - if [ "$footprint" = "low" ] - then - footprint=20 - elif [ "$footprint" = "medium" ] - then - footprint=35 - elif [ "$footprint" = "high" ] - then - footprint=50 - fi - - # Define the way the process manager handle child processes. - if [ "$usage" = "low" ] - then - php_pm=ondemand - elif [ "$usage" = "medium" ] - then - php_pm=dynamic - elif [ "$usage" = "high" ] - then - php_pm=static - else - ynh_die --message="Does not recognize '$usage' as an usage value." - fi - - # Get the total of RAM available, except swap. - local max_ram=$(ynh_check_ram --no_swap) - - less0() { - # Do not allow value below 1 - if [ $1 -le 0 ] - then - echo 1 - else - echo $1 - fi - } - - # Define pm.max_children - # The value of pm.max_children is the total amount of ram divide by 2 and divide again by the footprint of a pool for this app. - # So if php-fpm start the maximum of children, it won't exceed half of the ram. - php_max_children=$(( $max_ram / 2 / $footprint )) - # If process manager is set as static, use half less children. - # Used as static, there's always as many children as the value of pm.max_children - if [ "$php_pm" = "static" ] - then - php_max_children=$(( $php_max_children / 2 )) - fi - php_max_children=$(less0 $php_max_children) - - # To not overload the proc, limit the number of children to 4 times the number of cores. - local core_number=$(nproc) - local max_proc=$(( $core_number * 4 )) - if [ $php_max_children -gt $max_proc ] - then - php_max_children=$max_proc - fi - - if [ "$php_pm" = "dynamic" ] - then - # Define pm.start_servers, pm.min_spare_servers and pm.max_spare_servers for a dynamic process manager - php_min_spare_servers=$(( $php_max_children / 8 )) - php_min_spare_servers=$(less0 $php_min_spare_servers) - - php_max_spare_servers=$(( $php_max_children / 2 )) - php_max_spare_servers=$(less0 $php_max_spare_servers) - - php_start_servers=$(( $php_min_spare_servers + ( $php_max_spare_servers - $php_min_spare_servers ) /2 )) - php_start_servers=$(less0 $php_start_servers) - else - php_min_spare_servers=0 - php_max_spare_servers=0 - php_start_servers=0 - fi - - if [ $print -eq 1 ] - then - ynh_debug --message="Footprint=${footprint}Mb by pool." - ynh_debug --message="Process manager=$php_pm" - ynh_debug --message="Max RAM=${max_ram}Mb" - if [ "$php_pm" != "static" ]; then - ynh_debug --message="\nMax estimated footprint=$(( $php_max_children * $footprint ))" - ynh_debug --message="Min estimated footprint=$(( $php_min_spare_servers * $footprint ))" - fi - if [ "$php_pm" = "dynamic" ]; then - ynh_debug --message="Estimated average footprint=$(( $php_max_spare_servers * $footprint ))" - elif [ "$php_pm" = "static" ]; then - ynh_debug --message="Estimated footprint=$(( $php_max_children * $footprint ))" - fi - ynh_debug --message="\nRaw php-fpm values:" - ynh_debug --message="pm.max_children = $php_max_children" - if [ "$php_pm" = "dynamic" ]; then - ynh_debug --message="pm.start_servers = $php_start_servers" - ynh_debug --message="pm.min_spare_servers = $php_min_spare_servers" - ynh_debug --message="pm.max_spare_servers = $php_max_spare_servers" - fi - fi -} - #================================================= # FUTURE OFFICIAL HELPERS #================================================= @@ -614,380 +386,3 @@ ynh_multimedia_addaccess () { groupadd -f multimedia usermod -a -G multimedia $user_name } - -# Install another version of php. -# -# usage: ynh_install_php --phpversion=phpversion [--package=packages] -# | arg: -v, --phpversion - Version of php to install. -# | arg: -p, --package - Additionnal php packages to install -ynh_install_php () { - # Declare an array to define the options of this helper. - local legacy_args=vp - declare -Ar args_array=( [v]=phpversion= [p]=package= ) - local phpversion - local package - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - package=${package:-} - - # Store phpversion into the config of this app - ynh_app_setting_set $app phpversion $phpversion - - if [ "$phpversion" == "7.0" ] - then - ynh_die "Do not use ynh_install_php to install php7.0" - fi - - # Store the ID of this app and the version of php requested for it - echo "$YNH_APP_INSTANCE_NAME:$phpversion" | tee --append "/etc/php/ynh_app_version" - - # Add an extra repository for those packages - ynh_install_extra_repo --repo="https://packages.sury.org/php/ $(lsb_release -sc) main" --key="https://packages.sury.org/php/apt.gpg" --priority=995 --name=extra_php_version - - # Install requested dependencies from this extra repository. - # Install php-fpm first, otherwise php will install apache as a dependency. - ynh_add_app_dependencies --package="php${phpversion}-fpm" - ynh_add_app_dependencies --package="php$phpversion php${phpversion}-common $package" - - # Set php7.0 back as the default version for php-cli. - update-alternatives --set php /usr/bin/php7.0 - - # Pin this extra repository after packages are installed to prevent sury of doing shit - ynh_pin_repo --package="*" --pin="origin \"packages.sury.org\"" --priority=200 --name=extra_php_version - ynh_pin_repo --package="php7.0*" --pin="origin \"packages.sury.org\"" --priority=600 --name=extra_php_version --append - - # Advertise service in admin panel - yunohost service add php${phpversion}-fpm --log "/var/log/php${phpversion}-fpm.log" -} - -# Remove the specific version of php used by the app. -# -# usage: ynh_install_php -ynh_remove_php () { - # Get the version of php used by this app - local phpversion=$(ynh_app_setting_get $app phpversion) - - if [ "$phpversion" == "7.0" ] || [ -z "$phpversion" ] - then - if [ "$phpversion" == "7.0" ] - then - ynh_print_err "Do not use ynh_remove_php to install php7.0" - fi - return 0 - fi - - # Remove the line for this app - sed --in-place "/$YNH_APP_INSTANCE_NAME:$phpversion/d" "/etc/php/ynh_app_version" - - # If no other app uses this version of php, remove it. - if ! grep --quiet "$phpversion" "/etc/php/ynh_app_version" - then - # Purge php dependences for this version. - ynh_package_autopurge "php$phpversion php${phpversion}-fpm php${phpversion}-common" - # Remove the service from the admin panel - yunohost service remove php${phpversion}-fpm - fi - - # If no other app uses alternate php versions, remove the extra repo for php - if [ ! -s "/etc/php/ynh_app_version" ] - then - ynh_secure_remove /etc/php/ynh_app_version - fi -} - -#================================================= -# FUTURE OFFICIAL HELPERS -#================================================= -# Pin a repository. -# -# usage: ynh_pin_repo --package=packages --pin=pin_filter [--priority=priority_value] [--name=name] [--append] -# | arg: -p, --package - Packages concerned by the pin. Or all, *. -# | arg: -i, --pin - Filter for the pin. -# | arg: -p, --priority - Priority for the pin -# | arg: -n, --name - Name for the files for this repo, $app as default value. -# | arg: -a, --append - Do not overwrite existing files. -# -# See https://manpages.debian.org/stretch/apt/apt_preferences.5.en.html for information about pinning. -# -ynh_pin_repo () { - # Declare an array to define the options of this helper. - local legacy_args=pirna - declare -Ar args_array=( [p]=package= [i]=pin= [r]=priority= [n]=name= [a]=append ) - local package - local pin - local priority - local name - local append - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - package="${package:-*}" - priority=${priority:-50} - name="${name:-$app}" - append=${append:-0} - - if [ $append -eq 1 ] - then - append="tee -a" - else - append="tee" - fi - - mkdir -p "/etc/apt/preferences.d" - echo "Package: $package -Pin: $pin -Pin-Priority: $priority -" \ - | $append "/etc/apt/preferences.d/$name" -} - -# Add a repository. -# -# usage: ynh_add_repo --uri=uri --suite=suite --component=component [--name=name] [--append] -# | arg: -u, --uri - Uri of the repository. -# | arg: -s, --suite - Suite of the repository. -# | arg: -c, --component - Component of the repository. -# | arg: -n, --name - Name for the files for this repo, $app as default value. -# | arg: -a, --append - Do not overwrite existing files. -# -# Example for a repo like deb http://forge.yunohost.org/debian/ stretch stable -# uri suite component -# ynh_add_repo --uri=http://forge.yunohost.org/debian/ --suite=stretch --component=stable -# -ynh_add_repo () { - # Declare an array to define the options of this helper. - local legacy_args=uscna - declare -Ar args_array=( [u]=uri= [s]=suite= [c]=component= [n]=name= [a]=append ) - local uri - local suite - local component - local name - local append - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - name="${name:-$app}" - append=${append:-0} - - if [ $append -eq 1 ] - then - append="tee -a" - else - append="tee" - fi - - mkdir -p "/etc/apt/sources.list.d" - # Add the new repo in sources.list.d - echo "deb $uri $suite $component" \ - | $append "/etc/apt/sources.list.d/$name.list" -} - -# Add an extra repository correctly, pin it and get the key. -# -# usage: ynh_install_extra_repo --repo="repo" [--key=key_url] [--priority=priority_value] [--name=name] [--append] -# | arg: -r, --repo - Complete url of the extra repository. -# | arg: -k, --key - url to get the public key. -# | arg: -p, --priority - Priority for the pin -# | arg: -n, --name - Name for the files for this repo, $app as default value. -# | arg: -a, --append - Do not overwrite existing files. -ynh_install_extra_repo () { - # Declare an array to define the options of this helper. - local legacy_args=rkpna - declare -Ar args_array=( [r]=repo= [k]=key= [p]=priority= [n]=name= [a]=append ) - local repo - local key - local priority - local name - local append - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - name="${name:-$app}" - append=${append:-0} - key=${key:-0} - priority=${priority:-} - - if [ $append -eq 1 ] - then - append="--append" - wget_append="tee -a" - else - append="" - wget_append="tee" - fi - - # Split the repository into uri, suite and components. - # Remove "deb " at the beginning of the repo. - repo="${repo#deb }" - - # Get the uri - local uri="$(echo "$repo" | awk '{ print $1 }')" - - # Get the suite - local suite="$(echo "$repo" | awk '{ print $2 }')" - - # Get the components - local component="${repo##$uri $suite }" - - # Add the repository into sources.list.d - ynh_add_repo --uri="$uri" --suite="$suite" --component="$component" --name="$name" $append - - # Pin the new repo with the default priority, so it won't be used for upgrades. - # Build $pin from the uri without http and any sub path - local pin="${uri#*://}" - pin="${pin%%/*}" - # Set a priority only if asked - if [ -n "$priority" ] - then - priority="--priority=$priority" - fi - ynh_pin_repo --package="*" --pin="origin \"$pin\"" $priority --name="$name" $append - - # Get the public key for the repo - if [ -n "$key" ] - then - mkdir -p "/etc/apt/trusted.gpg.d" - wget -q "$key" -O - | gpg --dearmor | $wget_append /etc/apt/trusted.gpg.d/$name.gpg > /dev/null - fi - - # Update the list of package with the new repo - ynh_package_update -} - -# Remove an extra repository and the assiociated configuration. -# -# usage: ynh_remove_extra_repo [--name=name] -# | arg: -n, --name - Name for the files for this repo, $app as default value. -ynh_remove_extra_repo () { - # Declare an array to define the options of this helper. - local legacy_args=n - declare -Ar args_array=( [n]=name= ) - local name - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - name="${name:-$app}" - - ynh_secure_remove "/etc/apt/sources.list.d/$name.list" - ynh_secure_remove "/etc/apt/preferences.d/$name" - ynh_secure_remove "/etc/apt/trusted.gpg.d/$name.gpg" - ynh_secure_remove "/etc/apt/trusted.gpg.d/$name.asc" - - # Update the list of package to exclude the old repo - ynh_package_update -} - -# Install packages from an extra repository properly. -# -# usage: ynh_install_extra_app_dependencies --repo="repo" --package="dep1 dep2" [--key=key_url] [--name=name] -# | arg: -r, --repo - Complete url of the extra repository. -# | arg: -p, --package - The packages to install from this extra repository -# | arg: -k, --key - url to get the public key. -# | arg: -n, --name - Name for the files for this repo, $app as default value. -ynh_install_extra_app_dependencies () { - # Declare an array to define the options of this helper. - local legacy_args=rpkn - declare -Ar args_array=( [r]=repo= [p]=package= [k]=key= [n]=name= ) - local repo - local package - local key - local name - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - name="${name:-$app}" - key=${key:-0} - - # Set a key only if asked - if [ -n "$key" ] - then - key="--key=$key" - fi - # Add an extra repository for those packages - ynh_install_extra_repo --repo="$repo" $key --priority=995 --name=$name - - # Install requested dependencies from this extra repository. - ynh_add_app_dependencies --package="$package" - - # Remove this extra repository after packages are installed - ynh_remove_extra_repo --name=$app -} - -#================================================= - -# patched version of ynh_install_app_dependencies to be used with ynh_add_app_dependencies - -# Define and install dependencies with a equivs control file -# This helper can/should only be called once per app -# -# usage: ynh_install_app_dependencies dep [dep [...]] -# | arg: dep - the package name to install in dependence -# You can give a choice between some package with this syntax : "dep1|dep2" -# Example : ynh_install_app_dependencies dep1 dep2 "dep3|dep4|dep5" -# This mean in the dependence tree : dep1 & dep2 & (dep3 | dep4 | dep5) -# -# Requires YunoHost version 2.6.4 or higher. -ynh_install_app_dependencies () { - local dependencies=$@ - dependencies="$(echo "$dependencies" | sed 's/\([^\<=\>]\)\ \([^(]\)/\1, \2/g')" - dependencies=${dependencies//|/ | } - local manifest_path="../manifest.json" - if [ ! -e "$manifest_path" ]; then - manifest_path="../settings/manifest.json" # Into the restore script, the manifest is not at the same place - fi - - local version=$(grep '\"version\": ' "$manifest_path" | cut -d '"' -f 4) # Retrieve the version number in the manifest file. - if [ ${#version} -eq 0 ]; then - version="1.0" - fi - local dep_app=${app//_/-} # Replace all '_' by '-' - - # Handle specific versions - if [[ "$dependencies" =~ [\<=\>] ]] - then - # Replace version specifications by relationships syntax - # https://www.debian.org/doc/debian-policy/ch-relationships.html - # Sed clarification - # [^(\<=\>] ignore if it begins by ( or < = >. To not apply twice. - # [\<=\>] matches < = or > - # \+ matches one or more occurence of the previous characters, for >= or >>. - # [^,]\+ matches all characters except ',' - # Ex: package>=1.0 will be replaced by package (>= 1.0) - dependencies="$(echo "$dependencies" | sed 's/\([^(\<=\>]\)\([\<=\>]\+\)\([^,]\+\)/\1 (\2 \3)/g')" - fi - - cat > /tmp/${dep_app}-ynh-deps.control << EOF # Make a control file for equivs-build -Section: misc -Priority: optional -Package: ${dep_app}-ynh-deps -Version: ${version} -Depends: ${dependencies} -Architecture: all -Description: Fake package for $app (YunoHost app) dependencies - This meta-package is only responsible of installing its dependencies. -EOF - ynh_package_install_from_equivs /tmp/${dep_app}-ynh-deps.control \ - || ynh_die --message="Unable to install dependencies" # Install the fake package and its dependencies - rm /tmp/${dep_app}-ynh-deps.control - ynh_app_setting_set --app=$app --key=apt_dependencies --value="$dependencies" -} - -ynh_add_app_dependencies () { - # Declare an array to define the options of this helper. - local legacy_args=pr - declare -Ar args_array=( [p]=package= [r]=replace) - local package - local replace - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - replace=${replace:-0} - - local current_dependencies="" - if [ $replace -eq 0 ] - then - local dep_app=${app//_/-} # Replace all '_' by '-' - if ynh_package_is_installed --package="${dep_app}-ynh-deps" - then - current_dependencies="$(dpkg-query --show --showformat='${Depends}' ${dep_app}-ynh-deps) " - fi - - current_dependencies=${current_dependencies// | /|} - fi - - ynh_install_app_dependencies "${current_dependencies}${package}" -} diff --git a/scripts/_ynh_add_fpm_config b/scripts/_ynh_add_fpm_config deleted file mode 100644 index 487c044..0000000 --- a/scripts/_ynh_add_fpm_config +++ /dev/null @@ -1,146 +0,0 @@ -#!/bin/bash - -# Create a dedicated php-fpm config -# -# usage 1: ynh_add_fpm_config [--phpversion=7.X] [--use_template] -# | arg: -v, --phpversion - Version of php to use. -# | arg: -t, --use_template - Use this helper in template mode. -# -# ----------------------------------------------------------------------------- -# -# usage 2: ynh_add_fpm_config [--phpversion=7.X] --usage=usage --footprint=footprint -# | arg: -v, --phpversion - Version of php to use.# -# | arg: -f, --footprint - Memory footprint of the service (low/medium/high). -# low - Less than 20Mb of ram by pool. -# medium - Between 20Mb and 40Mb of ram by pool. -# high - More than 40Mb of ram by pool. -# Or specify exactly the footprint, the load of the service as Mb by pool instead of having a standard value. -# To have this value, use the following command and stress the service. -# watch -n0.5 ps -o user,cmd,%cpu,rss -u APP -# -# | arg: -u, --usage - Expected usage of the service (low/medium/high). -# low - Personal usage, behind the sso. -# medium - Low usage, few people or/and publicly accessible. -# high - High usage, frequently visited website. -# -# Requires YunoHost version 2.7.2 or higher. -ynh_add_fpm_config () { - # Declare an array to define the options of this helper. - local legacy_args=vtuf - declare -Ar args_array=( [v]=phpversion= [t]=use_template [u]=usage= [f]=footprint= ) - local phpversion - local use_template - local usage - local footprint - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - # The default behaviour is to use the template. - use_template="${use_template:-1}" - usage="${usage:-}" - footprint="${footprint:-}" - if [ -n "$usage" ] || [ -n "$footprint" ]; then - use_template=0 - fi - - # Configure PHP-FPM 7.0 by default - phpversion="${phpversion:-$YNH_PHP_VERSION}" - - local fpm_config_dir="/etc/php/$phpversion/fpm" - local fpm_service="php${phpversion}-fpm" - # Configure PHP-FPM 5 on Debian Jessie - if [ "$(ynh_get_debian_release)" == "jessie" ]; then - fpm_config_dir="/etc/php5/fpm" - fpm_service="php5-fpm" - fi - ynh_app_setting_set --app=$app --key=fpm_config_dir --value="$fpm_config_dir" - ynh_app_setting_set --app=$app --key=fpm_service --value="$fpm_service" - finalphpconf="$fpm_config_dir/pool.d/$app.conf" - ynh_backup_if_checksum_is_different --file="$finalphpconf" - - if [ $use_template -eq 1 ] - then - # Usage 1, use the template in ../conf/php-fpm.conf - sudo cp ../conf/php-fpm.conf "$finalphpconf" - ynh_replace_string --match_string="__NAMETOCHANGE__" --replace_string="$app" --target_file="$finalphpconf" - ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$finalphpconf" - ynh_replace_string --match_string="__USER__" --replace_string="$app" --target_file="$finalphpconf" - ynh_replace_string --match_string="__PHPVERSION__" --replace_string="$phpversion" --target_file="$finalphpconf" - - else - # Usage 2, generate a php-fpm config file with ynh_get_scalable_phpfpm - ynh_get_scalable_phpfpm --usage=$usage --footprint=$footprint - - # Copy the default file - sudo cp "$fpm_config_dir/pool.d/www.conf" "$finalphpconf" - - # Replace standard variables into the default file - ynh_replace_string --match_string="^\[www\]" --replace_string="[$app]" --target_file="$finalphpconf" - ynh_replace_string --match_string=".*listen = .*" --replace_string="listen = /var/run/php/php$phpversion-fpm-$app.sock" --target_file="$finalphpconf" - ynh_replace_string --match_string="^user = .*" --replace_string="user = $app" --target_file="$finalphpconf" - ynh_replace_string --match_string="^group = .*" --replace_string="group = $app" --target_file="$finalphpconf" - ynh_replace_string --match_string=".*chdir = .*" --replace_string="chdir = $final_path" --target_file="$finalphpconf" - - # Configure fpm children - ynh_replace_string --match_string=".*pm = .*" --replace_string="pm = $php_pm" --target_file="$finalphpconf" - ynh_replace_string --match_string=".*pm.max_children = .*" --replace_string="pm.max_children = $php_max_children" --target_file="$finalphpconf" - ynh_replace_string --match_string=".*pm.max_requests = .*" --replace_string="pm.max_requests = 500" --target_file="$finalphpconf" - ynh_replace_string --match_string=".*request_terminate_timeout = .*" --replace_string="request_terminate_timeout = 1d" --target_file="$finalphpconf" - if [ "$php_pm" = "dynamic" ] - then - ynh_replace_string --match_string=".*pm.start_servers = .*" --replace_string="pm.start_servers = $php_start_servers" --target_file="$finalphpconf" - ynh_replace_string --match_string=".*pm.min_spare_servers = .*" --replace_string="pm.min_spare_servers = $php_min_spare_servers" --target_file="$finalphpconf" - ynh_replace_string --match_string=".*pm.max_spare_servers = .*" --replace_string="pm.max_spare_servers = $php_max_spare_servers" --target_file="$finalphpconf" - elif [ "$php_pm" = "ondemand" ] - then - ynh_replace_string --match_string=".*pm.process_idle_timeout = .*" --replace_string="pm.process_idle_timeout = 10s" --target_file="$finalphpconf" - fi - - # Comment unused parameters - if [ "$php_pm" != "dynamic" ] - then - ynh_replace_string --match_string=".*\(pm.start_servers = .*\)" --replace_string=";\1" --target_file="$finalphpconf" - ynh_replace_string --match_string=".*\(pm.min_spare_servers = .*\)" --replace_string=";\1" --target_file="$finalphpconf" - ynh_replace_string --match_string=".*\(pm.max_spare_servers = .*\)" --replace_string=";\1" --target_file="$finalphpconf" - fi - if [ "$php_pm" != "ondemand" ] - then - ynh_replace_string --match_string=".*\(pm.process_idle_timeout = .*\)" --replace_string=";\1" --target_file="$finalphpconf" - fi - - # Concatene the extra config. - if [ -e ../conf/extra_php-fpm.conf ]; then - cat ../conf/extra_php-fpm.conf >> "$finalphpconf" - fi - fi - sudo chown root: "$finalphpconf" - ynh_store_file_checksum --file="$finalphpconf" - - if [ -e "../conf/php-fpm.ini" ] - then - echo "Packagers ! Please do not use a separate php ini file, merge your directives in the pool file instead." >&2 - finalphpini="$fpm_config_dir/conf.d/20-$app.ini" - ynh_backup_if_checksum_is_different "$finalphpini" - sudo cp ../conf/php-fpm.ini "$finalphpini" - sudo chown root: "$finalphpini" - ynh_store_file_checksum "$finalphpini" - fi - ynh_systemd_action --service_name=$fpm_service --action=reload - - # Clean other php version config files for this app. Used for migration purpose. - if [ -e "/etc/php5/fpm/pool.d/$app.conf" ] - then - ynh_secure_remove --file="/etc/php5/fpm/pool.d/$app.conf" - ynh_systemd_action --service_name=php5-fpm --action=reload - fi - for i in `seq 0 4` - do - if [ "$phpversion" != "7.$i" ] - then - if [ -e "/etc/php/7.$i/fpm/pool.d/$app.conf" ] - then - ynh_secure_remove --file="/etc/php/7.$i/fpm/pool.d/$app.conf" - ynh_systemd_action --service_name=php7.$i-fpm --action=reload - fi - fi - done -} diff --git a/scripts/config b/scripts/config index b0314f0..00601b5 100644 --- a/scripts/config +++ b/scripts/config @@ -8,7 +8,6 @@ source _common.sh source /usr/share/yunohost/helpers -source _ynh_add_fpm_config #================================================= # RETRIEVE ARGUMENTS @@ -78,7 +77,7 @@ apply_config() { if [ "$fpm_footprint" != "0" ] then - ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint + ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$YNH_PHP_VERSION else ynh_print_err --message="When selecting 'specific', you have to set a footprint value into the field below." fi diff --git a/scripts/install b/scripts/install index 5c80e56..e26e7ee 100755 --- a/scripts/install +++ b/scripts/install @@ -8,7 +8,6 @@ source _common.sh source /usr/share/yunohost/helpers -source _ynh_add_fpm_config #================================================= # MANAGE SCRIPT FAILURE @@ -54,12 +53,10 @@ ynh_app_setting_set --app=$app --key=user_home --value=$user_home #================================================= # INSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Installing dependencies..." --weight=60 +ynh_script_progression --message="Installing dependencies..." --weight=10 ynh_install_app_dependencies $pkg_dependencies -ynh_install_php --phpversion="$YNH_PHP_VERSION" --package="$extra_pkg_dependencies" - #================================================= # CREATE A MYSQL DATABASE #================================================= @@ -115,10 +112,10 @@ ynh_system_user_create --username=$app #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Configuring php-fpm..." --weight=2 +ynh_script_progression --message="Configuring php-fpm..." --weight=50 # Create a dedicated php-fpm config -ynh_add_fpm_config --usage=medium --footprint=high +ynh_add_fpm_config --usage=medium --footprint=high --phpversion=$YNH_PHP_VERSION --package="$extra_pkg_dependencies" #================================================= # SPECIFIC SETUP diff --git a/scripts/restore b/scripts/restore index c62be63..127e110 100755 --- a/scripts/restore +++ b/scripts/restore @@ -8,7 +8,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -source _ynh_add_fpm_config #================================================= # MANAGE SCRIPT FAILURE @@ -29,6 +28,9 @@ 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) +fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint) +fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage) + #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= @@ -80,23 +82,26 @@ ynh_script_progression --message="Recreating the dedicated system user..." --wei # Create the dedicated user (if not existing) ynh_system_user_create --username=$app -#================================================= -# RESTORE THE PHP-FPM CONFIGURATION -#================================================= - -ynh_restore_file --origin_path="/etc/php/$YNH_PHP_VERSION/fpm/pool.d/$app.conf" - #================================================= # SPECIFIC RESTORATION #================================================= # REINSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Reinstalling dependencies..." --weight=60 +ynh_script_progression --message="Reinstalling dependencies..." --weight=10 # Define and install dependencies ynh_install_app_dependencies $pkg_dependencies -ynh_install_php --phpversion="$YNH_PHP_VERSION" --package="$extra_pkg_dependencies" +#================================================= +# RESTORE THE PHP-FPM CONFIGURATION +#================================================= +ynh_script_progression --message="Reconfiguring php-fpm..." --weight=50 + +# Restore the file first, so it can have a backup if different +ynh_restore_file --origin_path="/etc/php/$YNH_PHP_VERSION/fpm/pool.d/$app.conf" + +# Recreate a dedicated php-fpm config +ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$YNH_PHP_VERSION --package="$extra_pkg_dependencies" #================================================= # RESTORE THE CRON FILE @@ -168,11 +173,10 @@ ynh_systemd_action --action=restart --service_name=fail2ban #================================================= # GENERIC FINALIZATION #================================================= -# RELOAD NGINX AND PHP-FPM +# RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server and php-fpm..." +ynh_script_progression --message="Reloading nginx web server..." -ynh_systemd_action --service_name=php${YNH_PHP_VERSION}-fpm --action=reload ynh_systemd_action --service_name=nginx --action=reload #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 8d109b4..69a95ae 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -8,7 +8,6 @@ source _common.sh source /usr/share/yunohost/helpers -source _ynh_add_fpm_config #================================================= # LOAD SETTINGS @@ -139,8 +138,6 @@ ynh_script_progression --message="Upgrading dependencies..." --weight=7 ynh_install_app_dependencies $pkg_dependencies -ynh_install_php --phpversion="$YNH_PHP_VERSION" --package="$extra_pkg_dependencies" - #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -182,8 +179,8 @@ ynh_system_user_create --username=$app #================================================= ynh_script_progression --message="Upgrading php-fpm configuration..." --weight=2 -# Create a dedicated php-fpm config -ynh_add_fpm_config --phpversion="$YNH_PHP_VERSION" --usage=$fpm_usage --footprint=$fpm_footprint +# Recreate a dedicated php-fpm config +ynh_add_fpm_config --phpversion="$YNH_PHP_VERSION" --usage=$fpm_usage --footprint=$fpm_footprint --package="$extra_pkg_dependencies" # Delete existing ini configuration file (backward compatibility) if [ -f /etc/php/$YNH_PHP_VERSION/fpm/conf.d/20-$app.ini ]; then From 5ed80548de98293f5cb21d7f3b52852231d0908d Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Sun, 12 Apr 2020 12:41:57 +0200 Subject: [PATCH 126/204] extra_php_dependencies --- scripts/_common.sh | 2 +- scripts/install | 2 +- scripts/restore | 2 +- scripts/upgrade | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 2b5a5c9..a868991 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -6,7 +6,7 @@ pkg_dependencies="imagemagick acl tar smbclient at" YNH_PHP_VERSION="7.3" -extra_pkg_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" +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" #================================================= # EXPERIMENTAL HELPERS diff --git a/scripts/install b/scripts/install index e26e7ee..db96c16 100755 --- a/scripts/install +++ b/scripts/install @@ -115,7 +115,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_pkg_dependencies" +ynh_add_fpm_config --usage=medium --footprint=high --phpversion=$YNH_PHP_VERSION --package="$extra_php_dependencies" #================================================= # SPECIFIC SETUP diff --git a/scripts/restore b/scripts/restore index 127e110..8c49cad 100755 --- a/scripts/restore +++ b/scripts/restore @@ -101,7 +101,7 @@ ynh_script_progression --message="Reconfiguring php-fpm..." --weight=50 ynh_restore_file --origin_path="/etc/php/$YNH_PHP_VERSION/fpm/pool.d/$app.conf" # Recreate a dedicated php-fpm config -ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$YNH_PHP_VERSION --package="$extra_pkg_dependencies" +ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$YNH_PHP_VERSION --package="$extra_php_dependencies" #================================================= # RESTORE THE CRON FILE diff --git a/scripts/upgrade b/scripts/upgrade index 69a95ae..86b2c7a 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -180,7 +180,7 @@ ynh_system_user_create --username=$app ynh_script_progression --message="Upgrading php-fpm configuration..." --weight=2 # Recreate a dedicated php-fpm config -ynh_add_fpm_config --phpversion="$YNH_PHP_VERSION" --usage=$fpm_usage --footprint=$fpm_footprint --package="$extra_pkg_dependencies" +ynh_add_fpm_config --phpversion="$YNH_PHP_VERSION" --usage=$fpm_usage --footprint=$fpm_footprint --package="$extra_php_dependencies" # Delete existing ini configuration file (backward compatibility) if [ -f /etc/php/$YNH_PHP_VERSION/fpm/conf.d/20-$app.ini ]; then From 51dfabee8ba04108789e04198a6eca5f1782566a Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Thu, 16 Apr 2020 01:54:00 +0200 Subject: [PATCH 127/204] Update config.json --- conf/config.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/conf/config.json b/conf/config.json index 2e7aca8..7d24587 100644 --- a/conf/config.json +++ b/conf/config.json @@ -10,7 +10,8 @@ "port": "6379", "timeout": "0.0", "password": "" - } + }, + "hashing_default_password": true }, "apps": { "user_ldap": { From a60ddbf573c8c431a1c001783ecaf7f46497c759 Mon Sep 17 00:00:00 2001 From: lapineige Date: Fri, 17 Apr 2020 09:54:11 +0200 Subject: [PATCH 128/204] fix typo + minor improvement Co-Authored-By: JimboJoe --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a5e3778..6163a54 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ Following symlinks is not allowed ('/home/yunohost.multimedia/user/Share' -> '/h If you need/want to use Nextcloud `occ` command¹, you need to be in `/var/www/nextcloud/` folder, 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. Since Nextcloud 18 Yunohost use php7.3, before it was php7.0.* +*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 :) From 2d80025a049dc81cbf07589fc18a1c2132099c71 Mon Sep 17 00:00:00 2001 From: lapineige Date: Fri, 17 Apr 2020 09:54:31 +0200 Subject: [PATCH 129/204] minor spacing improvement Co-Authored-By: JimboJoe --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6163a54..4a7ad2d 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,8 @@ If you need/want to use Nextcloud `occ` command¹, you need to be in `/var/www/n *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 :) +¹ See https://docs.nextcloud.com/server/18/admin_manual/configuration_server/occ_command.html + Use this only if you know what you're doing :) #### Migrate from ownCloud From e2b06801ae9a254ce03a9c43885e8604d89590da Mon Sep 17 00:00:00 2001 From: lapineige Date: Fri, 17 Apr 2020 09:55:49 +0200 Subject: [PATCH 130/204] adapte to multiple instance Co-Authored-By: JimboJoe --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4a7ad2d..bde855b 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ Following symlinks is not allowed ('/home/yunohost.multimedia/user/Share' -> '/h #### `occ` command usage -If you need/want to use Nextcloud `occ` command¹, you need to be in `/var/www/nextcloud/` folder, 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). +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.* From 2243f24465619bdf4acc811cbdebd4cad65c195a Mon Sep 17 00:00:00 2001 From: lapineige Date: Sat, 18 Apr 2020 11:27:35 +0200 Subject: [PATCH 131/204] Explain how to use OnlyOffice + minor readme reorganisation (it seems to be more a "configuration" thing) --- README.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bde855b..7edceec 100644 --- a/README.md +++ b/README.md @@ -24,13 +24,23 @@ you can synchronize your files over your devices. * [YunoHost demo](https://demo.yunohost.org/nextcloud/) * [Official demo](https://demo.nextcloud.com/) -## Configuration - ## Documentation * Official documentation: https://docs.nextcloud.com/server/18/user_manual/ * YunoHost documentation: https://github.com/YunoHost/doc/blob/master/app_nextcloud_fr.md +## Configuration + +#### Configure OnlyOffice integration + +Starting from Nextcloud 18, it features a direct integration of OnlyOffice (an online rich text document editor) thought a Nextcloud app. +To install and configure it: +- Install *Community Document Server* application in your Nextcloud +- Then in Settings -> OnlyOffice (`https://yourdomain.tld/nextcloud/settings/admin/onlyoffice`), you need to configure its URL with `https://yourdomain.tld/nextcloud/index.php/apps/documentserver_community/`. Keep others server parameters empty. Save it. +- You can also configure with file formats should be openned by OnlyOffice. +- Here you go :) You should be able to create new type of documents and open them. + + ## YunoHost specific features In addition to Nextcloud core features, the following are made available with From c402cc819b0e247b8a90a432c1fb133f575b6953 Mon Sep 17 00:00:00 2001 From: lapineige Date: Sat, 18 Apr 2020 11:32:07 +0200 Subject: [PATCH 132/204] OnlyOffice: add architecture support information --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 7edceec..1cff9bf 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,7 @@ To install and configure it: - You can also configure with file formats should be openned 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** (Raspberry Pi, …) is **not** supported* ## YunoHost specific features From ad396b04afd73f18409f5a9d9eff2e5e696deb87 Mon Sep 17 00:00:00 2001 From: lapineige Date: Fri, 24 Apr 2020 14:39:13 +0200 Subject: [PATCH 133/204] OnlyOffice doc: improve clarity --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1cff9bf..3f825dd 100644 --- a/README.md +++ b/README.md @@ -35,8 +35,9 @@ you can synchronize your files over your devices. Starting from Nextcloud 18, it features a direct integration of OnlyOffice (an online rich text document editor) thought a Nextcloud app. To install and configure it: -- Install *Community Document Server* application in your Nextcloud -- Then in Settings -> OnlyOffice (`https://yourdomain.tld/nextcloud/settings/admin/onlyoffice`), you need to configure its URL with `https://yourdomain.tld/nextcloud/index.php/apps/documentserver_community/`. Keep others server parameters empty. Save 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`), you need to configure its URL with `https://yourdomain.tld/nextcloud/index.php/apps/documentserver_community/` (an URL might be defined by default, but is not always correct). Keep others server parameters empty. Save it. - You can also configure with file formats should be openned by OnlyOffice. - Here you go :) You should be able to create new type of documents and open them. From dda72665c3238b0f83602ef2fdce1cb33c5a8e28 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Sat, 25 Apr 2020 10:33:17 +0200 Subject: [PATCH 134/204] Upgrade to upstream version 18.0.4 --- README.md | 2 +- manifest.json | 2 +- scripts/upgrade.d/upgrade.last.sh | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1ce4ca2..9ed1ae5 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ own data. A personal cloud which run on your own server. With Nextcloud you can synchronize your files over your devices. -**Shipped version:** 18.0.3 +**Shipped version:** 18.0.4 ## Screenshots diff --git a/manifest.json b/manifest.json index 5f79407..c3cc160 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Access & share your files, calendars, contacts, mail & more from any device, on your terms", "fr": "Consultez et partagez vos fichiers, agendas, carnets d'adresses, emails et bien plus depuis les appareils de votre choix, sous vos conditions" }, - "version": "18.0.3~ynh1", + "version": "18.0.4~ynh1", "url": "https://nextcloud.com", "license": "AGPL-3.0", "maintainer": { diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index 4da3883..6a77d34 100755 --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -1,10 +1,10 @@ #!/bin/bash # Last available nextcloud version -next_version="18.0.3" +next_version="18.0.4" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="7b67e709006230f90f95727f9fa92e8c73a9e93458b22103293120f9cb50fd72" +nextcloud_source_sha256="fad8e12632b352247ffc5ae181d4e414d732b9072caa0401774cfdb93a714329" # This function will only be executed upon applying the last upgrade referenced above last_upgrade_operations () { From f773b2879a423b0db73a83145a0c5587d190cd4a Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Tue, 28 Apr 2020 23:52:37 +0200 Subject: [PATCH 135/204] Update README.md Small typos And I removed the link to the doc as the same link is already line 29 --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 3f825dd..6e37910 100644 --- a/README.md +++ b/README.md @@ -33,12 +33,12 @@ you can synchronize your files over your devices. #### Configure OnlyOffice integration -Starting from Nextcloud 18, it features a direct integration of OnlyOffice (an online rich text document editor) thought a Nextcloud app. +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`), you need to configure its URL with `https://yourdomain.tld/nextcloud/index.php/apps/documentserver_community/` (an URL might be defined by default, but is not always correct). Keep others server parameters empty. Save it. -- You can also configure with file formats should be openned by OnlyOffice. +- You can also 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** (Raspberry Pi, …) is **not** supported* @@ -125,7 +125,6 @@ sudo yunohost app ssowatconf * Report a bug: https://github.com/YunoHost-Apps/nextcloud_ynh/issues * Nextcloud website: https://nextcloud.com/ - * Nextcloud documentation: https://docs.nextcloud.com/ * Nextcloud repository: https://github.com/nextcloud/server * YunoHost website: https://yunohost.org/ From a442cc41ebd53ccaaec02f6d21a1a4c26a8f4aae Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Wed, 29 Apr 2020 00:08:33 +0200 Subject: [PATCH 136/204] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6e37910..696e918 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ you can synchronize your files over your devices. ## Documentation * Official documentation: https://docs.nextcloud.com/server/18/user_manual/ - * YunoHost documentation: https://github.com/YunoHost/doc/blob/master/app_nextcloud_fr.md + * YunoHost documentation: https://github.com/YunoHost/doc/blob/master/app_nextcloud.md ## Configuration From 4c17d94ddf4ce991756948f2383ae63e6e08e2ae Mon Sep 17 00:00:00 2001 From: saimyx <44293594+Saimyx@users.noreply.github.com> Date: Wed, 29 Apr 2020 13:45:37 +0200 Subject: [PATCH 137/204] Create README_fr.md --- README_fr.md | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 README_fr.md diff --git a/README_fr.md b/README_fr.md new file mode 100644 index 0000000..a3a0f5e --- /dev/null +++ b/README_fr.md @@ -0,0 +1,119 @@ +# 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) +[![Install Nextcloud with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=nextcloud) + +*[Read this readme in english.](./README.md)* + + +> *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. + +**Version incluse :** 18.0.4 + +## Captures d'écran + +![](https://raw.githubusercontent.com/nextcloud/screenshots/master/files/Files%20Overview.png) + +## Démo + +* [Démo YunoHost](https://demo.yunohost.org/nextcloud/) +* [Démo officielle](https://demo.nextcloud.com/) + +## Configuration + +## Documentation + + * Documentation officielle : https://docs.nextcloud.com/server/18/user_manual/ + * Documentation YunoHost : https://github.com/YunoHost/doc/blob/master/app_nextcloud_fr.md + +## 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 le répertoire `/.well-known` pour la synchronisation CalDAV et CardDAV du domaine si aucun autre service ne l'utilise déjà - exemple, baikal + +#### Support multi-utilisateurs + +#### Architectures supportées + +* x86-64b - [![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. + +Donc notez que nous avons choisi de désactiver la applications de 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/') +``` + +## 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 !** + +//fin de trad ------------------------------------------------------------------------------------- + +This package handle 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 + + * 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). + +To try the testing branch, please proceed like that. +``` +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 +``` From 440fa10704533383ef8f885bd51720ea0b54926e Mon Sep 17 00:00:00 2001 From: saimyx <44293594+Saimyx@users.noreply.github.com> Date: Wed, 29 Apr 2020 14:31:08 +0200 Subject: [PATCH 138/204] Update README_fr.md --- README_fr.md | 44 ++++++++++++++++---------------------------- 1 file changed, 16 insertions(+), 28 deletions(-) diff --git a/README_fr.md b/README_fr.md index a3a0f5e..97798ac 100644 --- a/README_fr.md +++ b/README_fr.md @@ -68,30 +68,20 @@ Following symlinks is not allowed ('/home/yunohost.multimedia/user/Share' -> '/h **La migration n'est pas encore considérée comme stable, merci de la faire prudemment et uniquement pour tester !** -//fin de trad ------------------------------------------------------------------------------------- - -This package handle 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: +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 ``` -The `--debug` option will let you see the full output. If you encounter any -issue, please paste it. +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. -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: +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. +Nous espérons que Nextcloud sera installé après ça. +Notez que ça ne changera pas la 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 @@ -99,21 +89,19 @@ sudo yunohost app ssowatconf ## 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/ - + * Signaler un bug : https://github.com/YunoHost-Apps/nextcloud_ynh/issues + * Site web de Nextcloud : https://nextcloud.com/ + * Dpôt de Nextcloud : https://github.com/nextcloud/server + * Site web de YunoHost : https://yunohost.org/ + --- - -Developers infos +Informations pour les développeurs ---------------- -Please do 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. +Merci de faire votre « pull request » sur la [branche de test](https://github.com/YunoHost-Apps/nextcloud_ynh/tree/testing). +Pour tester la branche de test, faites comme ceci. ``` sudo yunohost app install https://github.com/YunoHost-Apps/nextcloud_ynh/tree/testing --debug -or +ou sudo yunohost app upgrade nextcloud -u https://github.com/YunoHost-Apps/nextcloud_ynh/tree/testing --debug ``` From 8a6d8fbe9df71259e35200cb97cadb8b4dfaa71b Mon Sep 17 00:00:00 2001 From: saimyx <44293594+Saimyx@users.noreply.github.com> Date: Wed, 29 Apr 2020 15:03:36 +0200 Subject: [PATCH 139/204] Update README_fr.md --- README_fr.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README_fr.md b/README_fr.md index 97798ac..34620dc 100644 --- a/README_fr.md +++ b/README_fr.md @@ -1,6 +1,6 @@ # 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'integration](https://dash.yunohost.org/integration/nextcloud.svg)](https://dash.yunohost.org/appci/app/nextcloud) [![Install Nextcloud with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=nextcloud) *[Read this readme in english.](./README.md)* From 0ac9fab4ed33bbcd7bfbfff391e7a90bba2b5b27 Mon Sep 17 00:00:00 2001 From: saimyx <44293594+Saimyx@users.noreply.github.com> Date: Wed, 29 Apr 2020 15:04:13 +0200 Subject: [PATCH 140/204] Update README_fr.md --- README_fr.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README_fr.md b/README_fr.md index 34620dc..faf7d7a 100644 --- a/README_fr.md +++ b/README_fr.md @@ -14,7 +14,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. Avec NextCloud vous pouvez synchroniser vos fichiers sur vos appareils. -**Version incluse :** 18.0.4 +**Version incluse :** 18.0.2 ## Captures d'écran From 651efbd63cf24f5fc2e39c62f32740d980a88233 Mon Sep 17 00:00:00 2001 From: saimyx <44293594+Saimyx@users.noreply.github.com> Date: Wed, 29 Apr 2020 15:05:50 +0200 Subject: [PATCH 141/204] Update README_fr.md --- README_fr.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README_fr.md b/README_fr.md index faf7d7a..fb7980a 100644 --- a/README_fr.md +++ b/README_fr.md @@ -40,7 +40,7 @@ En plus des fonctionnalités principales de Nextcloud, les fonctionnalités suiv * 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 le répertoire `/.well-known` pour la synchronisation CalDAV et CardDAV du domaine si aucun autre service ne l'utilise déjà - exemple, baikal + * Utilise le répertoire `/.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 From c0e4da8f1837c5584a991dd936066be7811a7f25 Mon Sep 17 00:00:00 2001 From: saimyx <44293594+Saimyx@users.noreply.github.com> Date: Wed, 29 Apr 2020 15:06:32 +0200 Subject: [PATCH 142/204] lien readme-fr --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index f0153fe..4c46132 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ [![Integration level](https://dash.yunohost.org/integration/nextcloud.svg)](https://dash.yunohost.org/appci/app/nextcloud) [![Install Nextcloud with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](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.* From 829645c30ee43607c038a4e81a033792f828586f Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Wed, 29 Apr 2020 16:01:28 +0200 Subject: [PATCH 143/204] Fix typo and phrasing --- README_fr.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/README_fr.md b/README_fr.md index fb7980a..4dba008 100644 --- a/README_fr.md +++ b/README_fr.md @@ -1,7 +1,7 @@ # Nextcloud pour YunoHost -[![Niveau d'integration](https://dash.yunohost.org/integration/nextcloud.svg)](https://dash.yunohost.org/appci/app/nextcloud) -[![Install Nextcloud with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=nextcloud) +[![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) +[![Installer Nextcloud avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=nextcloud) *[Read this readme in english.](./README.md)* @@ -14,7 +14,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. Avec NextCloud vous pouvez synchroniser vos fichiers sur vos appareils. -**Version incluse :** 18.0.2 +**Version incluse :** 18.0.4 ## Captures d'écran @@ -40,7 +40,7 @@ En plus des fonctionnalités principales de Nextcloud, les fonctionnalités suiv * 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 le répertoire `/.well-known` pour la synchronisation CalDAV et CardDAV du domaine si aucun autre service ne l'utilise déjà -par exemple, baikal + * 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 @@ -54,7 +54,7 @@ En plus des fonctionnalités principales de Nextcloud, les fonctionnalités suiv 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. -Donc notez que nous avons choisi de désactiver la applications de tierces-parties lors des mises à jour. Ça permet d'éviter une installation de Nextcloud instable - ou qui pourrait planter. +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 : @@ -79,9 +79,9 @@ sudo yunohost app upgrade -u https://github.com/YunoHost-Apps/nextcloud_ynh ownc 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. -Nous espérons que Nextcloud sera installé après ça. +Vous devriez constater que Nextcloud sera installé après ça. -Notez que ça ne changera pas la label ni l'URL. Pour renommer le label, vous pouvez exécuter la commande suivante (en remplaçant `Nextcloud` par ce que vous voulez) : +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 @@ -91,15 +91,15 @@ sudo yunohost app ssowatconf * Signaler un bug : https://github.com/YunoHost-Apps/nextcloud_ynh/issues * Site web de Nextcloud : https://nextcloud.com/ - * Dpôt de Nextcloud : https://github.com/nextcloud/server + * Dépôt de Nextcloud : https://github.com/nextcloud/server * Site web de YunoHost : https://yunohost.org/ --- Informations pour les développeurs ---------------- -Merci de faire votre « pull request » sur la [branche de test](https://github.com/YunoHost-Apps/nextcloud_ynh/tree/testing). -Pour tester la branche de test, faites comme ceci. +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. ``` sudo yunohost app install https://github.com/YunoHost-Apps/nextcloud_ynh/tree/testing --debug ou From 77fcef8ae71c17e4612a3f6b7fd9f2c8323ada79 Mon Sep 17 00:00:00 2001 From: lapineige Date: Wed, 29 Apr 2020 23:03:29 +0200 Subject: [PATCH 144/204] Documentation pour OnlyOffice Pour s'aligner avec https://github.com/YunoHost-Apps/nextcloud_ynh/pull/278 --- README_fr.md | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/README_fr.md b/README_fr.md index 4dba008..1adf19e 100644 --- a/README_fr.md +++ b/README_fr.md @@ -25,12 +25,24 @@ Avec NextCloud vous pouvez synchroniser vos fichiers sur vos appareils. * [Démo YunoHost](https://demo.yunohost.org/nextcloud/) * [Démo officielle](https://demo.nextcloud.com/) -## Configuration - ## Documentation * Documentation officielle : https://docs.nextcloud.com/server/18/user_manual/ * Documentation YunoHost : https://github.com/YunoHost/doc/blob/master/app_nextcloud_fr.md + +## Configuration + +#### Configurer l'intégration d'OnlyOffice + +À partir de sa version 18, Nextcloud intégre une intégration directe de OnlyOffice (un éditeur de texte enrichi en ligne) via une application Nextcloud. +Pour l'installer et le 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`), vous devez le configurer avec l'URL suivante `https://yourdomain.tld/nextcloud/index.php/apps/documentserver_community/` (une URL peut-être préremplie, mais elle n'est pas toujours correcte). Veuillez noter la présence de **`/index.php/`**. Laissez les autres paramètres vides. Sauvegardez. + - Vous pouvez aussi 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 - **ARM** (Raspberry Pi, …) n'est **pas** supporté* ## Caractéristiques spécifiques YunoHost From 490d27b1df66d1ee22e62925acf468c9f308ea1e Mon Sep 17 00:00:00 2001 From: lapineige Date: Wed, 29 Apr 2020 23:06:29 +0200 Subject: [PATCH 145/204] Make the URL change clearer --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 696e918..86ff788 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ Starting from Nextcloud 18, it features a direct integration of OnlyOffice (an o 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`), you need to configure its URL with `https://yourdomain.tld/nextcloud/index.php/apps/documentserver_community/` (an URL might be defined by default, but is not always correct). Keep others server parameters empty. Save it. +- Then in Settings -> OnlyOffice (`https://yourdomain.tld/nextcloud/settings/admin/onlyoffice`), you need to configure its URL with `https://yourdomain.tld/nextcloud/index.php/apps/documentserver_community/` (an URL might be defined by default, but is not always correct). Please note the **`/index.php/`**. Keep others server parameters empty. Save it. - You can also 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. From 307255b541e7c8d174da31e6f8a4399fecf5ee03 Mon Sep 17 00:00:00 2001 From: Kay0u Date: Mon, 4 May 2020 19:16:33 +0200 Subject: [PATCH 146/204] use only YNH_APP_INSTANCE_NAME --- scripts/actions/disable_maintenance | 2 +- scripts/config | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/actions/disable_maintenance b/scripts/actions/disable_maintenance index 0c2c8b2..0ea0edb 100755 --- a/scripts/actions/disable_maintenance +++ b/scripts/actions/disable_maintenance @@ -13,7 +13,7 @@ source /usr/share/yunohost/helpers # RETRIEVE ARGUMENTS #================================================= -app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID} +app=$YNH_APP_INSTANCE_NAME final_path=$(ynh_app_setting_get --app=$app --key=final_path) diff --git a/scripts/config b/scripts/config index b0314f0..d06b98b 100644 --- a/scripts/config +++ b/scripts/config @@ -14,7 +14,7 @@ source _ynh_add_fpm_config # RETRIEVE ARGUMENTS #================================================= -app=${YNH_APP_INSTANCE_NAME:-$YNH_APP_ID} +app=$YNH_APP_INSTANCE_NAME #================================================= # LOAD VALUES From fad0adfb5eee4991795f31ed9586ef9e21b532c5 Mon Sep 17 00:00:00 2001 From: Kay0u Date: Wed, 27 May 2020 14:10:13 +0200 Subject: [PATCH 147/204] Update nginx conf --- conf/nginx.conf | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index c4b73e1..4ddb371 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -69,15 +69,15 @@ location ^~ __PATH__/ { access_log off; } - location ~ ^__PATH__/(?:build|tests|config|lib|3rdparty|templates|data)/ { + location ~ ^\__PATH__\/(?:build|tests|config|lib|3rdparty|templates|data)\/ { deny all; } - location ~ ^__PATH__/(?:\.|autotest|occ|issue|indie|db_|console) { + location ~ ^\__PATH__\/(?:\.|autotest|occ|issue|indie|db_|console) { deny all; } - location ~ ^__PATH__/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|oc[ms]-provider/.+)\.php(/.*|)$ { - fastcgi_split_path_info ^(.+?\.php)(/.*|)$; + location ~ ^\__PATH__\/(?:index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+|.+\/richdocumentscode\/proxy)\.php(?:$|\/) { + fastcgi_split_path_info ^(.+?\.php)(\/.*|)$; set $path_info $fastcgi_path_info; try_files $fastcgi_script_name =404; include fastcgi_params; @@ -92,10 +92,9 @@ location ^~ __PATH__/ { fastcgi_pass unix:/var/run/php/php__YNH_PHP_VERSION__-fpm-__NAME__.sock; fastcgi_intercept_errors on; fastcgi_request_buffering off; - fastcgi_param REMOTE_USER $remote_user; } - location ~ ^__PATH__/(?:updater|oc[ms]-provider)(?:$|/) { + location ~ ^\__PATH__\/(?:updater|oc[ms]-provider)(?:$|\/) { try_files $uri/ =404; index index.php; } @@ -117,9 +116,8 @@ location ^~ __PATH__/ { } - - # Adding the cache control header for js and css files - location ~ \.(?:css|js|woff2?|svg|gif)$ { + # Adding the cache control header for js, css and map files + location ~ ^\__PATH__\/.+[^\/]\.(?:css|js|woff2?|svg|gif|map)$ { try_files $uri __PATH__/index.php$request_uri; more_set_headers "Cache-Control: public, max-age=15778463"; # Add headers to serve security related headers @@ -129,13 +127,14 @@ location ^~ __PATH__/ { more_set_headers "X-Robots-Tag: none"; more_set_headers "X-Download-Options: noopen"; more_set_headers "X-Permitted-Cross-Domain-Policies: none"; + more_set_headers "X-Frame-Options: SAMEORIGIN"; more_set_headers "Referrer-Policy: no-referrer"; # Optional: Don't log access to assets access_log off; } - location ~* \.(?:png|html|ttf|ico|jpg|jpeg|bcmap)$ { + location ~ ^\__PATH__\/.+[^\/]\.(?:png|html|ttf|ico|jpg|jpeg|bcmap)$ { try_files $uri __PATH__/index.php$request_uri; # Optional: Don't log access to other assets access_log off; From 63ef78d0364d7b8f06ec2daf7051a4f90b01c877 Mon Sep 17 00:00:00 2001 From: Kay0u Date: Wed, 27 May 2020 14:13:49 +0200 Subject: [PATCH 148/204] onlyoffice works without hack --- README.md | 3 +-- README_fr.md | 3 +-- conf/nginx.conf | 3 +++ 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 3c48bca..de17cac 100644 --- a/README.md +++ b/README.md @@ -38,8 +38,7 @@ Starting from Nextcloud 18, it features a direct integration of OnlyOffice (an o 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`), you need to configure its URL with `https://yourdomain.tld/nextcloud/index.php/apps/documentserver_community/` (an URL might be defined by default, but is not always correct). Please note the **`/index.php/`**. Keep others server parameters empty. Save it. -- You can also configure which file formats should be opened by OnlyOffice. +- 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** (Raspberry Pi, …) is **not** supported* diff --git a/README_fr.md b/README_fr.md index 1adf19e..a80bc2f 100644 --- a/README_fr.md +++ b/README_fr.md @@ -38,8 +38,7 @@ Avec NextCloud vous pouvez synchroniser vos fichiers sur vos appareils. Pour l'installer et le 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`), vous devez le configurer avec l'URL suivante `https://yourdomain.tld/nextcloud/index.php/apps/documentserver_community/` (une URL peut-être préremplie, mais elle n'est pas toujours correcte). Veuillez noter la présence de **`/index.php/`**. Laissez les autres paramètres vides. Sauvegardez. - - Vous pouvez aussi configurer quels formats de fichier s'ouvrent avec 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 - **ARM** (Raspberry Pi, …) n'est **pas** supporté* diff --git a/conf/nginx.conf b/conf/nginx.conf index 4ddb371..09cc770 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -115,6 +115,9 @@ location ^~ __PATH__/ { rewrite ^ __PATH__/index.php$request_uri; } + location ~* ^__PATH__/apps/documentserver_community/ { + rewrite ^ __PATH__/index.php$request_uri; + } # Adding the cache control header for js, css and map files location ~ ^\__PATH__\/.+[^\/]\.(?:css|js|woff2?|svg|gif|map)$ { From d3e8e5f0a76fbb15fa101117a3e018d9e403fcc1 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Mon, 8 Jun 2020 08:28:37 +0200 Subject: [PATCH 149/204] Upgrade to upstream version 18.0.5 --- README.md | 2 +- manifest.json | 2 +- scripts/upgrade.d/upgrade.last.sh | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 3c48bca..5e5162e 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ own data. A personal cloud which run on your own server. With Nextcloud you can synchronize your files over your devices. -**Shipped version:** 18.0.4 +**Shipped version:** 18.0.5 ## Screenshots diff --git a/manifest.json b/manifest.json index c3cc160..e196b2d 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Access & share your files, calendars, contacts, mail & more from any device, on your terms", "fr": "Consultez et partagez vos fichiers, agendas, carnets d'adresses, emails et bien plus depuis les appareils de votre choix, sous vos conditions" }, - "version": "18.0.4~ynh1", + "version": "18.0.5~ynh1", "url": "https://nextcloud.com", "license": "AGPL-3.0", "maintainer": { diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index 6a77d34..d4d6735 100755 --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -1,10 +1,10 @@ #!/bin/bash # Last available nextcloud version -next_version="18.0.4" +next_version="18.0.5" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="fad8e12632b352247ffc5ae181d4e414d732b9072caa0401774cfdb93a714329" +nextcloud_source_sha256="52182fcdc289061f981100f53ccd411c35a10b81d1b88a934af9668c8055d753" # This function will only be executed upon applying the last upgrade referenced above last_upgrade_operations () { From 3251079286e68987e5191aa6e01c1a47c74cc78d Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Sun, 14 Jun 2020 15:23:05 +0200 Subject: [PATCH 150/204] Upgrade to upstream version 19.0.0 --- README.md | 2 +- README_fr.md | 2 +- conf/nginx.conf | 4 ++-- manifest.json | 2 +- scripts/_common.sh | 2 +- scripts/upgrade.d/upgrade.18.sh | 7 +++++++ scripts/upgrade.d/upgrade.last.sh | 6 +++--- 7 files changed, 16 insertions(+), 9 deletions(-) create mode 100644 scripts/upgrade.d/upgrade.18.sh diff --git a/README.md b/README.md index 3c48bca..dd96415 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ own data. A personal cloud which run on your own server. With Nextcloud you can synchronize your files over your devices. -**Shipped version:** 18.0.4 +**Shipped version:** 19.0.0 ## Screenshots diff --git a/README_fr.md b/README_fr.md index 1adf19e..c849567 100644 --- a/README_fr.md +++ b/README_fr.md @@ -14,7 +14,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. Avec NextCloud vous pouvez synchroniser vos fichiers sur vos appareils. -**Version incluse :** 18.0.4 +**Version incluse :** 19.0.0 ## Captures d'écran diff --git a/conf/nginx.conf b/conf/nginx.conf index c4b73e1..6cfb6e6 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -76,7 +76,7 @@ location ^~ __PATH__/ { deny all; } - location ~ ^__PATH__/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|oc[ms]-provider/.+)\.php(/.*|)$ { + location ~ ^__PATH__/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|oc[ms]-provider/.+|.+\/richdocumentscode\/proxy)\.php(/.*|)$ { fastcgi_split_path_info ^(.+?\.php)(/.*|)$; set $path_info $fastcgi_path_info; try_files $fastcgi_script_name =404; @@ -135,7 +135,7 @@ location ^~ __PATH__/ { access_log off; } - location ~* \.(?:png|html|ttf|ico|jpg|jpeg|bcmap)$ { + location ~* \.(?:png|html|ttf|ico|jpg|jpeg|bcmap|mp4|webm)$ { try_files $uri __PATH__/index.php$request_uri; # Optional: Don't log access to other assets access_log off; diff --git a/manifest.json b/manifest.json index c3cc160..1daa850 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Access & share your files, calendars, contacts, mail & more from any device, on your terms", "fr": "Consultez et partagez vos fichiers, agendas, carnets d'adresses, emails et bien plus depuis les appareils de votre choix, sous vos conditions" }, - "version": "18.0.4~ynh1", + "version": "19.0.0~ynh1", "url": "https://nextcloud.com", "license": "AGPL-3.0", "maintainer": { diff --git a/scripts/_common.sh b/scripts/_common.sh index 7b84705..5bf88c4 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -6,7 +6,7 @@ pkg_dependencies="imagemagick acl tar smbclient at" YNH_PHP_VERSION="7.3" -extra_pkg_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" +extra_pkg_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" #================================================= # EXPERIMENTAL HELPERS diff --git a/scripts/upgrade.d/upgrade.18.sh b/scripts/upgrade.d/upgrade.18.sh new file mode 100644 index 0000000..e43bb76 --- /dev/null +++ b/scripts/upgrade.d/upgrade.18.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +# Last available nextcloud version +next_version="19.0.0" + +# Nextcloud tarball checksum sha256 +nextcloud_source_sha256="d23d429657c5e3476d7e73af1eafc70e42a81cfe2ed65b20655a005724fe0aae" diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index 6a77d34..0c5e33c 100755 --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -1,10 +1,10 @@ #!/bin/bash # Last available nextcloud version -next_version="18.0.4" +next_version="19.0.0" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="fad8e12632b352247ffc5ae181d4e414d732b9072caa0401774cfdb93a714329" +nextcloud_source_sha256="d23d429657c5e3476d7e73af1eafc70e42a81cfe2ed65b20655a005724fe0aae" # This function will only be executed upon applying the last upgrade referenced above last_upgrade_operations () { @@ -12,5 +12,5 @@ last_upgrade_operations () { cp -a ../sources/patches_last_version/* ../sources/patches # Execute post-upgrade operations later on - (cd /tmp ; at now + 10 minutes <<< "(cd $final_path ; sudo -u $app php${YNH_PHP_VERSION} occ db:add-missing-indices ; sudo -u $app php${YNH_PHP_VERSION} occ db:convert-filecache-bigint -n) > /tmp/${app}_maintenance.log") + (cd /tmp ; at now + 10 minutes <<< "(cd $final_path ; sudo -u $app php${YNH_PHP_VERSION} occ db:add-missing-indices ; sudo -u $app php${YNH_PHP_VERSION} occ db:add-missing-columns ; sudo -u $app php${YNH_PHP_VERSION} occ db:convert-filecache-bigint -n) > /tmp/${app}_maintenance.log") } From ad4ea9d6e77c026d2036c7c393c2603135aa56b3 Mon Sep 17 00:00:00 2001 From: Jimmy Monin Date: Sun, 14 Jun 2020 15:23:34 +0200 Subject: [PATCH 151/204] Fix upgrade for first major versions --- scripts/upgrade | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 5d832b6..8054652 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -247,17 +247,19 @@ then major_version=${last_version%%.*} current_major_version=${current_version%%.*} + # Load the value for this version + source upgrade.d/upgrade.$current_major_version.sh + # If the current version has the same major version than the next one, # then it's the last upgrade to do - if [ "$major_version" -eq "$current_major_version" ]; then + # We also cover the case where the last version is the first of the current major version series + # (e.g. 19.0.0 is the latest version) + if [[ ("$major_version" -eq "$current_major_version") || ( ("$major_version" -eq "$((current_major_version+1))") && ("$next_version" == "$last_version") ) ]]; then current_major_version=last # Execute the commands dedicated to the last upgrade last_upgrade_operations fi - # Load the value for this version - source upgrade.d/upgrade.$current_major_version.sh - ynh_print_info --message="Upgrade to nextcloud $next_version" # Create an app.src for this version of nextcloud From 8d1bb6046bbee91cd0ef3011ae675202e2519e96 Mon Sep 17 00:00:00 2001 From: Kayou Date: Fri, 19 Jun 2020 10:54:14 +0200 Subject: [PATCH 152/204] Fix backward compatibility --- scripts/upgrade | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index e14cd53..7800a53 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -197,11 +197,11 @@ fi # Define a function to execute commands with `occ` exec_occ() { # Backward compatibility to upgrade from NC14 or older version - if [ $current_major_version -lt 15 ] + if [ $current_major_version = "last" ] || [ $current_major_version -ge 15 ] then - NEXTCLOUD_PHP_VERSION="7.0" - else NEXTCLOUD_PHP_VERSION=$YNH_PHP_VERSION + else + NEXTCLOUD_PHP_VERSION="7.0" fi (cd "$final_path" && exec_as "$app" \ php$NEXTCLOUD_PHP_VERSION occ --no-interaction --no-ansi "$@") From 77386abeba1129a664b3605be5eab6fd2b245b9c Mon Sep 17 00:00:00 2001 From: Kay0u Date: Mon, 22 Jun 2020 10:33:40 +0200 Subject: [PATCH 153/204] fix nginx on root install --- conf/nginx.conf | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 09cc770..d46418a 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -69,14 +69,14 @@ location ^~ __PATH__/ { access_log off; } - location ~ ^\__PATH__\/(?:build|tests|config|lib|3rdparty|templates|data)\/ { + location ~ ^__PATH__/(?:build|tests|config|lib|3rdparty|templates|data)\/ { deny all; } - location ~ ^\__PATH__\/(?:\.|autotest|occ|issue|indie|db_|console) { + location ~ ^__PATH__/(?:\.|autotest|occ|issue|indie|db_|console) { deny all; } - location ~ ^\__PATH__\/(?:index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+|.+\/richdocumentscode\/proxy)\.php(?:$|\/) { + location ~ ^__PATH__/(?:index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+|.+\/richdocumentscode\/proxy)\.php(?:$|\/) { fastcgi_split_path_info ^(.+?\.php)(\/.*|)$; set $path_info $fastcgi_path_info; try_files $fastcgi_script_name =404; @@ -94,7 +94,7 @@ location ^~ __PATH__/ { fastcgi_request_buffering off; } - location ~ ^\__PATH__\/(?:updater|oc[ms]-provider)(?:$|\/) { + location ~ ^__PATH__/(?:updater|oc[ms]-provider)(?:$|\/) { try_files $uri/ =404; index index.php; } @@ -120,7 +120,7 @@ location ^~ __PATH__/ { } # Adding the cache control header for js, css and map files - location ~ ^\__PATH__\/.+[^\/]\.(?:css|js|woff2?|svg|gif|map)$ { + location ~ ^__PATH__/.+[^\/]\.(?:css|js|woff2?|svg|gif|map)$ { try_files $uri __PATH__/index.php$request_uri; more_set_headers "Cache-Control: public, max-age=15778463"; # Add headers to serve security related headers @@ -137,7 +137,7 @@ location ^~ __PATH__/ { access_log off; } - location ~ ^\__PATH__\/.+[^\/]\.(?:png|html|ttf|ico|jpg|jpeg|bcmap)$ { + location ~ ^__PATH__/.+[^\/]\.(?:png|html|ttf|ico|jpg|jpeg|bcmap)$ { try_files $uri __PATH__/index.php$request_uri; # Optional: Don't log access to other assets access_log off; From 5cc1c57ddd04ab6659690b0d72dc61f137bc7221 Mon Sep 17 00:00:00 2001 From: Kay0u Date: Wed, 8 Jul 2020 10:59:54 +0200 Subject: [PATCH 154/204] fix var name --- scripts/_common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index bcaf40b..2b9a766 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -6,7 +6,7 @@ pkg_dependencies="imagemagick acl tar smbclient at" YNH_PHP_VERSION="7.3" -extra_pkg_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" +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" #================================================= # EXPERIMENTAL HELPERS From bc1fe2ff26977cca5a896baacaf8e393d46190b9 Mon Sep 17 00:00:00 2001 From: SirFerdek <17548441+SirFerdek@users.noreply.github.com> Date: Fri, 17 Jul 2020 22:18:45 +0200 Subject: [PATCH 155/204] Fix "spinning wheel" when no README.md file in folder. The rich workspace dialouge loads by default in every folder. When user deletes README.md file, Nextcloud responds with 404 http code to inform the UI scipts to not render the rich workspace. Overwriting the response with custom 404 status page creates "spinning wheel" UI bug in every folder without README.md file in it. Fixes #318 --- conf/nginx.conf | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index d46418a..dfe42e3 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -57,7 +57,9 @@ location ^~ __PATH__/ { # Errors pages error_page 403 __PATH__/core/templates/403.php; - error_page 404 __PATH__/core/templates/404.php; + # Don't set custom 404 error page, as nextcloud uses 404 codes with meaningful payload. + # Setting custom 404 page clears the payload and creates UI bugs + # error_page 404 __PATH__/core/templates/404.php; location __PATH__/ { rewrite ^ __PATH__/index.php; From 1b910c20d6fbf84f145b73ff7c94d20d4448fe3f Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 20 Jul 2020 17:27:27 +0200 Subject: [PATCH 156/204] Upgrade to 18.0.7 --- README.md | 2 +- README_fr.md | 2 +- manifest.json | 2 +- scripts/upgrade.d/upgrade.last.sh | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 345c00e..7306522 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ own data. A personal cloud which run on your own server. With Nextcloud you can synchronize your files over your devices. -**Shipped version:** 18.0.5 +**Shipped version:** 18.0.7 ## Screenshots diff --git a/README_fr.md b/README_fr.md index a80bc2f..dced3aa 100644 --- a/README_fr.md +++ b/README_fr.md @@ -14,7 +14,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. Avec NextCloud vous pouvez synchroniser vos fichiers sur vos appareils. -**Version incluse :** 18.0.4 +**Version incluse :** 18.0.7 ## Captures d'écran diff --git a/manifest.json b/manifest.json index cfefefd..31bbafd 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Access & share your files, calendars, contacts, mail & more from any device, on your terms", "fr": "Consultez et partagez vos fichiers, agendas, carnets d'adresses, emails et bien plus depuis les appareils de votre choix, sous vos conditions" }, - "version": "18.0.5~ynh1", + "version": "18.0.7~ynh1", "url": "https://nextcloud.com", "license": "AGPL-3.0", "maintainer": { diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index d4d6735..c6cf27a 100755 --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -1,10 +1,10 @@ #!/bin/bash # Last available nextcloud version -next_version="18.0.5" +next_version="18.0.7" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="52182fcdc289061f981100f53ccd411c35a10b81d1b88a934af9668c8055d753" +nextcloud_source_sha256="4b2cc7475d925faf9ce6c655d290cbbee8c02a40aaf0628d3d41b7ccd8416a5e" # This function will only be executed upon applying the last upgrade referenced above last_upgrade_operations () { From bf9ab43dd26556818105c198960a90316b8bc106 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 23 Jul 2020 13:35:17 +0200 Subject: [PATCH 157/204] Update README_fr.md (#315) * Update README_fr.md * Update README_fr.md --- README_fr.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/README_fr.md b/README_fr.md index a80bc2f..ce80774 100644 --- a/README_fr.md +++ b/README_fr.md @@ -6,7 +6,7 @@ *[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 @@ -14,7 +14,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. Avec NextCloud vous pouvez synchroniser vos fichiers sur vos appareils. -**Version incluse :** 18.0.4 +**Version incluse :** 18.0.5 ## Captures d'écran @@ -35,13 +35,13 @@ Avec NextCloud vous pouvez synchroniser vos fichiers sur vos appareils. #### Configurer l'intégration d'OnlyOffice À partir de sa version 18, Nextcloud intégre une intégration directe de OnlyOffice (un éditeur de texte enrichi en ligne) via une application Nextcloud. -Pour l'installer et le configurer: +Pour l'installer et le 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 - **ARM** (Raspberry Pi, …) n'est **pas** supporté* + *NB : OnlyOffice n'est disponible que sous architecture x86 - **ARM** (Raspberry Pi, …) n'est **pas** supporté* ## Caractéristiques spécifiques YunoHost @@ -57,7 +57,7 @@ En plus des fonctionnalités principales de Nextcloud, les fonctionnalités suiv #### Architectures supportées -* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/nextcloud%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/nextcloud/) +* 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 @@ -106,6 +106,7 @@ sudo yunohost app ssowatconf * Site web de YunoHost : https://yunohost.org/ --- + Informations pour les développeurs ---------------- From 5626cf402315ab9fbc348ab9f44d1e9b702d6840 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 27 Jul 2020 09:07:33 +0200 Subject: [PATCH 158/204] Update README.md - *Typos* --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 345c00e..0dd94ad 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to ## Overview [Nextcloud](https://nextcloud.com) gives you freedom and control over your -own data. A personal cloud which run on your own server. With Nextcloud +own data. A personal cloud which runs on your own server. With Nextcloud you can synchronize your files over your devices. @@ -48,19 +48,19 @@ To install and configure it: In addition to Nextcloud core features, the following are made available with this package: - * Integrate with YunoHost users and SSO - i.e logout button + * 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 + not already served - i.e. by Baïkal #### Multi-users support #### Supported architectures -* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/nextcloud%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/nextcloud/) +* 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 @@ -94,7 +94,7 @@ If you need/want to use Nextcloud `occ` command¹, you need to be in `/var/www/n **This is not considered as stable yet, please do it with care and only for testing!** -This package handle the migration from ownCloud to Nextcloud. For that, your +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. From 3bbb080e94aaac81d3364634c9e851320457634b Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 12 Aug 2020 20:44:55 +0200 Subject: [PATCH 159/204] upgrade to 19.0.1 --- README.md | 2 +- README_fr.md | 2 +- manifest.json | 2 +- scripts/upgrade.d/upgrade.last.sh | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a735d2c..418b450 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ own data. A personal cloud which runs on your own server. With Nextcloud you can synchronize your files over your devices. -**Shipped version:** 18.0.7 +**Shipped version:** 19.0.1 ## Screenshots diff --git a/README_fr.md b/README_fr.md index ada1a91..4b76836 100644 --- a/README_fr.md +++ b/README_fr.md @@ -14,7 +14,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. Avec NextCloud vous pouvez synchroniser vos fichiers sur vos appareils. -**Version incluse :** 18.0.7 +**Version incluse :** 19.0.1 ## Captures d'écran diff --git a/manifest.json b/manifest.json index 31bbafd..7320cfd 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Access & share your files, calendars, contacts, mail & more from any device, on your terms", "fr": "Consultez et partagez vos fichiers, agendas, carnets d'adresses, emails et bien plus depuis les appareils de votre choix, sous vos conditions" }, - "version": "18.0.7~ynh1", + "version": "19.0.1~ynh1", "url": "https://nextcloud.com", "license": "AGPL-3.0", "maintainer": { diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index c6cf27a..fecdbdd 100755 --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -1,10 +1,10 @@ #!/bin/bash # Last available nextcloud version -next_version="18.0.7" +next_version="19.0.1" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="4b2cc7475d925faf9ce6c655d290cbbee8c02a40aaf0628d3d41b7ccd8416a5e" +nextcloud_source_sha256="4ef311e00d939915d3a9714cd3a1ad436db9157e04620e4a88c2f427e5e65b2d" # This function will only be executed upon applying the last upgrade referenced above last_upgrade_operations () { From 03f2641bb95c4037df3cfaeba2e05094c2795d58 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 12 Aug 2020 20:46:51 +0200 Subject: [PATCH 160/204] Create upgrade.18.sh --- scripts/upgrade.d/upgrade.18.sh | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 scripts/upgrade.d/upgrade.18.sh diff --git a/scripts/upgrade.d/upgrade.18.sh b/scripts/upgrade.d/upgrade.18.sh new file mode 100644 index 0000000..e43bb76 --- /dev/null +++ b/scripts/upgrade.d/upgrade.18.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +# Last available nextcloud version +next_version="19.0.0" + +# Nextcloud tarball checksum sha256 +nextcloud_source_sha256="d23d429657c5e3476d7e73af1eafc70e42a81cfe2ed65b20655a005724fe0aae" From 41dee40b09dc69f71a0b200a7ecaeb1b0fb4d715 Mon Sep 17 00:00:00 2001 From: Kay0u Date: Fri, 14 Aug 2020 12:01:51 +0200 Subject: [PATCH 161/204] Add action add_multimedia_directories --- actions.toml | 9 ++++ scripts/actions/add_multimedia_directories | 58 ++++++++++++++++++++++ scripts/upgrade | 14 ------ 3 files changed, 67 insertions(+), 14 deletions(-) create mode 100755 scripts/actions/add_multimedia_directories diff --git a/actions.toml b/actions.toml index 38c52a8..fc6cb0f 100644 --- a/actions.toml +++ b/actions.toml @@ -6,3 +6,12 @@ command = "/bin/bash scripts/actions/disable_maintenance" # accepted_return_codes = [0, 1, 2, 3] # optional accepted_return_codes = [0] description = "Disable the maintenance mode of Nextcloud if you're stuck after an upgrade" + +[add_multimedia_directories] +name = "Add multimedia directories" +command = "/bin/bash scripts/actions/add_multimedia_directories" +# user = "root" # optional +# cwd = "/" # optional +# accepted_return_codes = [0, 1, 2, 3] # optional +accepted_return_codes = [0] +description = "Add the multimedia and shared multimedia directories again" diff --git a/scripts/actions/add_multimedia_directories b/scripts/actions/add_multimedia_directories new file mode 100755 index 0000000..2f34980 --- /dev/null +++ b/scripts/actions/add_multimedia_directories @@ -0,0 +1,58 @@ +#!/bin/bash + +#================================================= +# GENERIC STARTING +#================================================= +# IMPORT GENERIC HELPERS +#================================================= + +source scripts/_common.sh +source /usr/share/yunohost/helpers + +#================================================= +# RETRIEVE ARGUMENTS +#================================================= + +app=$YNH_APP_INSTANCE_NAME + +#================================================= +# CHECK IF ARGUMENTS ARE CORRECT +#================================================= + +#================================================= +# DEFINE FUNCTION +#================================================= + +# Define a function to add an external storage +# Create the external storage for the given folders and enable sharing +create_external_storage() { +local datadir="$1" +local mount_name="$2" +local mount_id=`exec_occ files_external:create --output=json \ + "$mount_name" 'local' 'null::null' -c "datadir=$datadir" || true` +! [[ $mount_id =~ ^[0-9]+$ ]] \ + && ynh_print_warn --message="Unable to create external storage" \ + || exec_occ files_external:option "$mount_id" enable_sharing true +} + +#================================================= +# SPECIFIC ACTION +#================================================= +# YUNOHOST MULTIMEDIA INTEGRATION +#================================================= +ynh_script_progression --message="Updating multimedia directories..." --weight=6 + +# Build YunoHost multimedia directories +ynh_multimedia_build_main_dir +# Mount the user directory in Nextcloud +exec_occ app:enable files_external +create_external_storage "/home/yunohost.multimedia/\$user" "Multimedia" +create_external_storage "/home/yunohost.multimedia/share" "Shared multimedia" +# Allow nextcloud to write into these directories +ynh_multimedia_addaccess $app + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_script_progression --message="Execution completed" --last diff --git a/scripts/upgrade b/scripts/upgrade index 7800a53..b1accbe 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -401,20 +401,6 @@ exec_occ background:cron # Set system group in hooks ynh_replace_string --match_string="__GROUP__" --replace_string="$app" --target_file=../hooks/post_user_create -#================================================= -# YUNOHOST MULTIMEDIA INTEGRATION -#================================================= -ynh_script_progression --message="Updating multimedia directories..." --weight=6 - -# Build YunoHost multimedia directories -ynh_multimedia_build_main_dir -# Mount the user directory in Nextcloud -exec_occ app:enable files_external -create_external_storage "/home/yunohost.multimedia/\$user" "Multimedia" -create_external_storage "/home/yunohost.multimedia/share" "Shared multimedia" -# Allow nextcloud to write into these directories -ynh_multimedia_addaccess $app - #================================================= # GENERIC FINALIZATION #================================================= From 38b66a8530010f83a42cce22ce74066f5c693a63 Mon Sep 17 00:00:00 2001 From: Kay0u Date: Fri, 14 Aug 2020 13:11:14 +0200 Subject: [PATCH 162/204] fix action --- scripts/actions/add_multimedia_directories | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/actions/add_multimedia_directories b/scripts/actions/add_multimedia_directories index 2f34980..4dc7881 100755 --- a/scripts/actions/add_multimedia_directories +++ b/scripts/actions/add_multimedia_directories @@ -15,6 +15,8 @@ source /usr/share/yunohost/helpers app=$YNH_APP_INSTANCE_NAME +final_path=$(ynh_app_setting_get --app=$app --key=final_path) + #================================================= # CHECK IF ARGUMENTS ARE CORRECT #================================================= @@ -23,6 +25,12 @@ app=$YNH_APP_INSTANCE_NAME # DEFINE FUNCTION #================================================= +# 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 "$@") +} + # Define a function to add an external storage # Create the external storage for the given folders and enable sharing create_external_storage() { From 74f3112feaa4ca0778d2532000d04f77eca9c455 Mon Sep 17 00:00:00 2001 From: Kay0u Date: Mon, 17 Aug 2020 17:07:34 +0200 Subject: [PATCH 163/204] fix upgrade --- scripts/install | 7 ++++++- scripts/upgrade | 27 ++++++++++++++++----------- scripts/upgrade.d/upgrade.last.sh | 9 --------- 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/scripts/install b/scripts/install index db96c16..6eb8471 100755 --- a/scripts/install +++ b/scripts/install @@ -273,7 +273,12 @@ exec_occ background:cron # POST-INSTALL MAINTENANCE #================================================= -(cd /tmp ; at now + 10 minutes <<< "(cd $final_path ; sudo -u $app php${YNH_PHP_VERSION} occ db:add-missing-indices ; sudo -u $app php${YNH_PHP_VERSION} occ db:convert-filecache-bigint -n) > /tmp/${app}_maintenance.log") +( + cd $final_path + sudo -u $app php${YNH_PHP_VERSION} occ db:add-missing-indices + sudo -u $app php${YNH_PHP_VERSION} occ db:add-missing-columns + sudo -u $app php${YNH_PHP_VERSION} occ db:convert-filecache-bigint -n +) #================================================= # CONFIGURE THE HOOK FILE FOR USER CREATE diff --git a/scripts/upgrade b/scripts/upgrade index a6a467b..b793386 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -229,6 +229,8 @@ then source upgrade.d/upgrade.last.sh last_version=$next_version + last_major_version=${last_version%%.*} + # Set write access for the following commands chown -R $app: "$final_path" "$datadir" @@ -240,23 +242,19 @@ then do # The major version is the first part of the version number - # major_version=${next_version%%.*} - major_version=${last_version%%.*} current_major_version=${current_version%%.*} - # Load the value for this version - source upgrade.d/upgrade.$current_major_version.sh - # If the current version has the same major version than the next one, # then it's the last upgrade to do - # We also cover the case where the last version is the first of the current major version series - # (e.g. 19.0.0 is the latest version) - if [[ ("$major_version" -eq "$current_major_version") || ( ("$major_version" -eq "$((current_major_version+1))") && ("$next_version" == "$last_version") ) ]]; then - current_major_version=last - # Execute the commands dedicated to the last upgrade - last_upgrade_operations + if [ "$last_major_version" -eq "$current_major_version" ]; then + current_major_version=last + # Enable YunoHost patches on Nextcloud sources + cp -a ../sources/patches_last_version/* ../sources/patches fi + # Load the value for this version + source upgrade.d/upgrade.$current_major_version.sh + ynh_print_info --message="Upgrade to nextcloud $next_version" # Create an app.src for this version of nextcloud @@ -311,6 +309,13 @@ then exec_occ -V done + ( + cd $final_path + sudo -u $app php${YNH_PHP_VERSION} occ db:add-missing-indices + sudo -u $app php${YNH_PHP_VERSION} occ db:add-missing-columns + sudo -u $app php${YNH_PHP_VERSION} occ db:convert-filecache-bigint -n + ) + #================================================= # CONFIGURE NEXTCLOUD #================================================= diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index 312ae98..2e73d3d 100755 --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -5,12 +5,3 @@ next_version="19.0.1" # Nextcloud tarball checksum sha256 nextcloud_source_sha256="4ef311e00d939915d3a9714cd3a1ad436db9157e04620e4a88c2f427e5e65b2d" - -# This function will only be executed upon applying the last upgrade referenced above -last_upgrade_operations () { - # Patch nextcloud files only for the last version - cp -a ../sources/patches_last_version/* ../sources/patches - - # Execute post-upgrade operations later on - (cd /tmp ; at now + 10 minutes <<< "(cd $final_path ; sudo -u $app php${YNH_PHP_VERSION} occ db:add-missing-indices ; sudo -u $app php${YNH_PHP_VERSION} occ db:add-missing-columns ; sudo -u $app php${YNH_PHP_VERSION} occ db:convert-filecache-bigint -n) > /tmp/${app}_maintenance.log") -} From fa00d46c04f8d78a1af0de23a76650bbf39e4ad2 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 26 Aug 2020 23:24:09 +0200 Subject: [PATCH 164/204] upgrade to v.19.0.2 --- README.md | 2 +- README_fr.md | 2 +- manifest.json | 2 +- scripts/upgrade.d/upgrade.last.sh | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 418b450..d4edc7b 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ own data. A personal cloud which runs on your own server. With Nextcloud you can synchronize your files over your devices. -**Shipped version:** 19.0.1 +**Shipped version:** 19.0.2 ## Screenshots diff --git a/README_fr.md b/README_fr.md index 4b76836..945d76c 100644 --- a/README_fr.md +++ b/README_fr.md @@ -14,7 +14,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. Avec NextCloud vous pouvez synchroniser vos fichiers sur vos appareils. -**Version incluse :** 19.0.1 +**Version incluse :** 19.0.2 ## Captures d'écran diff --git a/manifest.json b/manifest.json index 7320cfd..d9f1c08 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Access & share your files, calendars, contacts, mail & more from any device, on your terms", "fr": "Consultez et partagez vos fichiers, agendas, carnets d'adresses, emails et bien plus depuis les appareils de votre choix, sous vos conditions" }, - "version": "19.0.1~ynh1", + "version": "19.0.2~ynh1", "url": "https://nextcloud.com", "license": "AGPL-3.0", "maintainer": { diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index 2e73d3d..cf10d7c 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="19.0.1" +next_version="19.0.2" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="4ef311e00d939915d3a9714cd3a1ad436db9157e04620e4a88c2f427e5e65b2d" +nextcloud_source_sha256="e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" From 1591235c2e6e11ea28fa8bfae4b6f4c18ea633fc Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 26 Aug 2020 23:57:53 +0200 Subject: [PATCH 165/204] Update upgrade.last.sh --- scripts/upgrade.d/upgrade.last.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index cf10d7c..0d733b9 100755 --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -4,4 +4,4 @@ next_version="19.0.2" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" +nextcloud_source_sha256="8152f385fdb0645114e0043aaf07b0de046fbaf205fa6d6bf530d22db86c66a5" From caf092aa0c0d98da60b78317e879baf885f77cdf Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 2 Sep 2020 08:56:33 +0200 Subject: [PATCH 166/204] Update doc version URL --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d4edc7b..9a3dd85 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ you can synchronize your files over your devices. ## Documentation - * Official documentation: https://docs.nextcloud.com/server/18/user_manual/ + * Official documentation: https://docs.nextcloud.com/server/19/user_manual/ * YunoHost documentation: https://github.com/YunoHost/doc/blob/master/app_nextcloud.md ## Configuration diff --git a/README_fr.md b/README_fr.md index 945d76c..9741bb9 100644 --- a/README_fr.md +++ b/README_fr.md @@ -27,7 +27,7 @@ Avec NextCloud vous pouvez synchroniser vos fichiers sur vos appareils. ## Documentation - * Documentation officielle : https://docs.nextcloud.com/server/18/user_manual/ + * Documentation officielle : https://docs.nextcloud.com/server/19/user_manual/ * Documentation YunoHost : https://github.com/YunoHost/doc/blob/master/app_nextcloud_fr.md ## Configuration From 895f9951b2ad8c7e17ea2d67ba572d0dca41443c Mon Sep 17 00:00:00 2001 From: Kay0u Date: Mon, 7 Sep 2020 17:52:07 +0200 Subject: [PATCH 167/204] fix nginx conf --- conf/nginx.conf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index af8ce3e..0cf3732 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -78,8 +78,8 @@ location ^~ __PATH__/ { deny all; } - location ~ ^__PATH__/(?:index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+|.+\/richdocumentscode\/proxy)\.php(\/.*|)$ { - fastcgi_split_path_info ^(.+?\.php)(/.*|)$; + location ~ ^__PATH__/(?:index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+|.+\/richdocumentscode\/proxy)\.php(?:$|\/) { + fastcgi_split_path_info ^(.+?\.php)(\/.*|)$; set $path_info $fastcgi_path_info; try_files $fastcgi_script_name =404; include fastcgi_params; @@ -139,7 +139,7 @@ location ^~ __PATH__/ { access_log off; } - location ~* \.(?:png|html|ttf|ico|jpg|jpeg|bcmap|mp4|webm)$ { + location ~ ^__PATH__/.+[^\/]\.(?:png|html|ttf|ico|jpg|jpeg|bcmap|mp4|webm)$ { try_files $uri __PATH__/index.php$request_uri; # Optional: Don't log access to other assets access_log off; From 70207544ab195121d041c63e24192082abc939c5 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 9 Sep 2020 22:28:49 +0200 Subject: [PATCH 168/204] Upgrade to 19.0.3 --- README.md | 2 +- README_fr.md | 2 +- manifest.json | 2 +- scripts/upgrade.d/upgrade.last.sh | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 9a3dd85..b4b939b 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ own data. A personal cloud which runs on your own server. With Nextcloud you can synchronize your files over your devices. -**Shipped version:** 19.0.2 +**Shipped version:** 19.0.3 ## Screenshots diff --git a/README_fr.md b/README_fr.md index 9741bb9..404ef69 100644 --- a/README_fr.md +++ b/README_fr.md @@ -14,7 +14,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. Avec NextCloud vous pouvez synchroniser vos fichiers sur vos appareils. -**Version incluse :** 19.0.2 +**Version incluse :** 19.0.3 ## Captures d'écran diff --git a/manifest.json b/manifest.json index d9f1c08..75aa560 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Access & share your files, calendars, contacts, mail & more from any device, on your terms", "fr": "Consultez et partagez vos fichiers, agendas, carnets d'adresses, emails et bien plus depuis les appareils de votre choix, sous vos conditions" }, - "version": "19.0.2~ynh1", + "version": "19.0.3~ynh1", "url": "https://nextcloud.com", "license": "AGPL-3.0", "maintainer": { diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index 0d733b9..569c56e 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="19.0.2" +next_version="19.0.3" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="8152f385fdb0645114e0043aaf07b0de046fbaf205fa6d6bf530d22db86c66a5" +nextcloud_source_sha256="fc503985e8aa4ed795d882e35679e0e1b7670181768e7820307222d8b4658969" From 1ff40ff3d1b2ddc3dd9c5238a852d30c95fa98f7 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 9 Sep 2020 23:11:58 +0200 Subject: [PATCH 169/204] Update check_process --- check_process | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/check_process b/check_process index afc9dec..2d53163 100644 --- a/check_process +++ b/check_process @@ -12,7 +12,7 @@ setup_private=0 setup_public=0 upgrade=1 - upgrade=1 from_commit=9c57c2f78f3da979d587d708eb9379ffaa41bcfa + upgrade=1 from_commit=af36640ee5a5f1fab69651d638d23ebe47198152 backup_restore=1 multi_instance=1 incorrect_path=1 @@ -24,6 +24,6 @@ Email= Notification=none ;;; Upgrade options - ; commit=9c57c2f78f3da979d587d708eb9379ffaa41bcfa - name=Do not use too much process for php (#247) + ; commit=af36640ee5a5f1fab69651d638d23ebe47198152 + name=Merge pull request #320 enh-upgrade-18.0.7 manifest_arg=domain=DOMAIN&path=PATH&admin=USER&user_home=1& From 998215834e44fb0a4dc2ddd5e573c97dd10fb80e Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 10 Sep 2020 08:25:25 +0200 Subject: [PATCH 170/204] Update check_process --- check_process | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/check_process b/check_process index 2d53163..0ee0bab 100644 --- a/check_process +++ b/check_process @@ -12,7 +12,7 @@ setup_private=0 setup_public=0 upgrade=1 - upgrade=1 from_commit=af36640ee5a5f1fab69651d638d23ebe47198152 + upgrade=1 from_commit=c864e086625363d91dde6ba78a652011a991a027 backup_restore=1 multi_instance=1 incorrect_path=1 @@ -24,6 +24,6 @@ Email= Notification=none ;;; Upgrade options - ; commit=af36640ee5a5f1fab69651d638d23ebe47198152 - name=Merge pull request #320 enh-upgrade-18.0.7 + ; commit=c864e086625363d91dde6ba78a652011a991a027 + name=[fix] php7.2-mcrypt doesn't exist (#253) manifest_arg=domain=DOMAIN&path=PATH&admin=USER&user_home=1& From a31385b6b64920e1df6d2176da2898f02f1f88e2 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 13 Sep 2020 12:32:26 +0200 Subject: [PATCH 171/204] Update backup --- scripts/backup | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/scripts/backup b/scripts/backup index 68ae4ee..bb92dda 100755 --- a/scripts/backup +++ b/scripts/backup @@ -19,7 +19,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." +ynh_print_info --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -28,32 +28,32 @@ domain=$(ynh_app_setting_get --app=$app --key=domain) db_name=$(ynh_app_setting_get --app=$app --key=db_name) #================================================= -# STANDARD BACKUP STEPS +# DECLARE DATA AND CONF FILES TO BACKUP +#================================================= +ynh_print_info --message="Declaring files to be backed up..." + #================================================= # BACKUP THE APP MAIN DIR #================================================= -ynh_script_progression --message="Backing up the main app directory..." ynh_backup --src_path="$final_path" #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Backing up nginx web server configuration..." ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # BACKUP THE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Backing up php-fpm configuration..." ynh_backup --src_path="/etc/php/$YNH_PHP_VERSION/fpm/pool.d/$app.conf" #================================================= # BACKUP THE MYSQL DATABASE #================================================= -ynh_script_progression --message="Backing up the MySQL database..." --weight=2 +ynh_print_info --message="Backing up the MySQL database..." ynh_mysql_dump_db --database="$db_name" > db.sql @@ -62,14 +62,12 @@ ynh_mysql_dump_db --database="$db_name" > db.sql #================================================= # BACKUP LOGROTATE #================================================= -ynh_script_progression --message="Backing up logrotate configuration..." ynh_backup "/etc/logrotate.d/$app" #================================================= # BACKUP FAIL2BAN CONFIGURATION #================================================= -ynh_script_progression --message="Backing up fail2ban configuration..." ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf" ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf" @@ -83,7 +81,7 @@ ynh_backup --src_path="/etc/cron.d/$app" #================================================= # BACKUP THE DATA DIRECTORY #================================================= -ynh_script_progression --message="Backing up data directory..." +ynh_print_info --message="Backing up data directory..." ynh_backup --src_path="/home/yunohost.app/${app}/data" --is_big @@ -91,4 +89,4 @@ ynh_backup --src_path="/home/yunohost.app/${app}/data" --is_big # END OF SCRIPT #================================================= -ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last +ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." From 8f7fb69e839e5b948591823750ce5e81162bfeb8 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 13 Sep 2020 12:41:43 +0200 Subject: [PATCH 172/204] Minor typos --- scripts/change_url | 14 +++++++------- scripts/install | 18 +++++++++--------- scripts/remove | 12 ++++++------ scripts/restore | 6 +++--- scripts/upgrade | 22 +++++++++++----------- 5 files changed, 36 insertions(+), 36 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index c9f7a9c..2aa5f36 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -50,23 +50,23 @@ fi #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating nginx web server configuration..." --weight=2 +ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2 nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf -# Change the path in the nginx config file +# Change the path in the NGINX config file if [ $change_path -eq 1 ] then - # Make a backup of the original nginx config file if modified + # Make a backup of the original NGINX config file if modified ynh_backup_if_checksum_is_different --file="$nginx_conf_path" - # Set global variables for nginx helper + # Set global variables for NGINX helper domain="$old_domain" path_url="$new_path" - # Create a dedicated nginx config + # Create a dedicated NGINX config ynh_add_nginx_config YNH_PHP_VERSION fi -# Change the domain for nginx +# Change the domain for NGINX if [ $change_domain -eq 1 ] then # Delete file checksum for the old conf file location @@ -114,7 +114,7 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading NGINX web server..." ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/install b/scripts/install index 6eb8471..cfe9d5b 100755 --- a/scripts/install +++ b/scripts/install @@ -87,7 +87,7 @@ ynh_setup_source --dest_dir="$final_path" #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring nginx web server..." --weight=2 +ynh_script_progression --message="Configuring NGINX web server..." --weight=2 # 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" @@ -98,7 +98,7 @@ then sed --in-place --regexp-extended '/^location = \/\.well\-known\/(caldav|carddav) \{/,/\}/d' "../conf/nginx.conf" fi -# Create a dedicated nginx config +# Create a dedicated NGINX config ynh_add_nginx_config YNH_PHP_VERSION #================================================= @@ -112,7 +112,7 @@ ynh_system_user_create --username=$app #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Configuring php-fpm..." --weight=50 +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" @@ -131,7 +131,7 @@ mkdir -p "$datadir" #================================================= # INSTALL NEXTCLOUD #================================================= -ynh_script_progression --message="Installing nextcloud..." --weight=30 +ynh_script_progression --message="Installing Nextcloud..." --weight=30 # Define a function to execute commands with `occ` exec_occ() { @@ -153,7 +153,7 @@ exec_occ maintenance:install \ #================================================= # CONFIGURE NEXTCLOUD #================================================= -ynh_script_progression --message="Configuring nextcloud..." --weight=8 +ynh_script_progression --message="Configuring Nextcloud..." --weight=8 # Ensure that UpdateNotification app is disabled exec_occ app:disable updatenotification @@ -162,7 +162,7 @@ exec_occ app:disable updatenotification exec_occ app:enable user_ldap exec_occ ldap:create-empty-config -# Load the installation config file in nextcloud +# Load the installation config file in Nextcloud nc_conf="$final_path/config_install.json" cp ../conf/config_install.json "$nc_conf" @@ -327,9 +327,9 @@ ynh_use_logrotate --logfile="$datadir/nextcloud.log" #================================================= # SETUP FAIL2BAN #================================================= -ynh_script_progression --message="Configuring fail2ban..." --weight=8 +ynh_script_progression --message="Configuring Fail2ban..." --weight=8 -# Create a dedicated fail2ban config +# Create a dedicated Fail2ban config ynh_add_fail2ban_config --logpath="/home/yunohost.app/$app/data/nextcloud.log" --failregex="^.*Login failed: '.*' \(Remote IP: ''.*$" --max_retry=5 #================================================= @@ -344,7 +344,7 @@ ynh_app_setting_set --app=$app --key=skipped_regex \ #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading NGINX web server..." ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/remove b/scripts/remove index 9ea5c15..ebf87d2 100755 --- a/scripts/remove +++ b/scripts/remove @@ -49,17 +49,17 @@ ynh_secure_remove --file="$final_path" #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Removing nginx web server configuration..." +ynh_script_progression --message="Removing NGINX web server configuration..." -# Remove the dedicated nginx config +# Remove the dedicated NGINX config ynh_remove_nginx_config #================================================= # REMOVE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Removing php-fpm configuration..." --weight=2 +ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=2 -# Remove the dedicated php-fpm config +# Remove the dedicated PHP-FPM config ynh_remove_fpm_config #================================================= @@ -73,9 +73,9 @@ ynh_remove_logrotate #================================================= # REMOVE FAIL2BAN CONFIGURATION #================================================= -ynh_script_progression --message="Removing fail2ban configuration..." --weight=8 +ynh_script_progression --message="Removing Fail2ban configuration..." --weight=8 -# Remove the dedicated fail2ban config +# Remove the dedicated Fail2ban config ynh_remove_fail2ban_config #================================================= diff --git a/scripts/restore b/scripts/restore index 8c49cad..daa51e9 100755 --- a/scripts/restore +++ b/scripts/restore @@ -95,7 +95,7 @@ ynh_install_app_dependencies $pkg_dependencies #================================================= # RESTORE THE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Reconfiguring php-fpm..." --weight=50 +ynh_script_progression --message="Reconfiguring PHP-FPM..." --weight=50 # Restore the file first, so it can have a backup if different ynh_restore_file --origin_path="/etc/php/$YNH_PHP_VERSION/fpm/pool.d/$app.conf" @@ -156,7 +156,7 @@ ynh_multimedia_addaccess $app #================================================= # RESTORE THE FAIL2BAN CONFIGURATION #================================================= -ynh_script_progression --message="Restoring the fail2ban configuration..." --weight=7 +ynh_script_progression --message="Restoring the Fail2ban configuration..." --weight=7 ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf" ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf" @@ -175,7 +175,7 @@ ynh_systemd_action --action=restart --service_name=fail2ban #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading NGINX web server..." ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/upgrade b/scripts/upgrade index b793386..6c76b8f 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -143,7 +143,7 @@ ynh_install_app_dependencies $pkg_dependencies #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=2 +ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2 ynh_backup_if_checksum_is_different --file="/etc/nginx/conf.d/$domain.d/$app.conf" @@ -177,7 +177,7 @@ ynh_system_user_create --username=$app #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading php-fpm configuration..." --weight=2 +ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2 # Recreate a dedicated php-fpm config ynh_add_fpm_config --phpversion="$YNH_PHP_VERSION" --usage=$fpm_usage --footprint=$fpm_footprint --package="$extra_php_dependencies" @@ -223,7 +223,7 @@ datadir="/home/yunohost.app/$app/data" if [ "$upgrade_type" == "UPGRADE_APP" ] then - ynh_script_progression --message="Upgrading nextcloud..." --weight=3 + ynh_script_progression --message="Upgrading Nextcloud..." --weight=3 # Load the last available version source upgrade.d/upgrade.last.sh @@ -234,7 +234,7 @@ then # Set write access for the following commands chown -R $app: "$final_path" "$datadir" - # Print the current version number of nextcloud + # Print the current version number of Nextcloud exec_occ -V # While the current version is not the last version, do an upgrade @@ -257,7 +257,7 @@ then ynh_print_info --message="Upgrade to nextcloud $next_version" - # Create an app.src for this version of nextcloud + # 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" @@ -274,7 +274,7 @@ then # Backup the config file in the temp dir cp -a "$final_path/config/config.php" "$tmpdir/config/config.php" - # Backup 3rd party applications from the current nextcloud + # Backup 3rd party applications from the current Nextcloud # But do not overwrite if there is any upgrade # (apps directory already exists in Nextcloud archive) ( @@ -319,7 +319,7 @@ then #================================================= # CONFIGURE NEXTCLOUD #================================================= - ynh_script_progression --message="Reconfiguring nextcloud..." --weight=9 + ynh_script_progression --message="Reconfiguring Nextcloud..." --weight=9 # Verify the checksum and backup the file if it's different ynh_backup_if_checksum_is_different --file="$final_path/config/config.php" @@ -445,9 +445,9 @@ ynh_use_logrotate --non-append #================================================= # SETUP FAIL2BAN #================================================= -ynh_script_progression --message="Reconfiguring fail2ban..." --weight=7 +ynh_script_progression --message="Reconfiguring Fail2ban..." --weight=7 -# Create a dedicated fail2ban config +# Create a dedicated Fail2ban config ynh_add_fail2ban_config --logpath="/home/yunohost.app/$app/data/nextcloud.log" --failregex="^.*Login failed: '.*' \(Remote IP: ''.*$" --max_retry=5 #================================================= @@ -464,7 +464,7 @@ ynh_app_setting_set --app=$app --key=skipped_regex \ #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading NGINX web server..." ynh_systemd_action --service_name=nginx --action=reload @@ -474,7 +474,7 @@ ynh_systemd_action --service_name=nginx --action=reload if [ $migration_process -eq 1 ] then - ynh_print_info --message="ownCloud has been successfully migrated to Nextcloud! \ + 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." From 425862b882391ae647fa488cf61417f4ab073020 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Fri, 2 Oct 2020 19:32:00 +0200 Subject: [PATCH 173/204] Upgrade to 20.0.0 --- README.md | 2 +- README_fr.md | 2 +- manifest.json | 6 +++--- scripts/upgrade.d/upgrade.19.sh | 7 +++++++ scripts/upgrade.d/upgrade.last.sh | 4 ++-- 5 files changed, 14 insertions(+), 7 deletions(-) create mode 100644 scripts/upgrade.d/upgrade.19.sh diff --git a/README.md b/README.md index b4b939b..40dbcbe 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ own data. A personal cloud which runs on your own server. With Nextcloud you can synchronize your files over your devices. -**Shipped version:** 19.0.3 +**Shipped version:** 20.0.0 ## Screenshots diff --git a/README_fr.md b/README_fr.md index 404ef69..26f200f 100644 --- a/README_fr.md +++ b/README_fr.md @@ -14,7 +14,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. Avec NextCloud vous pouvez synchroniser vos fichiers sur vos appareils. -**Version incluse :** 19.0.3 +**Version incluse :** 20.0.0 ## Captures d'écran diff --git a/manifest.json b/manifest.json index 75aa560..75881e2 100644 --- a/manifest.json +++ b/manifest.json @@ -3,10 +3,10 @@ "name": "Nextcloud", "packaging_format": 1, "description": { - "en": "Access & share your files, calendars, contacts, mail & more from any device, on your terms", - "fr": "Consultez et partagez vos fichiers, agendas, carnets d'adresses, emails et bien plus depuis les appareils de votre choix, sous vos conditions" + "en": "Online storage, file sharing platform and various other applications", + "fr": "Stockage en ligne, plateforme de partage de fichiers et diverses autres applications" }, - "version": "19.0.3~ynh1", + "version": "20.0.0~ynh1", "url": "https://nextcloud.com", "license": "AGPL-3.0", "maintainer": { diff --git a/scripts/upgrade.d/upgrade.19.sh b/scripts/upgrade.d/upgrade.19.sh new file mode 100644 index 0000000..f62a916 --- /dev/null +++ b/scripts/upgrade.d/upgrade.19.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +# Last available nextcloud version +next_version="20.0.0" + +# Nextcloud tarball checksum sha256 +nextcloud_source_sha256="" diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index 569c56e..f62a916 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="19.0.3" +next_version="20.0.0" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="fc503985e8aa4ed795d882e35679e0e1b7670181768e7820307222d8b4658969" +nextcloud_source_sha256="" From 6e5449def94bb421d6dfc0e7daa7180e779eafca Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 3 Oct 2020 10:44:39 +0200 Subject: [PATCH 174/204] Add shasum --- scripts/upgrade.d/upgrade.19.sh | 2 +- scripts/upgrade.d/upgrade.last.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/upgrade.d/upgrade.19.sh b/scripts/upgrade.d/upgrade.19.sh index f62a916..c44f02b 100644 --- a/scripts/upgrade.d/upgrade.19.sh +++ b/scripts/upgrade.d/upgrade.19.sh @@ -4,4 +4,4 @@ next_version="20.0.0" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="" +nextcloud_source_sha256="a273e0151f68567f729d9a82a7e3f124ff0f0471aa17bae6bfd83c5362d84cd8" diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index f62a916..c44f02b 100755 --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -4,4 +4,4 @@ next_version="20.0.0" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="" +nextcloud_source_sha256="a273e0151f68567f729d9a82a7e3f124ff0f0471aa17bae6bfd83c5362d84cd8" From 7e638dbaa8c67e9032077200009a2a9547735d3d Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 3 Oct 2020 11:12:35 +0200 Subject: [PATCH 175/204] Update install --- scripts/install | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/scripts/install b/scripts/install index cfe9d5b..c106a4f 100755 --- a/scripts/install +++ b/scripts/install @@ -187,8 +187,8 @@ ynh_secure_remove --file="$nc_conf" #================================================= # Check LDAP configuration to see if everything worked well -exec_occ ldap:test-config \'\' \ - || ynh_die --message="An error occured during LDAP configuration" +# exec_occ ldap:test-config \'\' \ +# || ynh_die --message="An error occured during LDAP configuration" #================================================= # MOUNT HOME FOLDERS AS EXTERNAL STORAGE @@ -273,12 +273,9 @@ exec_occ background:cron # POST-INSTALL MAINTENANCE #================================================= -( - cd $final_path - sudo -u $app php${YNH_PHP_VERSION} occ db:add-missing-indices - sudo -u $app php${YNH_PHP_VERSION} occ db:add-missing-columns - sudo -u $app php${YNH_PHP_VERSION} occ db:convert-filecache-bigint -n -) +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 From 8a52c9d4016f70995bf8632314617ae6b2d66122 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 3 Oct 2020 12:11:28 +0200 Subject: [PATCH 176/204] Small typos --- README.md | 41 ++++++++++++----------------------------- README_fr.md | 9 ++++----- scripts/install | 10 +++++----- scripts/remove | 4 ++-- scripts/restore | 2 +- scripts/upgrade | 25 +++++++++++-------------- 6 files changed, 35 insertions(+), 56 deletions(-) diff --git a/README.md b/README.md index 40dbcbe..e7c85fb 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,7 @@ If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to ## 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. +[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.0 @@ -41,7 +39,7 @@ To install and configure it: - 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** (Raspberry Pi, …) is **not** supported* +*NB: OnlyOffice is only available for x86 architecture - **ARM** (Raspberry Pi...) is **not** supported* ## YunoHost specific features @@ -51,10 +49,8 @@ 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 + * 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 @@ -65,13 +61,9 @@ this package: ## 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. +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. +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: ``` @@ -91,15 +83,11 @@ If you need/want to use Nextcloud `occ` command¹, you need to be in `/var/www/n #### Migrate from ownCloud -**This is not considered as stable yet, please do it with care and only for -testing!** +**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. +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: +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 @@ -108,13 +96,9 @@ sudo yunohost app upgrade -u https://github.com/YunoHost-Apps/nextcloud_ynh ownc 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 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: +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" @@ -130,8 +114,7 @@ sudo yunohost app ssowatconf --- -Developers infos ----------------- +## Developers infos Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/nextcloud_ynh/tree/testing). diff --git a/README_fr.md b/README_fr.md index 26f200f..3b76b23 100644 --- a/README_fr.md +++ b/README_fr.md @@ -41,7 +41,7 @@ Pour l'installer et le configurer : - 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 - **ARM** (Raspberry Pi, …) n'est **pas** supporté* + *NB : OnlyOffice n'est disponible que sous architecture x86 - **ARM** (Raspberry Pi...) n'est **pas** supporté* ## Caractéristiques spécifiques YunoHost @@ -79,9 +79,9 @@ Following symlinks is not allowed ('/home/yunohost.multimedia/user/Share' -> '/h **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. +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. +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 @@ -107,8 +107,7 @@ sudo yunohost app ssowatconf --- -Informations pour les développeurs ----------------- +## 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. diff --git a/scripts/install b/scripts/install index c106a4f..bacc853 100755 --- a/scripts/install +++ b/scripts/install @@ -158,7 +158,7 @@ ynh_script_progression --message="Configuring Nextcloud..." --weight=8 # Ensure that UpdateNotification app is disabled exec_occ app:disable updatenotification -# Enable ldap plugin +# Enable LDAP plugin exec_occ app:enable user_ldap exec_occ ldap:create-empty-config @@ -187,8 +187,8 @@ ynh_secure_remove --file="$nc_conf" #================================================= # Check LDAP configuration to see if everything worked well -# exec_occ ldap:test-config \'\' \ -# || ynh_die --message="An error occured during LDAP configuration" +exec_occ ldap:test-config \'\' \ + || ynh_die --message="An error occured during LDAP configuration" #================================================= # MOUNT HOME FOLDERS AS EXTERNAL STORAGE @@ -324,9 +324,9 @@ ynh_use_logrotate --logfile="$datadir/nextcloud.log" #================================================= # SETUP FAIL2BAN #================================================= -ynh_script_progression --message="Configuring Fail2ban..." --weight=8 +ynh_script_progression --message="Configuring Fail2Ban..." --weight=8 -# Create a dedicated Fail2ban config +# Create a dedicated Fail2Ban config ynh_add_fail2ban_config --logpath="/home/yunohost.app/$app/data/nextcloud.log" --failregex="^.*Login failed: '.*' \(Remote IP: ''.*$" --max_retry=5 #================================================= diff --git a/scripts/remove b/scripts/remove index ebf87d2..b84d5bf 100755 --- a/scripts/remove +++ b/scripts/remove @@ -73,9 +73,9 @@ ynh_remove_logrotate #================================================= # REMOVE FAIL2BAN CONFIGURATION #================================================= -ynh_script_progression --message="Removing Fail2ban configuration..." --weight=8 +ynh_script_progression --message="Removing Fail2Ban configuration..." --weight=8 -# Remove the dedicated Fail2ban config +# Remove the dedicated Fail2Ban config ynh_remove_fail2ban_config #================================================= diff --git a/scripts/restore b/scripts/restore index daa51e9..764c229 100755 --- a/scripts/restore +++ b/scripts/restore @@ -156,7 +156,7 @@ ynh_multimedia_addaccess $app #================================================= # RESTORE THE FAIL2BAN CONFIGURATION #================================================= -ynh_script_progression --message="Restoring the Fail2ban configuration..." --weight=7 +ynh_script_progression --message="Restoring the Fail2Ban configuration..." --weight=7 ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf" ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf" diff --git a/scripts/upgrade b/scripts/upgrade index 6c76b8f..5325faf 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -147,11 +147,11 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." - ynh_backup_if_checksum_is_different --file="/etc/nginx/conf.d/$domain.d/$app.conf" -# Delete current nginx configuration to be able to check if .well-known is already served. +# Delete current NGINX configuration to be able to check if .well-known is already served. ynh_remove_nginx_config ynh_app_setting_delete --app=$app --key="checksum__etc_nginx_conf.d_$domain.d_$app.conf" -# Wait untils nginx has fully reloaded +# Wait untils NGINX has fully reloaded ynh_systemd_action --service_name=nginx --action=reload --line_match="Reloaded" --log_path="systemd" # Check if .well-known is available for this domain @@ -163,7 +163,7 @@ then sed --in-place --regexp-extended '/^location = \/\.well\-known\/(caldav|carddav) \{/,/\}/d' "../conf/nginx.conf" fi -# Create a dedicated nginx config +# Create a dedicated NGINX config ynh_add_nginx_config YNH_PHP_VERSION #================================================= @@ -179,7 +179,7 @@ ynh_system_user_create --username=$app #================================================= ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2 -# Recreate a dedicated php-fpm config +# Recreate a dedicated PHP-FPM config ynh_add_fpm_config --phpversion="$YNH_PHP_VERSION" --usage=$fpm_usage --footprint=$fpm_footprint --package="$extra_php_dependencies" # Delete existing ini configuration file (backward compatibility) @@ -309,12 +309,9 @@ then exec_occ -V done - ( - cd $final_path - sudo -u $app php${YNH_PHP_VERSION} occ db:add-missing-indices - sudo -u $app php${YNH_PHP_VERSION} occ db:add-missing-columns - sudo -u $app php${YNH_PHP_VERSION} occ db:convert-filecache-bigint -n - ) + exec_occ db:add-missing-indices + exec_occ db:add-missing-columns + exec_occ db:convert-filecache-bigint -n #================================================= # CONFIGURE NEXTCLOUD @@ -333,7 +330,7 @@ then # Ensure that UpdateNotification app is disabled exec_occ app:disable updatenotification - # Enable plugins + # Enable LDAP plugin exec_occ app:enable user_ldap # Load the config file in nextcloud @@ -445,9 +442,9 @@ ynh_use_logrotate --non-append #================================================= # SETUP FAIL2BAN #================================================= -ynh_script_progression --message="Reconfiguring Fail2ban..." --weight=7 +ynh_script_progression --message="Reconfiguring Fail2Ban..." --weight=7 -# Create a dedicated Fail2ban config +# Create a dedicated Fail2Ban config ynh_add_fail2ban_config --logpath="/home/yunohost.app/$app/data/nextcloud.log" --failregex="^.*Login failed: '.*' \(Remote IP: ''.*$" --max_retry=5 #================================================= @@ -474,7 +471,7 @@ ynh_systemd_action --service_name=nginx --action=reload if [ $migration_process -eq 1 ] then - ynh_print_info --message="OwnCloud has been successfully migrated to Nextcloud! \ + 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." From 6038e9c5ce2e4d808ef3a5cefdbbc68e75e0c046 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 3 Oct 2020 14:03:01 +0200 Subject: [PATCH 177/204] small typos --- README.md | 6 +++--- README_fr.md | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index e7c85fb..5482848 100644 --- a/README.md +++ b/README.md @@ -35,11 +35,11 @@ If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to 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. +- 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** (Raspberry Pi...) is **not** supported* +*NB: OnlyOffice is only available for x86 architecture - **ARM** architecture is **not** supported (Raspberry Pi, OLinuXino...)* ## YunoHost specific features diff --git a/README_fr.md b/README_fr.md index 3b76b23..5b9eecf 100644 --- a/README_fr.md +++ b/README_fr.md @@ -34,14 +34,14 @@ Avec NextCloud vous pouvez synchroniser vos fichiers sur vos appareils. #### Configurer l'intégration d'OnlyOffice -À partir de sa version 18, Nextcloud intégre une intégration directe de OnlyOffice (un éditeur de texte enrichi en ligne) via une application Nextcloud. -Pour l'installer et le 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. +À 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 - **ARM** (Raspberry Pi...) n'est **pas** supporté* +*NB : OnlyOffice n'est disponible que sous architecture x86 - L'architecture **ARM** n'est **pas** supporté (Raspberry Pi, OLinuXino...)* ## Caractéristiques spécifiques YunoHost From 30759821eca72a1d636ec36c136b9018b239eb0b Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 3 Oct 2020 15:36:48 +0200 Subject: [PATCH 178/204] Fix Invalid configID --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index bacc853..abcedb4 100755 --- a/scripts/install +++ b/scripts/install @@ -187,7 +187,7 @@ ynh_secure_remove --file="$nc_conf" #================================================= # Check LDAP configuration to see if everything worked well -exec_occ ldap:test-config \'\' \ +exec_occ ldap:test-config '' \ || ynh_die --message="An error occured during LDAP configuration" #================================================= From fe62ab987a88a5c2540c248f80ec08122fbadb31 Mon Sep 17 00:00:00 2001 From: Sebastien Mennetrier Date: Wed, 7 Oct 2020 17:38:32 +0200 Subject: [PATCH 179/204] Fix issues with Element (Riotchat) app --- conf/nginx.conf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/conf/nginx.conf b/conf/nginx.conf index 0cf3732..462d900 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -121,6 +121,10 @@ location ^~ __PATH__/ { rewrite ^ __PATH__/index.php$request_uri; } + location ~* ^__PATH__/apps/riotchat/riot/ { + rewrite ^ __PATH__/index.php$request_uri; + } + # Adding the cache control header for js, css and map files location ~ ^__PATH__/.+[^\/]\.(?:css|js|woff2?|svg|gif|map)$ { try_files $uri __PATH__/index.php$request_uri; From 9717e59557a2c746ed29ad9d405a783dcbf2fceb Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 8 Oct 2020 09:51:32 +0200 Subject: [PATCH 180/204] upgrade to v19.0.4 --- README.md | 2 +- README_fr.md | 2 +- manifest.json | 2 +- scripts/install | 9 +++------ scripts/upgrade | 9 +++------ scripts/upgrade.d/upgrade.last.sh | 4 ++-- 6 files changed, 11 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index b4b939b..fd10c0f 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ own data. A personal cloud which runs on your own server. With Nextcloud you can synchronize your files over your devices. -**Shipped version:** 19.0.3 +**Shipped version:** 19.0.4 ## Screenshots diff --git a/README_fr.md b/README_fr.md index 404ef69..d9e3dc2 100644 --- a/README_fr.md +++ b/README_fr.md @@ -14,7 +14,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. Avec NextCloud vous pouvez synchroniser vos fichiers sur vos appareils. -**Version incluse :** 19.0.3 +**Version incluse :** 19.0.4 ## Captures d'écran diff --git a/manifest.json b/manifest.json index 75aa560..f2746de 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Access & share your files, calendars, contacts, mail & more from any device, on your terms", "fr": "Consultez et partagez vos fichiers, agendas, carnets d'adresses, emails et bien plus depuis les appareils de votre choix, sous vos conditions" }, - "version": "19.0.3~ynh1", + "version": "19.0.4~ynh1", "url": "https://nextcloud.com", "license": "AGPL-3.0", "maintainer": { diff --git a/scripts/install b/scripts/install index cfe9d5b..0ad4cde 100755 --- a/scripts/install +++ b/scripts/install @@ -273,12 +273,9 @@ exec_occ background:cron # POST-INSTALL MAINTENANCE #================================================= -( - cd $final_path - sudo -u $app php${YNH_PHP_VERSION} occ db:add-missing-indices - sudo -u $app php${YNH_PHP_VERSION} occ db:add-missing-columns - sudo -u $app php${YNH_PHP_VERSION} occ db:convert-filecache-bigint -n -) +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 diff --git a/scripts/upgrade b/scripts/upgrade index 6c76b8f..e3ec094 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -309,12 +309,9 @@ then exec_occ -V done - ( - cd $final_path - sudo -u $app php${YNH_PHP_VERSION} occ db:add-missing-indices - sudo -u $app php${YNH_PHP_VERSION} occ db:add-missing-columns - sudo -u $app php${YNH_PHP_VERSION} occ db:convert-filecache-bigint -n - ) + exec_occ db:add-missing-indices + exec_occ db:add-missing-columns + exec_occ db:convert-filecache-bigint -n #================================================= # CONFIGURE NEXTCLOUD diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index 569c56e..7a8f7df 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="19.0.3" +next_version="19.0.4" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="fc503985e8aa4ed795d882e35679e0e1b7670181768e7820307222d8b4658969" +nextcloud_source_sha256="" From de251cebfcba1f7da2bf427f168a0edb397d6524 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 8 Oct 2020 10:57:22 +0200 Subject: [PATCH 181/204] Update upgrade.last.sh --- scripts/upgrade.d/upgrade.last.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index 7a8f7df..f05cba2 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 +# Last available Nextcloud version next_version="19.0.4" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="" +nextcloud_source_sha256="465711715d64cbdf0465fcb4405f23b6f0947b85bbe12b6577c9e1602c63ae78" From 3735ac2ad2632cf6fff681b5808eb5a6824641ea Mon Sep 17 00:00:00 2001 From: Kay0u Date: Tue, 13 Oct 2020 14:52:32 +0200 Subject: [PATCH 182/204] fix upgrade for new major version --- scripts/upgrade | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 5325faf..c9faaae 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -212,8 +212,8 @@ exec_occ() { create_external_storage() { local datadir="$1" local mount_name="$2" -local mount_id=`exec_occ files_external:create --output=json \ - "$mount_name" 'local' 'null::null' -c "datadir=$datadir" || true` +local mount_id=$(exec_occ files_external:create --output=json \ + "$mount_name" 'local' 'null::null' -c "datadir=$datadir" || true) ! [[ $mount_id =~ ^[0-9]+$ ]] \ && ynh_print_warn --message="Unable to create external storage" \ || exec_occ files_external:option "$mount_id" enable_sharing true @@ -244,9 +244,17 @@ then # The major version is the first part of the version number current_major_version=${current_version%%.*} + if [ ! -f upgrade.d/upgrade.$current_major_version.sh ]; then + source upgrade.d/upgrade.last.sh + else + source upgrade.d/upgrade.$current_major_version.sh + fi + # If the current version has the same major version than the next one, # then it's the last upgrade to do - if [ "$last_major_version" -eq "$current_major_version" ]; then + # We also cover the case where the last version is the first of the current major version series + # (e.g. 20.0.0 is the latest version) + if [[ ("$last_major_version" -eq "$current_major_version") || ( ("$last_major_version" -eq "$((current_major_version+1))") && ("$next_version" == "$last_version") ) ]]; then current_major_version=last # Enable YunoHost patches on Nextcloud sources cp -a ../sources/patches_last_version/* ../sources/patches From 0207a89fe6781a1db59d2df57189564053e70b74 Mon Sep 17 00:00:00 2001 From: Kay0u Date: Mon, 26 Oct 2020 12:03:17 +0100 Subject: [PATCH 183/204] 20.0.1 --- README.md | 2 +- README_fr.md | 2 +- manifest.json | 2 +- scripts/upgrade.d/upgrade.last.sh | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 5482848..35e444d 100644 --- a/README.md +++ b/README.md @@ -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. -**Shipped version:** 20.0.0 +**Shipped version:** 20.0.1 ## Screenshots diff --git a/README_fr.md b/README_fr.md index 5b9eecf..d2c8ff3 100644 --- a/README_fr.md +++ b/README_fr.md @@ -14,7 +14,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. Avec NextCloud vous pouvez synchroniser vos fichiers sur vos appareils. -**Version incluse :** 20.0.0 +**Version incluse :** 20.0.1 ## Captures d'écran diff --git a/manifest.json b/manifest.json index 75881e2..ca9bab0 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "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.0~ynh1", + "version": "20.0.1~ynh1", "url": "https://nextcloud.com", "license": "AGPL-3.0", "maintainer": { diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index c44f02b..5ab466b 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.0" +next_version="20.0.1" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="a273e0151f68567f729d9a82a7e3f124ff0f0471aa17bae6bfd83c5362d84cd8" +nextcloud_source_sha256="96c6b50e1e676e46cec82d8f8ff1abd5eef9dfa00580081b6c640612c3ff2efc" From 0bd857d7620310be09d70f2a7e48b10a7827be48 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 3 Nov 2020 18:13:11 +0100 Subject: [PATCH 184/204] Fix last warning in linter about sudo ? --- scripts/_common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 2b9a766..84a4b01 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -341,7 +341,7 @@ ynh_smart_mktemp () { ynh_die "Insufficient free space to continue..." fi - echo "$(sudo mktemp --directory --tmpdir="$tmpdir")" + echo "$(mktemp --directory --tmpdir="$tmpdir")" } #================================================= From 1be264d94daf6d8dba31210c799708d24f9de6dc Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 18 Nov 2020 20:58:57 +0100 Subject: [PATCH 185/204] Upgrade to version 20.0.2 --- README.md | 2 +- README_fr.md | 2 +- manifest.json | 2 +- scripts/upgrade.d/upgrade.last.sh | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 5482848..6b0e808 100644 --- a/README.md +++ b/README.md @@ -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. -**Shipped version:** 20.0.0 +**Shipped version:** 20.0.2 ## Screenshots diff --git a/README_fr.md b/README_fr.md index 5b9eecf..2d36ec8 100644 --- a/README_fr.md +++ b/README_fr.md @@ -14,7 +14,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. Avec NextCloud vous pouvez synchroniser vos fichiers sur vos appareils. -**Version incluse :** 20.0.0 +**Version incluse :** 20.0.2 ## Captures d'écran diff --git a/manifest.json b/manifest.json index 75881e2..f96496f 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "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.0~ynh1", + "version": "20.0.2~ynh1", "url": "https://nextcloud.com", "license": "AGPL-3.0", "maintainer": { diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index c44f02b..682e66e 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.0" +next_version="20.0.2" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="a273e0151f68567f729d9a82a7e3f124ff0f0471aa17bae6bfd83c5362d84cd8" +nextcloud_source_sha256="be84c2ac7fba066ddc0637a4672b39628bbbd200dad8c00a0437a4765007dd21" From d5f703f47a27676b3188d1914d5d9740f56d6a0f Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 19 Nov 2020 08:10:43 +0100 Subject: [PATCH 186/204] Update nginx.conf --- conf/nginx.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 462d900..adc69c3 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -91,7 +91,7 @@ location ^~ __PATH__/ { fastcgi_param modHeadersAvailable true; # Enable pretty urls fastcgi_param front_controller_active true; - fastcgi_pass unix:/var/run/php/php__YNH_PHP_VERSION__-fpm-__NAME__.sock; + fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock; fastcgi_intercept_errors on; fastcgi_request_buffering off; } From 7d09e4b1978e74318b468c0da08bec48d3dc3a86 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 19 Nov 2020 08:16:17 +0100 Subject: [PATCH 187/204] Update nginx.conf --- conf/nginx.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 462d900..4508d5a 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -91,7 +91,7 @@ location ^~ __PATH__/ { fastcgi_param modHeadersAvailable true; # Enable pretty urls fastcgi_param front_controller_active true; - fastcgi_pass unix:/var/run/php/php__YNH_PHP_VERSION__-fpm-__NAME__.sock; + fastcgi_pass unix:/var/run/php/php__PHP_VERSION__-fpm-__NAME__.sock; fastcgi_intercept_errors on; fastcgi_request_buffering off; } From 3502b84407491cbae5654dfe52380b47c616f517 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 19 Nov 2020 08:33:00 +0100 Subject: [PATCH 188/204] Small typos --- README.md | 1 + README_fr.md | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 51ad16a..a1eeaef 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ [![Install Nextcloud with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](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.* diff --git a/README_fr.md b/README_fr.md index 2d36ec8..37b5691 100644 --- a/README_fr.md +++ b/README_fr.md @@ -5,7 +5,6 @@ *[Read this readme in english.](./README.md)* - > *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.* @@ -98,7 +97,7 @@ sudo yunohost app setting nextcloud label -v "Nextcloud" sudo yunohost app ssowatconf ``` -## Links +## Liens * Signaler un bug : https://github.com/YunoHost-Apps/nextcloud_ynh/issues * Site web de Nextcloud : https://nextcloud.com/ From a9559aeac4f75332c3fd12a603e45540f41beb57 Mon Sep 17 00:00:00 2001 From: Kay0u Date: Thu, 19 Nov 2020 11:39:57 +0100 Subject: [PATCH 189/204] use phpversion for nginx helper --- scripts/change_url | 5 +++-- scripts/install | 36 +++++++++++++++++++----------------- scripts/upgrade | 46 ++++++++++++++++++++++++---------------------- 3 files changed, 46 insertions(+), 41 deletions(-) diff --git a/scripts/change_url b/scripts/change_url index 2aa5f36..c779071 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -28,6 +28,7 @@ ynh_script_progression --message="Loading installation settings..." # Needed for helper "ynh_add_nginx_config" final_path=$(ynh_app_setting_get --app=$app --key=final_path) +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # CHECK WHICH PARTS SHOULD BE CHANGED @@ -63,7 +64,7 @@ then domain="$old_domain" path_url="$new_path" # Create a dedicated NGINX config - ynh_add_nginx_config YNH_PHP_VERSION + ynh_add_nginx_config fi # Change the domain for NGINX @@ -84,7 +85,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" \ - php${YNH_PHP_VERSION} occ --no-interaction --no-ansi "$@") + php${phpversion} occ --no-interaction --no-ansi "$@") } if [ $change_domain -eq 1 ] diff --git a/scripts/install b/scripts/install index abcedb4..692f594 100755 --- a/scripts/install +++ b/scripts/install @@ -84,23 +84,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" -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Configuring NGINX web server..." --weight=2 - -# 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" -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." - - # Remove lines about .well-known/carddav and caldav with sed. - sed --in-place --regexp-extended '/^location = \/\.well\-known\/(caldav|carddav) \{/,/\}/d' "../conf/nginx.conf" -fi - -# Create a dedicated NGINX config -ynh_add_nginx_config YNH_PHP_VERSION - #================================================= # CREATE DEDICATED USER #================================================= @@ -116,6 +99,25 @@ 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" +# Used by ynh_add_nginx_config +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) + +#================================================= +# NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Configuring NGINX web server..." --weight=2 + +# 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" +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." + + # Remove lines about .well-known/carddav and caldav with sed. + sed --in-place --regexp-extended '/^location = \/\.well\-known\/(caldav|carddav) \{/,/\}/d' "../conf/nginx.conf" +fi + +# Create a dedicated NGINX config +ynh_add_nginx_config #================================================= # SPECIFIC SETUP diff --git a/scripts/upgrade b/scripts/upgrade index d3f647e..24fa8d3 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -140,6 +140,29 @@ ynh_install_app_dependencies $pkg_dependencies #================================================= # STANDARD UPGRADE STEPS +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Making sure dedicated system user exists..." + +# Create a dedicated user (if not existing) +ynh_system_user_create --username=$app + +#================================================= +# PHP-FPM CONFIGURATION +#================================================= +ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2 + +# Recreate a dedicated PHP-FPM config +ynh_add_fpm_config --phpversion="$YNH_PHP_VERSION" --usage=$fpm_usage --footprint=$fpm_footprint --package="$extra_php_dependencies" + +# Delete existing ini configuration file (backward compatibility) +if [ -f /etc/php/$YNH_PHP_VERSION/fpm/conf.d/20-$app.ini ]; then + ynh_secure_remove --file=/etc/php/$YNH_PHP_VERSION/fpm/conf.d/20-$app.ini +fi +# Used by ynh_add_nginx_config +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) + #================================================= # NGINX CONFIGURATION #================================================= @@ -164,28 +187,7 @@ then fi # Create a dedicated NGINX config -ynh_add_nginx_config YNH_PHP_VERSION - -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." - -# Create a dedicated user (if not existing) -ynh_system_user_create --username=$app - -#================================================= -# PHP-FPM CONFIGURATION -#================================================= -ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2 - -# Recreate a dedicated PHP-FPM config -ynh_add_fpm_config --phpversion="$YNH_PHP_VERSION" --usage=$fpm_usage --footprint=$fpm_footprint --package="$extra_php_dependencies" - -# Delete existing ini configuration file (backward compatibility) -if [ -f /etc/php/$YNH_PHP_VERSION/fpm/conf.d/20-$app.ini ]; then - ynh_secure_remove --file=/etc/php/$YNH_PHP_VERSION/fpm/conf.d/20-$app.ini -fi +ynh_add_nginx_config #================================================= # SPECIFIC UPGRADE From dfe0624a71bd39c63385ee242d764a6f69c9e7df Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 19 Nov 2020 21:36:22 +0100 Subject: [PATCH 190/204] fix --- scripts/backup | 3 ++- scripts/config | 2 +- scripts/install | 4 ++-- scripts/restore | 5 +++-- scripts/upgrade | 13 ++++++------- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/scripts/backup b/scripts/backup index bb92dda..7ed3c7f 100755 --- a/scripts/backup +++ b/scripts/backup @@ -26,6 +26,7 @@ app=$YNH_APP_INSTANCE_NAME 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) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -48,7 +49,7 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" # BACKUP THE PHP-FPM CONFIGURATION #================================================= -ynh_backup --src_path="/etc/php/$YNH_PHP_VERSION/fpm/pool.d/$app.conf" +ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" #================================================= # BACKUP THE MYSQL DATABASE diff --git a/scripts/config b/scripts/config index 1d774dd..85769fc 100644 --- a/scripts/config +++ b/scripts/config @@ -77,7 +77,7 @@ apply_config() { if [ "$fpm_footprint" != "0" ] then - ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$YNH_PHP_VERSION + ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint else ynh_print_err --message="When selecting 'specific', you have to set a footprint value into the field below." fi diff --git a/scripts/install b/scripts/install index 692f594..70e89f4 100755 --- a/scripts/install +++ b/scripts/install @@ -138,7 +138,7 @@ 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$YNH_PHP_VERSION occ --no-interaction --no-ansi "$@") + php${phpversion} occ --no-interaction --no-ansi "$@") } # Set write access for the following commands @@ -267,7 +267,7 @@ 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="$YNH_PHP_VERSION" --target_file="$cron_path" +ynh_replace_string --match_string="__YNH_PHP_VERSION__" --replace_string="$phpversion" --target_file="$cron_path" exec_occ background:cron diff --git a/scripts/restore b/scripts/restore index 764c229..3cc1584 100755 --- a/scripts/restore +++ b/scripts/restore @@ -27,6 +27,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain) 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) fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint) fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage) @@ -98,10 +99,10 @@ ynh_install_app_dependencies $pkg_dependencies ynh_script_progression --message="Reconfiguring PHP-FPM..." --weight=50 # Restore the file first, so it can have a backup if different -ynh_restore_file --origin_path="/etc/php/$YNH_PHP_VERSION/fpm/pool.d/$app.conf" +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=$YNH_PHP_VERSION --package="$extra_php_dependencies" +ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --package="$extra_php_dependencies" #================================================= # RESTORE THE CRON FILE diff --git a/scripts/upgrade b/scripts/upgrade index 24fa8d3..a88a455 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -22,6 +22,7 @@ admin=$(ynh_app_setting_get --app=$app --key=admin) final_path=$(ynh_app_setting_get --app=$app --key=final_path) db_name=$(ynh_app_setting_get --app=$app --key=db_name) user_home=$(ynh_app_setting_get --app=$app --key=user_home) +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint) fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage) @@ -154,14 +155,12 @@ ynh_system_user_create --username=$app ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2 # Recreate a dedicated PHP-FPM config -ynh_add_fpm_config --phpversion="$YNH_PHP_VERSION" --usage=$fpm_usage --footprint=$fpm_footprint --package="$extra_php_dependencies" +ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --package="$extra_php_dependencies" # Delete existing ini configuration file (backward compatibility) -if [ -f /etc/php/$YNH_PHP_VERSION/fpm/conf.d/20-$app.ini ]; then - ynh_secure_remove --file=/etc/php/$YNH_PHP_VERSION/fpm/conf.d/20-$app.ini +if [ -f /etc/php/$phpversion/fpm/conf.d/20-$app.ini ]; then + ynh_secure_remove --file=/etc/php/$phpversion/fpm/conf.d/20-$app.ini fi -# Used by ynh_add_nginx_config -phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # NGINX CONFIGURATION @@ -201,7 +200,7 @@ exec_occ() { # Backward compatibility to upgrade from NC14 or older version if [ $current_major_version = "last" ] || [ $current_major_version -ge 15 ] then - NEXTCLOUD_PHP_VERSION=$YNH_PHP_VERSION + NEXTCLOUD_PHP_VERSION=$phpversion else NEXTCLOUD_PHP_VERSION="7.0" fi @@ -404,7 +403,7 @@ 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="$YNH_PHP_VERSION" --target_file="$cron_path" +ynh_replace_string --match_string="__YNH_PHP_VERSION__" --replace_string="$phpversion" --target_file="$cron_path" exec_occ background:cron From 00c90826df2eb0d7812234227252656a959ba6c2 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 24 Nov 2020 03:55:50 +0100 Subject: [PATCH 191/204] Moar linter warning fixes --- scripts/_common.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 84a4b01..ebffb0e 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -154,7 +154,7 @@ ynh_handle_app_migration () { # TODO Handle multi instance apps... # Check that there is not already an app installed for this id. - (yunohost app list --installed -f "$new_app" | grep -q id) \ + yunohost app list | grep -q 'id: $appname' \ && ynh_die "$new_app is already installed" #================================================= @@ -360,7 +360,7 @@ ynh_multimedia_build_main_dir () { local checksum="806a827ba1902d6911095602a9221181" # Download yunohost.multimedia scripts - wget -nv https://github.com/YunoHost-Apps/yunohost.multimedia/archive/${ynh_media_release}.tar.gz + 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 \ From ba559194376963fad2884e9dfc598b529de7be27 Mon Sep 17 00:00:00 2001 From: Kay0u Date: Mon, 30 Nov 2020 17:39:20 +0100 Subject: [PATCH 192/204] Update nginx conf for nextcloud 20 --- conf/nginx.conf | 173 +++++++++++++++++++++--------------------------- 1 file changed, 74 insertions(+), 99 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index adc69c3..d4581c2 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,27 +1,20 @@ -location = /.well-known/carddav { - return 301 https://$server_name__PATH__/remote.php/dav; -} -location = /.well-known/caldav { - return 301 https://$server_name__PATH__/remote.php/dav; -} +location ^~ /.well-known { + # The following 6 rules are borrowed from `.htaccess` -# The following 2 rules are only needed for the user_webfinger app. -# Uncomment it if you're planning to use this app. -#location = /.well-known/host-meta { -# return 301 $scheme://$host:$server_port__PATH__/public.php?service=host-meta; -#} -#location = /.well-known/host-meta.json { -# return 301 $scheme://$host:$server_port__PATH__/public.php?service=host-meta-json; -#} + # The following 2 rules are only needed for the user_webfinger app. + # 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; -# The following 2 rules are only needed for the Social app. -# Uncomment it if you're planning to use this app. -#location = /.well-known/webfinger { -# return 301 $scheme://$host:$server_port__PATH__/public.php?service=webfinger; -#} -#location = /.well-known/nodeinfo { -# return 301 $scheme://$host:$server_port__PATH__/public.php?service=nodeinfo; -#} + location = /.well-known/carddav { return 301 __PATH__/remote.php/dav/; } + location = /.well-known/caldav { return 301 __PATH__/remote.php/dav/; } + + try_files $uri $uri/ =404; +} #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; location ^~ __PATH__/ { @@ -36,33 +29,53 @@ location ^~ __PATH__/ { # Add headers to serve security related headers more_set_headers "Strict-Transport-Security: max-age=15768000; includeSubDomains; preload;"; - more_set_headers "X-Content-Type-Options: nosniff"; - more_set_headers "X-XSS-Protection: 1; mode=block"; - more_set_headers "X-Robots-Tag: none"; - more_set_headers "X-Download-Options: noopen"; - more_set_headers "X-Permitted-Cross-Domain-Policies: none"; more_set_headers "Referrer-Policy: no-referrer"; + more_set_headers "X-Content-Type-Options: nosniff"; + more_set_headers "X-Download-Options: noopen"; + more_set_headers "X-Frame-Options: SAMEORIGIN"; + more_set_headers "X-Permitted-Cross-Domain-Policies: none"; + more_set_headers "X-Robots-Tag: none"; + more_set_headers "X-XSS-Protection: 1; mode=block"; # Set max upload size client_max_body_size 10G; fastcgi_buffers 64 4K; - # Extend timeouts - client_body_timeout 60m; - proxy_read_timeout 60m; - fastcgi_read_timeout 60m; + # Enable gzip but do not remove ETag headers + gzip on; + gzip_vary on; + gzip_comp_level 4; + gzip_min_length 256; + gzip_proxied expired no-cache no-store private no_last_modified no_etag auth; + gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy; - # Disable gzip to avoid the removal of the ETag header - gzip off; + # Pagespeed is not supported by Nextcloud, so if your server is built + # with the `ngx_pagespeed` module, uncomment this line to disable it. + #pagespeed off; - # Errors pages - error_page 403 __PATH__/core/templates/403.php; - # Don't set custom 404 error page, as nextcloud uses 404 codes with meaningful payload. - # Setting custom 404 page clears the payload and creates UI bugs - # error_page 404 __PATH__/core/templates/404.php; + # Remove X-Powered-By, which is an information leak + fastcgi_hide_header X-Powered-By; - location __PATH__/ { - rewrite ^ __PATH__/index.php; + # Specify how to handle directories -- specifying `/nextcloud/index.php$request_uri` + # here as the fallback means that Nginx always exhibits the desired behaviour + # when a client requests a path that corresponds to a directory that exists + # on the server. In particular, if that directory contains an index.php file, + # that file is correctly served; if it doesn't, then the request is passed to + # the front-end controller. This consistent behaviour means that we don't need + # to specify custom rules for certain paths (e.g. images and other assets, + # `/updater`, `/ocm-provider`, `/ocs-provider`), and thus + # `try_files $uri $uri/ /nextcloud/index.php$request_uri` + # always provides the desired behaviour. + index index.php index.html __PATH__/index.php$request_uri; + + # Default Cache-Control policy + expires 1m; + + # Rule borrowed from `.htaccess` to handle Microsoft DAV clients + location = __PATH__/ { + if ( $http_user_agent ~ ^DavClnt ) { + return 302 __PATH__/remote.php/webdav/$is_args$args; + } } location = __PATH__/robots.txt { @@ -71,15 +84,16 @@ location ^~ __PATH__/ { access_log off; } - location ~ ^__PATH__/(?:build|tests|config|lib|3rdparty|templates|data)\/ { - deny all; - } - location ~ ^__PATH__/(?:\.|autotest|occ|issue|indie|db_|console) { - deny all; - } + # Rules borrowed from `.htaccess` to hide certain paths from clients + location ~ ^__PATH__/(?:build|tests|config|lib|3rdparty|templates|data)(?:$|/) { return 404; } + location ~ ^__PATH__/(?:\.|autotest|occ|issue|indie|db_|console) { return 404; } - location ~ ^__PATH__/(?:index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+|.+\/richdocumentscode\/proxy)\.php(?:$|\/) { - fastcgi_split_path_info ^(.+?\.php)(\/.*|)$; + # Ensure this block, which passes PHP files to the PHP process, is above the blocks + # which handle static assets (as seen below). If this block is not declared first, + # 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(?:$|/) { + fastcgi_split_path_info ^(.+?\.php)(/.*)$; set $path_info $fastcgi_path_info; try_files $fastcgi_script_name =404; include fastcgi_params; @@ -87,66 +101,27 @@ location ^~ __PATH__/ { fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_param PATH_INFO $path_info; fastcgi_param HTTPS on; - # Avoid sending the security headers twice - fastcgi_param modHeadersAvailable true; - # Enable pretty urls - fastcgi_param front_controller_active true; + fastcgi_param modHeadersAvailable true; # Avoid sending the security headers twice + fastcgi_param front_controller_active true; # Enable pretty urls fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock; fastcgi_intercept_errors on; fastcgi_request_buffering off; } - location ~ ^__PATH__/(?:updater|oc[ms]-provider)(?:$|\/) { - try_files $uri/ =404; - index index.php; + location ~ \.(?:css|js|svg|gif)$ { + try_files $uri / __PATH__/index.php$request_uri; + expires 6M; # Cache-Control policy borrowed from `.htaccess` + access_log off; # Optional: Don't log access to assets } - location = __PATH__/core/js/oc.js { - rewrite ^ __PATH__/index.php$request_uri; + location ~ \.woff2?$ { + try_files $uri / __PATH__/index.php$request_uri; + expires 7d; # Cache-Control policy borrowed from `.htaccess` + access_log off; # Optional: Don't log access to assets } - location = __PATH__/core/preview.png { - rewrite ^ __PATH__/index.php$request_uri; - } - - location ~* ^__PATH__/(?:css|js)/ { - rewrite ^ __PATH__/index.php$request_uri; - } - - location ~* ^__PATH__/apps/theming/img/core/filetypes/ { - rewrite ^ __PATH__/index.php$request_uri; - } - - location ~* ^__PATH__/apps/documentserver_community/ { - rewrite ^ __PATH__/index.php$request_uri; - } - - location ~* ^__PATH__/apps/riotchat/riot/ { - rewrite ^ __PATH__/index.php$request_uri; - } - - # Adding the cache control header for js, css and map files - location ~ ^__PATH__/.+[^\/]\.(?:css|js|woff2?|svg|gif|map)$ { - try_files $uri __PATH__/index.php$request_uri; - more_set_headers "Cache-Control: public, max-age=15778463"; - # Add headers to serve security related headers - more_set_headers "Strict-Transport-Security: max-age=15768000"; - more_set_headers "X-Content-Type-Options: nosniff"; - more_set_headers "X-XSS-Protection: 1; mode=block"; - more_set_headers "X-Robots-Tag: none"; - more_set_headers "X-Download-Options: noopen"; - more_set_headers "X-Permitted-Cross-Domain-Policies: none"; - more_set_headers "X-Frame-Options: SAMEORIGIN"; - more_set_headers "Referrer-Policy: no-referrer"; - - # Optional: Don't log access to assets - access_log off; - } - - location ~ ^__PATH__/.+[^\/]\.(?:png|html|ttf|ico|jpg|jpeg|bcmap|mp4|webm)$ { - try_files $uri __PATH__/index.php$request_uri; - # Optional: Don't log access to other assets - access_log off; + location ~ / { + try_files $uri / __PATH__/index.php$request_uri; } # show YunoHost panel access From 50ece34da7f88d78452e0ba6326b544e4a5da85b Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 10 Dec 2020 12:48:15 +0100 Subject: [PATCH 193/204] Fix linter --- check_process | 2 -- scripts/install | 2 +- scripts/upgrade | 7 ------- 3 files changed, 1 insertion(+), 10 deletions(-) diff --git a/check_process b/check_process index 0ee0bab..440eb43 100644 --- a/check_process +++ b/check_process @@ -18,8 +18,6 @@ incorrect_path=1 port_already_use=0 change_url=1 -;;; Levels - Level 5=auto ;;; Options Email= Notification=none diff --git a/scripts/install b/scripts/install index 70e89f4..59e590f 100755 --- a/scripts/install +++ b/scripts/install @@ -98,7 +98,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 --package="$extra_php_dependencies" # Used by ynh_add_nginx_config phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) diff --git a/scripts/upgrade b/scripts/upgrade index a88a455..fc701c9 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -125,13 +125,6 @@ then ynh_replace_string "\('datadirectory' =>.*\)$old_app" "\1$app" "$final_path/config/config.php" fi -#================================================= -# CHECK THE PATH -#================================================= - -# Normalize the URL path syntax -path_url=$(ynh_normalize_url_path --path_url=$path_url) - #================================================= # UPGRADE DEPENDENCIES #================================================= From 6c6199d48d596834907597bd03d0f361d90ea154 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 10 Dec 2020 12:51:57 +0100 Subject: [PATCH 194/204] Upgrade to 20.0.3 --- README.md | 2 +- README_fr.md | 2 +- manifest.json | 4 ++-- scripts/upgrade.d/upgrade.last.sh | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index a1eeaef..43a565c 100644 --- a/README.md +++ b/README.md @@ -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. -**Shipped version:** 20.0.2 +**Shipped version:** 20.0.3 ## Screenshots diff --git a/README_fr.md b/README_fr.md index 37b5691..d6665be 100644 --- a/README_fr.md +++ b/README_fr.md @@ -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. Avec NextCloud vous pouvez synchroniser vos fichiers sur vos appareils. -**Version incluse :** 20.0.2 +**Version incluse :** 20.0.3 ## Captures d'écran diff --git a/manifest.json b/manifest.json index f96496f..01b529b 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "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.2~ynh1", + "version": "20.0.3~ynh1", "url": "https://nextcloud.com", "license": "AGPL-3.0", "maintainer": { @@ -14,7 +14,7 @@ "email": "apps@yunohost.org" }, "requirements": { - "yunohost": ">= 3.8.0" + "yunohost": ">= 3.8.1" }, "multi_instance": true, "services": [ diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index 682e66e..433d812 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.2" +next_version="20.0.3" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="be84c2ac7fba066ddc0637a4672b39628bbbd200dad8c00a0437a4765007dd21" +nextcloud_source_sha256="e0f64504d338f64d3c677357f0012cf8b0ed0dc42ec08f958b6dc4ff70edf175" From 00b04039ea802e73a191fbacbd10bde114f255e8 Mon Sep 17 00:00:00 2001 From: Kay0u Date: Mon, 14 Dec 2020 12:28:30 +0100 Subject: [PATCH 195/204] fix 405 error --- conf/nginx.conf | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/conf/nginx.conf b/conf/nginx.conf index d4581c2..e9f864a 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -121,6 +121,12 @@ location ^~ __PATH__/ { } location ~ / { + if ($request_method ~ ^PUT$) { + rewrite ^ __PATH__/index.php$request_uri last; + } + if ($request_method ~ ^DELETE$) { + rewrite ^ __PATH__/index.php$request_uri last; + } try_files $uri / __PATH__/index.php$request_uri; } From ff7c25c12556f445c85a8a153b917657e749c627 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 14 Dec 2020 21:41:44 +0100 Subject: [PATCH 196/204] Upgrade to version 20.0.4 --- README.md | 2 +- README_fr.md | 2 +- manifest.json | 2 +- scripts/upgrade.d/upgrade.last.sh | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 43a565c..6758018 100644 --- a/README.md +++ b/README.md @@ -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. -**Shipped version:** 20.0.3 +**Shipped version:** 20.0.4 ## Screenshots diff --git a/README_fr.md b/README_fr.md index d6665be..82c5b08 100644 --- a/README_fr.md +++ b/README_fr.md @@ -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. Avec NextCloud vous pouvez synchroniser vos fichiers sur vos appareils. -**Version incluse :** 20.0.3 +**Version incluse :** 20.0.4 ## Captures d'écran diff --git a/manifest.json b/manifest.json index 01b529b..5e3ec17 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "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.3~ynh1", + "version": "20.0.4~ynh1", "url": "https://nextcloud.com", "license": "AGPL-3.0", "maintainer": { diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index 433d812..3515c1b 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.3" +# Last available Nextcloud version +next_version="20.0.4" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="e0f64504d338f64d3c677357f0012cf8b0ed0dc42ec08f958b6dc4ff70edf175" +nextcloud_source_sha256="4c2857d328b64d12fe283ec2f7030131ebe6e467dd4a033cf602fd07984a28a3" From 70e7030a37b32e37965472def2ac7e88e3ce225d Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 16 Dec 2020 11:16:00 +0100 Subject: [PATCH 197/204] Add $phpversion --- scripts/install | 2 +- scripts/restore | 2 +- scripts/upgrade | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index 59e590f..70e89f4 100755 --- a/scripts/install +++ b/scripts/install @@ -98,7 +98,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 --package="$extra_php_dependencies" +ynh_add_fpm_config --usage=medium --footprint=high --phpversion=$YNH_PHP_VERSION --package="$extra_php_dependencies" # Used by ynh_add_nginx_config phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) diff --git a/scripts/restore b/scripts/restore index 3cc1584..48fe654 100755 --- a/scripts/restore +++ b/scripts/restore @@ -102,7 +102,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 --package="$extra_php_dependencies" +ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$phpversion --package="$extra_php_dependencies" #================================================= # RESTORE THE CRON FILE diff --git a/scripts/upgrade b/scripts/upgrade index fc701c9..057b9f1 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -148,7 +148,7 @@ ynh_system_user_create --username=$app ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2 # Recreate a dedicated PHP-FPM config -ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --package="$extra_php_dependencies" +ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint --package="$extra_php_dependencies" # Delete existing ini configuration file (backward compatibility) if [ -f /etc/php/$phpversion/fpm/conf.d/20-$app.ini ]; then From dc3590aa78a07d0aa3f776f516d037564e9273d9 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 16 Dec 2020 13:13:57 +0100 Subject: [PATCH 198/204] Fix shasum ... :/ --- scripts/upgrade.d/upgrade.last.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade.d/upgrade.last.sh b/scripts/upgrade.d/upgrade.last.sh index 3515c1b..f4b01b4 100755 --- a/scripts/upgrade.d/upgrade.last.sh +++ b/scripts/upgrade.d/upgrade.last.sh @@ -4,4 +4,4 @@ next_version="20.0.4" # Nextcloud tarball checksum sha256 -nextcloud_source_sha256="4c2857d328b64d12fe283ec2f7030131ebe6e467dd4a033cf602fd07984a28a3" +nextcloud_source_sha256="269f1622e326f5d11e387d3861aad4e2b0e79334ae97eed5a7b3352ba7661420" From f1a848900f23807132efde9749af19f504225598 Mon Sep 17 00:00:00 2001 From: Kay0u Date: Wed, 16 Dec 2020 13:56:15 +0100 Subject: [PATCH 199/204] fix config --- scripts/config | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/config b/scripts/config index 85769fc..0c14bca 100644 --- a/scripts/config +++ b/scripts/config @@ -15,6 +15,8 @@ source /usr/share/yunohost/helpers app=$YNH_APP_INSTANCE_NAME +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) + #================================================= # LOAD VALUES #================================================= @@ -77,7 +79,7 @@ apply_config() { if [ "$fpm_footprint" != "0" ] then - ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint + ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint --package="$extra_php_dependencies" else ynh_print_err --message="When selecting 'specific', you have to set a footprint value into the field below." fi From c835aea17826b0debdbb586cb159a2ddad0b9a95 Mon Sep 17 00:00:00 2001 From: Kay0u Date: Wed, 16 Dec 2020 13:59:58 +0100 Subject: [PATCH 200/204] allow Symlinks --- scripts/install | 3 +++ scripts/upgrade | 3 +++ 2 files changed, 6 insertions(+) diff --git a/scripts/install b/scripts/install index 70e89f4..d9a539a 100755 --- a/scripts/install +++ b/scripts/install @@ -84,6 +84,9 @@ 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 #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 057b9f1..84cbebf 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -270,6 +270,9 @@ 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 From f12db573bfb9a849c2afc63700c70166fd781698 Mon Sep 17 00:00:00 2001 From: Kay0u Date: Wed, 16 Dec 2020 14:08:35 +0100 Subject: [PATCH 201/204] add missing primary keys --- scripts/upgrade | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 84cbebf..cf4cfd8 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -314,8 +314,9 @@ then exec_occ -V done - exec_occ db:add-missing-indices - exec_occ db:add-missing-columns + exec_occ db:add-missing-indices -n + exec_occ db:add-missing-columns -n + exec_occ db:add-missing-primary-keys -n exec_occ db:convert-filecache-bigint -n #================================================= From d01cb9826ab6efd8ba4bd882f58eb40b7b299afe Mon Sep 17 00:00:00 2001 From: Kay0u Date: Wed, 16 Dec 2020 15:38:07 +0100 Subject: [PATCH 202/204] Upgrade php version --- scripts/upgrade | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index cf4cfd8..c85d5fe 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -147,12 +147,23 @@ ynh_system_user_create --username=$app #================================================= ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2 +# If php has changed, remove the old fpm config file +if [ "$phpversion" != $YNH_PHP_VERSION ] +then + ynh_backup_if_checksum_is_different --file="/etc/php/$phpversion/fpm/pool.d/$app.conf" + ynh_secure_remove --file="/etc/php/$phpversion/fpm/pool.d/$app.conf" + ynh_systemd_action --service_name="php${phpversion}-fpm" --action=reload + ynh_secure_remove --file="/etc/php/$phpversion/fpm/conf.d/20-$app.ini" + + phpversion="$YNH_PHP_VERSION" +fi + # Recreate a dedicated PHP-FPM config ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint --package="$extra_php_dependencies" # Delete existing ini configuration file (backward compatibility) if [ -f /etc/php/$phpversion/fpm/conf.d/20-$app.ini ]; then - ynh_secure_remove --file=/etc/php/$phpversion/fpm/conf.d/20-$app.ini + ynh_secure_remove --file=/etc/php/$phpversion/fpm/conf.d/20-$app.ini fi #================================================= From 001a2b6a1a15eddc98346de48f8c10228d0ba122 Mon Sep 17 00:00:00 2001 From: Kay0u Date: Wed, 16 Dec 2020 16:16:34 +0100 Subject: [PATCH 203/204] reload php-fpm --- scripts/upgrade | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index c85d5fe..a1aeb06 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -153,7 +153,9 @@ then ynh_backup_if_checksum_is_different --file="/etc/php/$phpversion/fpm/pool.d/$app.conf" ynh_secure_remove --file="/etc/php/$phpversion/fpm/pool.d/$app.conf" ynh_systemd_action --service_name="php${phpversion}-fpm" --action=reload - ynh_secure_remove --file="/etc/php/$phpversion/fpm/conf.d/20-$app.ini" + if [ -f /etc/php/$phpversion/fpm/conf.d/20-$app.ini ]; then + ynh_secure_remove --file="/etc/php/$phpversion/fpm/conf.d/20-$app.ini" + fi phpversion="$YNH_PHP_VERSION" fi @@ -478,9 +480,10 @@ ynh_app_setting_set --app=$app --key=skipped_regex \ #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." +ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." ynh_systemd_action --service_name=nginx --action=reload +ynh_systemd_action --service_name="php${phpversion}-fpm" --action=reload #================================================= # FINISH MIGRATION PROCESS From 9f056198d512447502acdf94ea20d8721cf0fbb1 Mon Sep 17 00:00:00 2001 From: Kayou Date: Thu, 17 Dec 2020 12:00:56 +0100 Subject: [PATCH 204/204] Apply suggestions from code review --- scripts/upgrade | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index a1aeb06..8c07855 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -152,11 +152,11 @@ if [ "$phpversion" != $YNH_PHP_VERSION ] then ynh_backup_if_checksum_is_different --file="/etc/php/$phpversion/fpm/pool.d/$app.conf" ynh_secure_remove --file="/etc/php/$phpversion/fpm/pool.d/$app.conf" - ynh_systemd_action --service_name="php${phpversion}-fpm" --action=reload if [ -f /etc/php/$phpversion/fpm/conf.d/20-$app.ini ]; then ynh_secure_remove --file="/etc/php/$phpversion/fpm/conf.d/20-$app.ini" fi - + ynh_systemd_action --service_name="php${phpversion}-fpm" --action=reload + phpversion="$YNH_PHP_VERSION" fi