nextcloud/nextcloud.spec
Eric Schirra cb81b80518 Accepting request 903602 from home:ecsos:server
- Update to 21.0.3
  - Don't break OCC if an app is breaking in it's Application class (server#26879)
  - Bump handlebars from 4.7.6 to 4.7.7 (server#26905)
  - Bump url-parse from 1.4.7 to 1.5.1 (server#26911)
  - Bump lodash from 4.17.20 to 4.17.21 (server#26912)
  - Bump hosted-git-info from 2.8.8 to 2.8.9 (server#26918)
  - Fix occ command user:add-app-password (server#26952)
  - Add bruteforce protection to the shareinfo endpoint (server#26955)
  - Ignore readonly flag for directories (server#26964)
  - Throttle MountPublicLinkController when share is not found (server#26972)
  - Respect default share permissions for federated reshares (server#26999)
  - Harden apptoken check (server#27012)
  - Use parent wrapper to properly handle moves on the same source/target 
    storage (server#27015)
  - Fix log error when creating files from an empty template (server#27021)
  - Fix error when using CORS with no auth credentials (server#27028)
  - Fix filesize error on log rotation, if file does not exist (server#27058)
  - Avoid reading ~/.aws/config when using S3 provider (server#27097)
  - Fix return value of getStorageInfo when 'quota_include_external_storage'
    is enabled (server#27107)
  - Move remnants of ocs api requests to v2 endpoint (server#27109)
  - Add DB exception '@throws' tag to QBMapper PHPDoc (server#27121)
  - Improve type handling of Avatar::generateAvatarFromSvg (server#27124)
  - Bump patch dependencies (server#27184)
  - Fix the get editable fields endpoint without a user id (server#27195)
  - Use noreply@ as email address for share emails (server#27208)
  - Bump vue-loader from 15.9.6 to 15.9.7 (server#27231)
  - Bump moment-timezone from 0.5.32 to 0.5.33 (server#27237)
  - Bump browserslist from 4.16.0 to 4.16.6 (server#27248)
  - Bump ws from 7.3.1 to 7.4.6 (server#27250)
  - Properly use limit and offset for search in Jail wrapper (server#27303)
  - Make user:report command scale (server#27318)
  - Properly log expiration date removal in audit log (server#27324)
  - Emit UserLoggedInEvent on apache auth (server#27333)
  - Don't allow executing cli if cache backend is unavailable (server#27334)
  - Propagate throttling on OCS response (server#27336)
  - Replace OCSController with OCP\API (server#27346)
  - Don't throw when comments is disabled (server#27347)
  - Set umask before operations that create local files (server#27350)
  - Escape filename in Content-Disposition (server#27359)
  - Don't update statuses to offline again and again (server#27411)
  - Fix some php 8 warnings (server#27415)
  - Don't pass a column object to addOrderBy (server#27446)
  - Header must contain a colon (server#27455)
  - Only allow removing existing shares that would not be allowed due
    to reshare restrictions (server#27551)
  - Bump postcss from 7.0.35 to 7.0.36 (server#27569)
  - Properly cleanup entries of WebAuthn on user deletion (server#27599)
  - Throttle on public DAV endpoint (server#27616)
  - Bump dompurify from 2.2.8 to 2.2.9 (server#27622)
  - Unshift crash reports when they are loaded, to break the recusion (server#27670)
  - Validate the theming color also on CLI (server#27679)
  - LDAP: determine shares of offline users only when needed (server#27703)
  - Downstream encryption:fix-encrypted-version for repairing
   "bad signature" errors (server#27727)
  - Remove encodeURI code (files_pdfviewer#397)
  - Disable content copy for PDF files that specify it (files_pdfviewer#417)
  - Update openssl for PHP 8.0 (nextcloud_announcements#78)
  - Only ask for permissions on HTTPS (notifications#997)
  - Fix sorting if one of the file name is only composed with number (photos#784)
  - Update File.vue (photos#812)
  - Hide free space if it can't be calculated (serverinfo#295)
  - Update chart.js (serverinfo#308)
  - Only return workspace property for top node in a propfind request (text#1610)
  - Use text/plain as content type for fetching the document (text#1691)
  - Log exceptions that happen on unknown exception and return
    generic messages (text#1697)
  - Try enabling apcu on cli for cypress (text#1700)
  - Add fixup (viewer#923)
  - Fix: fullscreen for Firefox (viewer#928)
  - Use physical pixel size for preview resolution (viewer#937)

OBS-URL: https://build.opensuse.org/request/show/903602
OBS-URL: https://build.opensuse.org/package/show/server:php:applications/nextcloud?expand=0&rev=150
2021-07-02 03:21:55 +00:00

336 lines
11 KiB
RPMSpec

#
# spec file for package nextcloud
#
# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
#
%if 0%{?suse_version}
%define apache_myserverroot %{apache_serverroot}/htdocs
%define apache_confdir %{apache_sysconfdir}/conf.d
%define apache_docdir /usr/share/doc/packages
%else
%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version}
%define apache_serverroot /var/www/html
%define apache_confdir /etc/httpd/conf.d
%define apache_user apache
%define apache_group apache
%define __jar_repack 0
%else
%define apache_serverroot /var/www
%define apache_confdir /etc/httpd/conf.d
%define apache_user www
%define apache_group www
%endif
%endif
%define nc_user %{apache_user}
%define nc_dir %{apache_myserverroot}/%{name}
%define ocphp_bin /usr/bin
%if 0%{?rhel} == 600 || 0%{?rhel_version} == 600 || 0%{?centos_version} == 600
%define statedir /var/run
%else
%define statedir /run
%endif
Name: nextcloud
Version: 21.0.3
Release: 0
Summary: File hosting service
License: AGPL-3.0-only
Group: Productivity/Networking/Web/Utilities
URL: https://nextcloud.com
Source0: https://download.nextcloud.com/server/releases/%{name}-%{version}.tar.bz2
Source1: apache_secure_data
Source2: README
Source3: README.SELinux
Source4: README.SUSE
Source5: robots.txt
Source10: %{name}-cron
Source11: %{name}-cron.service
Source12: %{name}-cron.timer
Source99: %{name}-rpmlintrc
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
BuildRequires: apache-rpm-macros
BuildRequires: cron
BuildRequires: fdupes
BuildRequires: unzip
#
Requires: cron
Requires: curl
Requires: libxml2-2
Requires: mariadb >= 10.2
Requires: php-bz2
Requires: php-dom
Requires: php-gd
Requires: php-intl
Requires: php-json
Requires: php-mbstring
Requires: php-mysql
Requires: php-posix
Requires: php-zip
#
%if 0%{?fedora_version} || 0%{?rhel} || 0%{?rhel_version} || 0%{?centos_version}
Requires: php < 8.1.0
Requires: php >= 7.3.0
Requires: php-process
Requires: php-xml
Recommends: sqlite
%endif
#
%if 0%{?suse_version}
Requires: php-ctype
Requires: php-curl
# SUSE does not include the fileinfo module in php-common.
Requires: php-fileinfo
Requires: php-iconv
Requires: php-openssl
Requires: php-pear
Requires: php-xmlreader
Requires: php-xmlwriter
Requires: php-zip
Requires: php-zlib
Recommends: sqlite3
%{?systemd_requires}
%endif
# Database connectors:
Recommends: php-sqlite
#Recommends: php-pgsql
# Require for specific apps:
Requires: php-ftp
Requires: php-ldap
#Requires: php-imap
#Requires: php-smbclient
# Recommend for specific apps:
Recommends: php-exif
Recommends: php-gmp
# For enhanced server performance:
Recommends: php-APCu
Recommends: php7-bcmath
# For preview generation:
Recommends: php-imagick
Recommends: php-ffmpeg
#Recommends: libreoffice
# For command line processing:
Recommends: php-pcntl
%description
Nextcloud is a suite of client-server software for creating file
hosting services and using them.
%package apache
Summary: Apache configuration for %{name}
Group: Productivity/Networking/Web/Utilities
BuildRequires: apache2 >= 2.4
Requires: %{name} = %{version}
Requires: apache2
Requires: mod_php_any < 7.5.0
Requires: mod_php_any >= 7.3.0
Supplements: packageand(apache2:%name)
%description apache
This subpackage contains the Apache configuration files
%prep
%setup -q -n %{name}
cp %{SOURCE2} .
cp %{SOURCE3} .
cp %{SOURCE4} .
cp %{SOURCE5} .
### Don't remove git files!!
### git files should not be removed, otherwise nextcloud rise up integrity check failure in some situations.
###
## delete unneeded gitfiles
#rm -r `find . -name ".gitignore" -or -name ".gitkeep" -or -name ".github"`
## remove entries in signature.json to prevent integrity check failure
#find . -iname signature.json \
# -exec sed -i "/\/.gitignore\": ./d" "{}" \; \
# -exec sed -i "/\/.gitkeep\": ./d" "{}" \; \
# -exec sed -i "/\/.github\": ./d" "{}" \;
#rm -f 3rdparty/symfony/debug/Resources/ext/*.{c,h}
%build
%install
# no server side java code contained, alarm is false
idir=$RPM_BUILD_ROOT/%{apache_myserverroot}/%{name}
mkdir -p $idir
mkdir -p $idir/data
mkdir -p $idir/search
cp -aRf * $idir
cp -aRf .htaccess $idir
cp -aRf .user.ini $idir
# $idir/l10n to disappear in future
#rm -f $idir/l10n/l10n.pl
if [ ! -f $idir/robots.txt ]; then
install -p -D -m 644 %{SOURCE5} $idir/robots.txt
fi
# create the AllowOverride directive
install -p -D -m 644 %{SOURCE1} $RPM_BUILD_ROOT/%{apache_confdir}/nextcloud.conf
ocpath="%{apache_myserverroot}/%{name}"
sed -i -e"s|@DATAPATH@|${ocpath}|g" $RPM_BUILD_ROOT/%{apache_confdir}/nextcloud.conf
# not needed for distro packages
rm -f ${idir}/indie.json
%if 0%{?suse_version}
# link duplicate doc files
%fdupes -s $RPM_BUILD_ROOT/%{apache_myserverroot}/%{name}
%endif
# CronJob
install -d -m 0755 %{buildroot}%{_sysconfdir}/cron.d
install -D -m 0644 %{SOURCE10} %{buildroot}%{_sysconfdir}/cron.d/%{name}
install -D -m 0644 %{SOURCE11} %{buildroot}%{_unitdir}/%{name}-cron.service
install -D -m 0644 %{SOURCE12} %{buildroot}%{_unitdir}/%{name}-cron.timer
sed -i -e"s|@APACHE_USER@|%{apache_user}|g" %{buildroot}%{_sysconfdir}/cron.d/%{name}
sed -i -e"s|@APACHE_MYSERVERROOT@|%{apache_myserverroot}|g" %{buildroot}%{_sysconfdir}/cron.d/%{name}
sed -i -e"s|@APACHE_USER@|%{apache_user}|g" %{buildroot}%{_unitdir}/%{name}-cron.service
sed -i -e"s|@APACHE_MYSERVERROOT@|%{apache_myserverroot}|g" %{buildroot}%{_unitdir}/%{name}-cron.service
mkdir -p %{buildroot}%{_sbindir}
ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-cron
%pre
%service_add_pre %{name}-cron.timer %{name}-cron.service
# avoid fatal php errors, while we are changing files
# https://github.com/nextcloud
#
# We don't do this for new installs. Only for updates.
# If the first argument to pre is 1, the RPM operation is an initial installation. If the argument is 2,
# the operation is an upgrade from an existing version to a new one.
if [ $1 -gt 1 -a ! -s %{statedir}/apache_stopped_during_nextcloud_install ]; then
echo "%{name} update: Checking for running Apache"
# FIXME: this above should make it idempotent -- a requirement with openSUSE.
# it does not work.
%if 0%{?suse_version} && 0
%if 0%{?suse_version} <= 1110
rcapache2 status | grep running > %{statedir}/apache_stopped_during_nextcloud_install
rcapache2 stop
%else
service apache2 status | grep running > %{statedir}/apache_stopped_during_nextcloud_install
service apache2 stop
%endif
%endif
%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version}
service httpd status | grep running > %{statedir}/apache_stopped_during_nextcloud_install
service httpd stop
%endif
fi
if [ -s %{statedir}/apache_stopped_during_nextcloud_install ]; then
echo "%{name} pre-install: Stopping Apache"
fi
if [ $1 -eq 1 ]; then
echo "%{name}-server: First install starting"
else
echo "%{name}-server: Upgrade starting ..."
fi
# https://github.com/nextcloud
if [ -x %{ocphp_bin}/php -a -f %{nc_dir}/occ ]; then
echo "%{name}: occ maintenance:mode --on"
su %{nc_user} -s /bin/sh -c "cd %{nc_dir}; PATH=%{ocphp_bin}:$PATH php ./occ maintenance:mode --on" || true
echo yes > %{statedir}/occ_maintenance_mode_during_nextcloud_install
fi
%post
%service_add_post %{name}-cron.timer %{name}-cron.service
if [ $1 -eq 1 ]; then
%if 0%{?suse_version}
%if 0%{?suse_version} >= 1500
a2enmod php7
%else
a2enmod php5
%endif
%endif
fi
if [ -s %{statedir}/apache_stopped_during_nextcloud_install ]; then
echo "%{name} post-install: Restarting Apache"
## If we stopped apache in pre section, we now should restart. -- but *ONLY* then!
## Maybe delegate that task to occ upgrade? They also need to handle this, somehow.
%if 0%{?suse_version}
%if 0%{?suse_version} <= 1310
rcapache2 start
%else
rcapache2 restart apache2.service
%endif
%endif
%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version}
service httpd start
%endif
fi
if [ -s %{statedir}/occ_maintenance_mode_during_nextcloud_install ]; then
echo "%{name}: occ maintenance:repair (fix possible errors)"
su %{nc_user} -s /bin/sh -c "cd %{nc_dir}; PATH=%{ocphp_bin}:$PATH php ./occ maintenance:repair" || true
echo "%{name}: occ db:add-missing-* (add missing db things)"
su %{nc_user} -s /bin/sh -c "cd %{nc_dir}; PATH=%{ocphp_bin}:$PATH php ./occ maintenance:mimetype:update-db" || true
su %{nc_user} -s /bin/sh -c "cd %{nc_dir}; PATH=%{ocphp_bin}:$PATH php ./occ db:add-missing-columns" || true
su %{nc_user} -s /bin/sh -c "cd %{nc_dir}; PATH=%{ocphp_bin}:$PATH php ./occ db:add-missing-indices" || true
su %{nc_user} -s /bin/sh -c "cd %{nc_dir}; PATH=%{ocphp_bin}:$PATH php ./occ db:add-missing-primary-keys" || true
echo "%{name}: occ update apps"
su %{nc_user} -s /bin/sh -c "cd %{nc_dir}; PATH=%{ocphp_bin}:$PATH php ./occ app:update --all" || true
echo "%{name}: occ upgrade"
su %{nc_user} -s /bin/sh -c "cd %{nc_dir}; PATH=%{ocphp_bin}:$PATH php ./occ upgrade" || true
echo "%{name}: occ maintenance:mode --off"
su %{nc_user} -s /bin/sh -c "cd %{nc_dir}; PATH=%{ocphp_bin}:$PATH php ./occ maintenance:mode --off" || true
fi
rm -f %{statedir}/apache_stopped_during_nextcloud_install
rm -f %{statedir}/occ_maintenance_mode_during_nextcloud_install
if [ $1 -eq 1 ]; then
echo "%{name}-server: First install complete"
else
echo "%{name}-server: Upgrade complete"
fi
%preun
%service_del_preun %{name}-cron.timer %{name}-cron.service
%postun
%service_del_postun %{name}-cron.timer %{name}-cron.service
%files
%defattr(644,root,root,755)
%exclude %{apache_myserverroot}/%{name}/README
%exclude %{apache_myserverroot}/%{name}/README.SUSE
%exclude %{apache_myserverroot}/%{name}/README.SELinux
%doc README README.SUSE README.SELinux
%config(noreplace) %{_sysconfdir}/cron.d/%{name}
%{_sbindir}/rc%{name}-cron
%{_unitdir}/%{name}-cron.service
%{_unitdir}/%{name}-cron.timer
%{apache_myserverroot}/%{name}
%attr(-,%{apache_user},%{apache_group}) %{apache_myserverroot}/%{name}/occ
%config(noreplace) %{apache_myserverroot}/%{name}/.user.ini
%defattr(664,%{apache_user},%{apache_group},775)
%{apache_myserverroot}/%{name}/apps
%{apache_myserverroot}/%{name}/core/js/mimetypelist.js
%dir %{apache_myserverroot}/%{name}/core/img/filetypes
%defattr(660,%{apache_user},%{apache_group},770)
%{apache_myserverroot}/%{name}/config
%{apache_myserverroot}/%{name}/data
%files apache
%config(noreplace) %{apache_confdir}/nextcloud.conf
%changelog