[arch-commits] Commit in nextcloud/trunk (7 files)
David Runge
dvzrv at archlinux.org
Fri Feb 19 22:57:41 UTC 2021
Date: Friday, February 19, 2021 @ 22:57:41
Author: dvzrv
Revision: 866434
Add update for 21.0.0.
Switch to more correct license (AGPL3).
Add all documented optdepends and explain what they are used for.
Add uwsgi integration (also in backup array).
Add config (based on sample config) to backup array.
Patch occ to use php7 in prepare(): https://bugs.archlinux.org/task/69464
Add convenience wrapper around occ command (overridable php, php config and user).
Add sysusers.d and tmpfiles.d integration and rely on own user (nextcloud) instead of http.
Create default state, log and runtime dirs to be align with web application
packaging guidelines.
Install alpm-hook to /usr/share/doc/nextcloud, so that it can be symlinked
to /etc/pacman/hooks.d/ if the user chooses so: https://bugs.archlinux.org/task/66990
Install configuration to /etc/webapps/nextcloud/config.php to not require
setting so many custom file/directory modes.
Install apache example config to /usr/share/doc/nextcloud as web server config
is hard to do generic and is very use-case specific.
Install web application files using find.
Add an .install file, that notifies the user about the changes.
Update maintainer info.
Added:
nextcloud/trunk/nextcloud.install
nextcloud/trunk/nextcloud.occ.sh
nextcloud/trunk/nextcloud.sysusers
nextcloud/trunk/nextcloud.tmpfiles
nextcloud/trunk/nextcloud.uwsgi
Modified:
nextcloud/trunk/PKGBUILD
nextcloud/trunk/nextcloud.hook
--------------------+
PKGBUILD | 174 ++++++++++++++++++++++++++++++++++++++-------------
nextcloud.hook | 2
nextcloud.install | 11 +++
nextcloud.occ.sh | 41 ++++++++++++
nextcloud.sysusers | 1
nextcloud.tmpfiles | 6 +
nextcloud.uwsgi | 65 +++++++++++++++++++
7 files changed, 255 insertions(+), 45 deletions(-)
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2021-02-19 22:53:11 UTC (rev 866433)
+++ PKGBUILD 2021-02-19 22:57:41 UTC (rev 866434)
@@ -1,57 +1,143 @@
# Maintainer: Sergej Pupykin <pupykin.s+arch at gmail.com>
+# Maintainer: David Runge <dvzrv at archlinux.org>
pkgname=nextcloud
-pkgver=20.0.7
+pkgver=21.0.0
pkgrel=1
pkgdesc="A cloud server to store your files centrally on a hardware controlled by you"
arch=('any')
url="https://nextcloud.com"
-license=('AGPL')
-depends=()
-optdepends=('php7-apache: to use the Apache web server'
- 'php7-sqlite: to use the SQLite database backend'
- 'php7-pgsql: to use the PostgreSQL database backend'
- 'php7-ldap: LDAP authentication'
- 'php7-intl'
- 'php7-apcu'
- 'mariadb: to use the MySQL database backend'
- 'smbclient: to mount SAMBA shares'
- 'ffmpeg: file preview'
- 'libreoffice: file preview')
-options=('!strip')
-backup=('etc/webapps/nextcloud/apache.example.conf'
- 'etc/webapps/nextcloud/config/config.php')
-validpgpkeys=('28806A878AE423A28372792ED75899B9A724937A')
-source=("https://download.nextcloud.com/server/releases/nextcloud-${pkgver}.tar.bz2"{,.asc}
- 'apache.example.conf'
- 'nextcloud.hook')
-sha256sums=('8ced82b772bf0af67d5be1323e40f977429bc0a2bcc864095efc78767500b72b'
+license=('AGPL3')
+depends=('php7>=7.4.0' 'php7<7.5.0' 'php7-gd')
+optdepends=(
+ 'ffmpeg: for preview generation'
+ 'mariadb: to use a local MariaDB server'
+ 'memcached: to use a local memcached server'
+ 'php7-apcu: for caching with APCU'
+ 'php7-apache: to use the Apache web server'
+ 'php7-fpm: to run in fastCGI process manager'
+ 'php7-imagick: for preview generation'
+ 'php7-imap: for external user authentication'
+ 'php7-intl: to increase language translation performance and fix sorting'
+ 'php7-ldap: for LDAP authentication'
+ 'php7-memcached: for caching with memcached'
+ 'php7-pgsql: to use the PostgreSQL database backend'
+ 'php7-redis: for caching with redis'
+ 'php7-sqlite: to use the SQLite database backend'
+ 'postgresql: to use a local PostgreSQL server'
+ 'redis: to use a local Redis server'
+ 'smbclient: for SMB/CIFS integration'
+ 'sudo: for occ command'
+ 'libreoffice: for preview generation'
+ 'uwsgi: run as application container'
+)
+backup=(
+ "etc/webapps/${pkgname}/config.php"
+ "etc/uwsgi/${pkgname}.ini"
+)
+# there are no elf files, no need to strip anything
+options=(!strip)
+install="${pkgname}.install"
+source=(
+ "https://download.nextcloud.com/server/releases/nextcloud-${pkgver}.tar.bz2"{,.asc}
+ 'apache.example.conf'
+ "${pkgname}.hook"
+ "${pkgname}.occ.sh"
+ "${pkgname}.sysusers"
+ "${pkgname}.tmpfiles"
+ "${pkgname}.uwsgi"
+)
+sha512sums=('a1ae3400f0fb5997e54b0cee821c50d13e4ba0e27c9d11731c8b5233cba564666121a58aed848ccd2593a9783e27db1ed98ff559588a76a1acaeaf083ef4404a'
'SKIP'
- '30a8ad62b0dc9523ca7f0387b1f0483d196c1e011ec7e3a5b98e7d33c721d4bf'
- 'b8794c6b357c762f6d4e6f099d8073bd465d6cd87d6d07341568d9509720e6e8')
+ '6f9f284d78d414a3bb7c159a812b105e31e8cd2393afee44465701e6f18169709f6d492d790e403e1e66f308c51b6b6496d29ddce29e4fac2c73a3c84a10c7fe'
+ '76754f2facddaca388a9cfe302850e3265bfeee55c5942d830a1bfd9a3ce303eb6e585ec93e372c9aabfe50f75f06912a88426d80e1b7808c73a18ffde52643f'
+ '8a0cd48b39566ab94b5bf5989c630c2c7e4abe89cad89e5f8e85d3355b5e059f4a1ff1b4600a3c974f3b0bed33fa14831182517fd4b9fb5983c52396d3ab3588'
+ '1d06f339c43d57e5f5406c2698b815241fd9e39039a9e55f777face510c9a5ddae5ccd4e051393e8f16f391301a6aa03fff2462837a2d3441d969ea7195e7d84'
+ '4f951e7cad06940d983035c3dc51531bbbcbc0c74296af63f2fab1705b413f340ff67300506377fade0ed7ddecee8552b3da028711751c120f1fad4b1c33e8d5'
+ 'a3ebcabcdb8c2d2653f44a248abd213bc4dbb317766b82c8f3e93b31e72ace350d7e8037bd4e22a632ab33f739e1941467b0e9d2cf7d0a7433227b4169030051')
+b2sums=('7c583c150f6b315830191329310993582439e7aef57f306b93681d654b8fa7d4d5dafee082befd493aafd2bf6efd940d52ca0ca05b8e42b79a1599ff3e809550'
+ 'SKIP'
+ 'a7e1aa1d8cb2b0ff7832bb7d6d857987733253317c0f3727e744502aeaa3b2008351b47ecc24e348fe7b252cefaffe2418797523ee288dfd55e128917e8fbe2c'
+ '0776acc402b4f6a913ab904bf9721fdb927f37410f599afb6b77411243e6d5db4f3037adb1d90f7d3be2ebdc005f4abcb00819267249c99a30f19a7501aa57f6'
+ '30b1d70346aa5be9eb37d4b4dcf8813b758a95e3eecddca99571aeac0ba3fa28f695f41abdb766053231533f0e4cffc80d1843e71825c7ee38af5d1236dc2a70'
+ '1a61a89531636b65dade03cd7edca8747b3e1e880f9bbd4d5a53cffa452d70fe17e345cfed739ae92e99e336d4c1f2633c84a5c84a4ee6da518762bf1396b1db'
+ 'a644617d2b42ab357da546a5c9e3182fa9d2d8ae36ee77b24a04ed036e837212c9cbbd2f40d6e0c6f075a38aa58c7a8c01807ff820c9ee4f6556c661be81e0cb'
+ 'd3c66e22c3cc1b8de1c0b60cd32701080d599dc9853af41d9d9d493ffe3a8d9a2573455d80dd0de019dfe9992187cb23b9df90c18f0ca5962912566014c6779c')
+validpgpkeys=('28806A878AE423A28372792ED75899B9A724937A') # Nextcloud Security <security at nextcloud.com>
+prepare() {
+ mv -v "${pkgname}" "${pkgname}-${pkgver}"
+ cd "${pkgname}-${pkgver}"
+ # set shebang for executable
+ sed -e 's/env php/env php7/' -i occ
+}
+
package() {
- depends=('php7>=7.4.0' 'php7<7.5.0' 'php7-gd')
+ cd "${pkgname}-${pkgver}"
+ # sysusers.d integration
+ install -vDm 644 ../${pkgname}.sysusers \
+ "${pkgdir}/usr/lib/sysusers.d/${pkgname}.conf"
+ # tmpfiles.d integration
+ install -vDm 644 ../${pkgname}.tmpfiles \
+ "${pkgdir}/usr/lib/tmpfiles.d/${pkgname}.conf"
+ # state dir for data and writable apps
+ install -vdm 750 "${pkgdir}/var/lib/${pkgname}/"
+ install -vdm 755 "${pkgdir}/var/lib/${pkgname}/"{apps,data}
+ # log dir
+ install -vdm 750 "${pkgdir}/var/log/${pkgname}/"
+ # uwsgi integration
+ install -vDm 644 "../${pkgname}.uwsgi" "${pkgdir}/etc/uwsgi/${pkgname}.ini"
+ # config
+ install -vDm 640 config/config.sample.php "${pkgdir}/etc/webapps/${pkgname}/config.php"
+ # occ script
+ install -vDm 755 "../${pkgname}.occ.sh" "${pkgdir}/usr/bin/occ"
+ # optional pacman hook
+ install -vDm 644 "../${pkgname}.hook" -t "${pkgdir}/usr/share/doc/${pkgname}/"
- # install project
- install -d "$pkgdir"/usr/share/webapps/
- cp -R "$srcdir"/${pkgname} "$pkgdir"/usr/share/webapps/.
+ # webapp
+ find . -type f \( \
+ -iname "*.php" \
+ -or -iname "*.bcmap" \
+ -or -iname "*.crl" \
+ -or -iname "*.crt" \
+ -or -iname "*.css" \
+ -or -iname "*.dist" \
+ -or -iname "*.docx" \
+ -or -iname "*.handlebars" \
+ -or -iname "*.gif" \
+ -or -iname "*.ico" \
+ -or -iname "*.ini" \
+ -or -iname "*.jpg" \
+ -or -iname "*.js" \
+ -or -iname "*.json" \
+ -or -iname "*.lock" \
+ -or -iname "*.map" \
+ -or -iname "*.md" \
+ -or -iname "*.odp" \
+ -or -iname "*.ods" \
+ -or -iname "*.odt" \
+ -or -iname "*.pdf" \
+ -or -iname "*.png" \
+ -or -iname "*.properties" \
+ -or -iname "*.scss" \
+ -or -iname "*.svg" \
+ -or -iname "*.ttf" \
+ -or -iname "*.txt" \
+ -or -iname "*.whiteboard" \
+ -or -iname "*.woff" \
+ -or -iname "*.yml" \
+ -or -iname "*.xml" \
+ -or -iname "*.xsd" \
+ -or -iname "*COPYING*" \
+ -or -iname "*LICENSE*" \
+ -or -iname "*CAN_INSTALL" \
+ -or -iname "*.htaccess" \
+ \) -exec install -vDm 644 {} "${pkgdir}/usr/share/webapps/${pkgname}/"{} \;
- # install apache config file
- install -d "$pkgdir"/etc/webapps/${pkgname}
- install -m 644 "$srcdir"/apache.example.conf "$pkgdir"/etc/webapps/${pkgname}
-
- # move config to /etc
- install -d "$pkgdir"/etc/webapps/${pkgname}
- mv "$pkgdir"/usr/share/webapps/${pkgname}/config "$pkgdir"/etc/webapps/${pkgname}/config
- chown -R 33:33 "$pkgdir"/etc/webapps/${pkgname}
- ln -s /etc/webapps/${pkgname}/config "$pkgdir"/usr/share/webapps/${pkgname}/config
- chown -R root:33 "$pkgdir"/usr/share/webapps/${pkgname}
-
- find "$pkgdir"/usr/share/webapps/${pkgname} -type f -exec chmod 0644 {} \;
- find "$pkgdir"/usr/share/webapps/${pkgname} -type d -exec chmod 0755 {} \;
-
- chmod a+x "$pkgdir"/usr/share/webapps/${pkgname}/occ
-
-# install -Dm0644 "$srcdir"/nextcloud.hook "$pkgdir"/usr/share/libalpm/hooks/nextcloud.hook
+ # config symlink
+ ln -sv "/etc/webapps/${pkgname}/config.php" "${pkgdir}/usr/share/webapps/${pkgname}/config/config.php"
+ # occ
+ install -vDm 755 occ -t "${pkgdir}/usr/share/doc/webapps/${pkgname}"
+ # apache example conf
+ install -vDm 644 ../apache.example.conf -t "${pkgdir}/usr/share/doc/${pkgname}/"
}
Modified: nextcloud.hook
===================================================================
--- nextcloud.hook 2021-02-19 22:53:11 UTC (rev 866433)
+++ nextcloud.hook 2021-02-19 22:57:41 UTC (rev 866434)
@@ -10,4 +10,4 @@
[Action]
Description = Updating Nextcloud installation
When = PostTransaction
-Exec = /usr/bin/runuser -u http -- /usr/bin/php7 /usr/share/webapps/nextcloud/occ upgrade
+Exec = /usr/bin/runuser -u nextcloud -- /usr/bin/php7 /usr/share/webapps/nextcloud/occ upgrade
Added: nextcloud.install
===================================================================
--- nextcloud.install (rev 0)
+++ nextcloud.install 2021-02-19 22:57:41 UTC (rev 866434)
@@ -0,0 +1,11 @@
+# arg 1: the new package version
+# arg 2: the old package version
+post_upgrade() {
+ if [ "$(vercmp "$2" 21.0.0)" -le 0 ]; then
+ printf "WARNING: Major changes introduced to package!\n"
+ printf " The application is now run as its own user - nextcloud.\n"
+ printf " Default directories for runtime, state and log files are provided.\n"
+ printf " The configuration file is now in /etc/webapps/nextcloud/config.php.\n"
+ printf " A convenience wrapper around occ is provided in /usr/bin/occ.\n"
+ fi
+}
Added: nextcloud.occ.sh
===================================================================
--- nextcloud.occ.sh (rev 0)
+++ nextcloud.occ.sh 2021-02-19 22:57:41 UTC (rev 866434)
@@ -0,0 +1,41 @@
+#!/usr/bin/env bash
+
+readonly default_config="/etc/php7/php.ini"
+readonly default_php_command="/usr/bin/php7"
+readonly default_user="nextcloud"
+
+config=""
+php_command=""
+user=""
+
+check_sudo() {
+ if ! command -v sudo > /dev/null; then
+ printf "The sudo command is not available.\n"
+ exit 1
+ fi
+}
+
+check_sudo
+
+# allow overriding the php.ini
+if [[ -n "${PHP_CONFIG}" ]] && [[ -f "${PHP_CONFIG}" ]]; then
+ config="${PHP_CONFIG}"
+else
+ config="${default_config}"
+fi
+
+# allow overriding the php executable
+if [[ -n "${PHP}" ]] && command -v "${PHP}" > /dev/null; then
+ php_command="${PHP}"
+else
+ php_command="${default_php_command}"
+fi
+
+# allow overriding the user to run as
+if [[ -n "${USER}" ]]; then
+ user="${USER}"
+else
+ user="${default_user}"
+fi
+
+sudo -u "${user}" "$php_command" -c "${config}" /usr/share/webapps/nextcloud/occ "$@"
Added: nextcloud.sysusers
===================================================================
--- nextcloud.sysusers (rev 0)
+++ nextcloud.sysusers 2021-02-19 22:57:41 UTC (rev 866434)
@@ -0,0 +1 @@
+u nextcloud - "Nextcloud user" - -
Added: nextcloud.tmpfiles
===================================================================
--- nextcloud.tmpfiles (rev 0)
+++ nextcloud.tmpfiles 2021-02-19 22:57:41 UTC (rev 866434)
@@ -0,0 +1,6 @@
+z /etc/webapps/nextcloud/ 0755 root root
+z /etc/webapps/nextcloud/*.php 0640 nextcloud nextcloud
+Z %C/nextcloud - nextcloud nextcloud
+d %t/nextcloud 0755 nextcloud nextcloud
+z %L/nextcloud 0750 nextcloud nextcloud
+z %S/nextcloud 0750 nextcloud nextcloud
Added: nextcloud.uwsgi
===================================================================
--- nextcloud.uwsgi (rev 0)
+++ nextcloud.uwsgi 2021-02-19 22:57:41 UTC (rev 866434)
@@ -0,0 +1,65 @@
+[uwsgi]
+procname-master = %n
+plugins = php
+master = true
+socket = /run/uwsgi/%n.sock
+stats = /run/uwsgi/%n-stats.sock
+uid = nextcloud
+gid = nextcloud
+processes = 10
+cheaper = 4
+cheaper-step = 1
+idle = 600
+die-on-idle = true
+
+; reload whenever this config file changes
+touch-reload = %p
+
+cloud_data_dir = /var/lib/nextcloud/data
+cloud_writable_apps_dir = /var/lib/nextcloud/apps
+chdir = %(cloud_data_dir)
+
+php-allowed-ext = .php
+php-docroot = /usr/share/webapps/%n
+php-index = index.php
+php-set = date.timezone=Europe/Berlin
+php-set = open_basedir=%(cloud_data_dir):%(cloud_writable_apps_dir):/tmp/:/usr/share/webapps/%n:/etc/webapps/%n:/dev/urandom:/usr/lib/php/modules:/run/redis/redis.sock:/var/log/%n.log:/proc/meminfo
+php-set = session.save_path=/tmp
+php-set = session.gc_maxlifetime 21600
+php-set = session.gc_divisor 500
+php-set = session.gc_probability 1
+php-set = post_max_size=1000M
+php-set = upload_max_filesize=1000M
+php-set = always_populate_raw_post_data=-1
+php-set = max_input_time=120
+php-set = max_execution_time=60
+php-set = memory_limit=768M
+php-set = zend_extension=opcache
+php-set = opcache.enable=1
+php-set = opcache.enable_cli=1
+php-set = opcache.interned_strings_buffer=8
+php-set = opcache.max_accelerated_files=10000
+php-set = opcache.memory_consumption=128
+php-set = opcache.save_comments=1
+php-set = opcache.revalidate_freq=1
+
+php-set = extension=intl
+php-set = extension=apcu
+php-set = extension=bcmath
+php-set = extension=bz2
+php-set = extension=curl
+php-set = extension=exif
+php-set = extension=gd
+php-set = extension=imagick
+php-set = extension=gmp
+php-set = extension=iconv
+php-set = extension=pdo_mysql
+php-set = extension=igbinary
+php-set = extension=redis
+php-set = extension=sockets
+php-set = extension=xmlrpc
+php-set = extension=xsl
+php-set = extension=zip
+
+# change the URL to your own address to run a cron job every five minutes
+cron = -5 -1 -1 -1 -1 curl --silent https://change.me.tld/cron.php 1>/dev/null
More information about the arch-commits
mailing list