File project.diff of Package nextcloud
--- README.SELinux.orig
+++ README.SELinux
@@ -1,26 +1,148 @@
-If you are running Fedora 16 with SELinux enabled, you need to relabel the
-ownCloud installation directory to allow the webserver to store files there.
+# SELinux configuration
-To do that, execute the following commands as user root AFTER you installed
-ownCloud:
+( https://docs.nextcloud.com/server/latest/admin_manual/installation/selinux_configuration.html )
-# semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud/data'
-# restorecon '/var/www/html/nextcloud/data'
-# semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud/config'
-# restorecon '/var/www/html/nextcloud/config'
-
-To remove the ownCloud directory label execute the following commands as
-user root AFTER you uninstalled ownCloud:
-
-# semanage fcontext -d -t httpd_sys_rw_content_t '/var/www/html/nextcloud/data'
-# restorecon '/var/www/html/nextcloud/data'
-# semanage fcontext -d -t httpd_sys_rw_content_t '/var/www/html/nextcloud/config'
-# restorecon '/var/www/html/nextcloud/config'
-
-Note: all of the above applies only to the default policies. If you modified
- them, please give the webserver write-access to the directories
- /var/www/html/nextcloud/data and /var/www/html/nextcloud/config
+When you have SELinux enabled on your Linux distribution, you may run into permissions
+ problems after a new Nextcloud installation, and see permission denied errors in your
+ Nextcloud logs.
-Note: for non-Fedora / Redhat systems running SELinux the policy might be
- called differently.
+The following settings should work for most SELinux systems that use the default distro
+ profiles. Run these commands as root, and remember to adjust the filepaths in these
+ examples for your installation:
+
+```
+semanage fcontext -a -t httpd_sys_rw_content_t '/srv/nextcloud-data(/.*)?'
+semanage fcontext -a -t httpd_sys_rw_content_t '/var/www//nextcloud/config(/.*)?'
+semanage fcontext -a -t httpd_sys_rw_content_t '/var/www//nextcloud/apps(/.*)?'
+semanage fcontext -a -t httpd_sys_rw_content_t '/var/www//nextcloud/.htaccess'
+semanage fcontext -a -t httpd_sys_rw_content_t '/var/www//nextcloud/.user.ini'
+semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/nextcloud/3rdparty/aws/aws-sdk-php/src/data/logs(/.*)?'
+
+restorecon -Rv '/var/www/nextcloud/'
+```
+
+If you uninstall Nextcloud you need to remove the Nextcloud directory labels. To
+ do this execute the following commands as root after uninstalling Nextcloud:
+
+```
+semanage fcontext -d '/srv/nextcloud-data(/.*)?'
+semanage fcontext -d '/var/www/html/nextcloud/config(/.*)?'
+semanage fcontext -d '/var/www/html/nextcloud/apps(/.*)?'
+semanage fcontext -d '/var/www/html/nextcloud/.htaccess'
+semanage fcontext -d '/var/www/html/nextcloud/.user.ini'
+semanage fcontext -d '/var/www/html/nextcloud/3rdparty/aws/aws-sdk-php/src/data/logs(/.*)?'
+
+restorecon -Rv '/var/www/html/nextcloud/'
+```
+
+If you have customized SELinux policies and these examples do not work, you must
+ give the HTTP server write access to these directories:
+
+/srv/nextcloud-data
+/var/www/html/nextcloud/config
+/var/www/html/nextcloud/apps
+
+
+## Enable updates via the web interface
+
+To enable updates via the web interface, you may need this to enable writing to the directories:
+
+```
+setsebool httpd_unified on
+```
+
+## When the update is completed, disable write access:
+
+```setsebool -P httpd_unified off
+
+## Disallow write access to the whole web directory
+
+For security reasons it’s suggested to disable write access to all folders in /var/www/ (default):
+
+```
+setsebool -P httpd_unified off
+```
+
+## Allow access to a remote database
+
+An additional setting is needed if your installation is connecting to a remote database:
+
+```
+setsebool -P httpd_can_network_connect_db on
+```
+
+## Allow access to LDAP server
+
+Use this setting to allow LDAP connections:
+
+```
+setsebool -P httpd_can_connect_ldap on
+```
+
+## Allow access to remote network
+
+Nextcloud requires access to remote networks for functions such as Server-to-Server sharing, external storages or the app store. To allow this access use the following setting:
+
+```
+setsebool -P httpd_can_network_connect on
+```
+
+## Allow access to network memcache
+
+This setting is not required if httpd_can_network_connect is already on:
+
+```
+setsebool -P httpd_can_network_memcache on
+```
+
+## Allow access to SMTP/sendmail
+
+If you want to allow Nextcloud to send out e-mail notifications via sendmail you need to use the following setting:
+
+```
+setsebool -P httpd_can_sendmail on
+```
+
+## Allow access to CIFS/SMB
+
+If you have placed your datadir on a CIFS/SMB share use the following setting:
+
+```
+setsebool -P httpd_use_cifs on
+```
+
+## Allow access to FuseFS
+
+If your data folder resides on a Fuse Filesystem (e.g. EncFS etc), this setting is required as well:
+
+```
+setsebool -P httpd_use_fusefs on
+```
+
+## Allow access to GPG for Rainloop
+
+If you use a the rainloop webmail client app which supports GPG/PGP, you might need this:
+
+```
+setsebool -P httpd_use_gpg on
+```
+
+## Troubleshooting
+
+For general Troubleshooting of SELinux and its profiles try to install the package setroubleshoot and run:
+
+```
+sealert -a /var/log/audit/audit.log > /path/to/mylogfile.txt
+```
+
+to get a report which helps you configuring your SELinux profiles.
+
+Another tool for troubleshooting is to enable a single ruleset for your Nextcloud directory:
+
+```
+semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud(/.*)?'
+restorecon -RF /var/www/html/nextcloud
+```
+
+It is much stronger security to have a more fine-grained ruleset as in the examples at the beginning, so use this only for testing and troubleshooting. It has a similar effect to disabling SELinux, so don’t use it on production systems.
--- nextcloud-cron.orig
+++ nextcloud-cron
@@ -6,4 +6,4 @@
SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
-#*/5 * * * * @APACHE_USER@ /usr/bin/php -f @APACHE_MYSERVERROOT@/nextcloud/cron.php /dev/null 2>&1
+#*/5 * * * * @APACHE_USER@ /usr/bin/php -f @APACHE_SERVERROOT@/nextcloud/cron.php /dev/null 2>&1
--- nextcloud-cron.service.orig
+++ nextcloud-cron.service
@@ -3,7 +3,7 @@ Description=Nextcloud CronJob
[Service]
User=@APACHE_USER@
-ExecStart=/usr/bin/php -f @APACHE_MYSERVERROOT@/nextcloud/cron.php
+ExecStart=/usr/bin/php -f @APACHE_SERVERROOT@/nextcloud/cron.php
[Install]
WantedBy=basic.target
--- nextcloud-rpmlintrc.orig
+++ nextcloud-rpmlintrc
@@ -4,4 +4,8 @@ addFilter('explicit-lib-dependency');
addFilter('version-control-internal-file');
addFilter('devel-file-in-non-devel-package');
addFilter('hidden-file-or-dir');
+addFilter('htaccess-file');
addFilter('non-etc-or-var-file-marked-as-conffile');
+addFilter('non-executable-script')
+addFilter('macro-in-comment')
+addFilter('zero-length')
--- nextcloud.changes.orig
+++ nextcloud.changes
@@ -1,4 +1,23 @@
-------------------------------------------------------------------
+Tue Jun 20 18:38:07 UTC 2023 - chris@computersalat.de
+
+- update nextcloud-rpmlintrc
+ * disable .htaccess
+ * take over settings from nextcloud/.htaccess into nextcloud.http
+ * addFilter('htaccess-file'), don't delete because of file integrity
+ * addFilter('non-executable-script') for occ file
+- update mod_php settings nextcloud.http.inc
+
+-------------------------------------------------------------------
+Fri Jun 16 11:54:00 UTC 2023 - chris@computersalat.de
+
+- add Source signature file
+ * nextcloud-25.0.7.tar.bz2.asc
+- add nextcloud pub gpg key
+ * https://nextcloud.com/nextcloud.asc
+ -> nextcloud.keyring
+
+-------------------------------------------------------------------
Fri May 26 06:32:22 UTC 2023 - ecsos <ecsos@opensuse.org>
- Update to 25.0.7
@@ -112,6 +131,30 @@ Fri May 26 06:32:22 UTC 2023 - ecsos <ec
- Increase z-index of SfxPopper instead of its children (viewer#1660)
-------------------------------------------------------------------
+Mon May 8 18:35:55 UTC 2023 - chris@computersalat.de
+
+- fix build for RHEL/AlmaLinux
+ * fix/update dependencies
+- update nexctloud apache config
+ * rename apache_secure_data to nextcloud.http
+ * add nextcloud.http.inc for php settings
+- move nextcloud outside of Apache DocumentRoot
+ * RHEL/AlmaLinux:
+ - /var/www/nextcloud
+ * openSUSE/SLE:
+ - not yet changed to /srv/www/nexcloud
+ * add data migration (disabled)
+- move datadir outside of nextcloud dir
+ * RHEL/AlmaLinux:
+ - /srv/nextcloud-data
+ * openSUSE/SLE:
+ - not yet changed to /srv/nexcloud-data
+ * add data migration (disabled)
+- update nextcloud-rpmlintrc
+- add README.AlmaLinux.md
+- update README.SELinux
+
+-------------------------------------------------------------------
Fri Apr 21 05:00:16 UTC 2023 - ecsos <ecsos@opensuse.org>
- Update to 25.0.6
--- nextcloud.spec.orig
+++ nextcloud.spec
@@ -16,88 +16,125 @@
#
-#
%if 0%{?suse_version}
-%define apache_myserverroot %{apache_serverroot}/htdocs
+%define apache_docroot %{apache_serverroot}/htdocs
%define apache_confdir %{apache_sysconfdir}/conf.d
-%define apache_docdir /usr/share/doc/packages
+%define ap_pkgname apache2
%else
-%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version}
-%define apache_serverroot /var/www/html
+%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version} || 0%{?almalinux_version}
+# apache_serverroot #(apxs -q PREFIX) == /etc/httpd
+%define apache_serverroot /var/www
+%define apache_docroot /var/www/html
+# apache_sysconfdir #(apxs -q SYSCONFDIR) == /etc/httpd/conf
%define apache_confdir /etc/httpd/conf.d
%define apache_user apache
%define apache_group apache
+%define ap_pkgname httpd
%define __jar_repack 0
%else
%define apache_serverroot /var/www
+%define apache_docroot /var/www/html
%define apache_confdir /etc/httpd/conf.d
%define apache_user www
%define apache_group www
+%define ap_pkgname httpd
%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
+%if 0%{?suse_version}
+#define nc_dir %{apache_serverroot}/%{name}
+#define nc_dir_old %{apache_docroot}/%{name}
+%define nc_dir %{apache_docroot}/%{name}
+#define nc_datadir /srv/%{name}-data
+#define nc_datadir_old %{apache_docroot}/%{name}/data
+%define nc_datadir %{apache_docroot}/%{name}/data
+%else
+%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version} || 0%{?almalinux_version}
+# /var/www/nextcloud
+%define nc_dir %{apache_serverroot}/%{name}
+%define nc_datadir /srv/%{name}-data
%else
-%define statedir /run
+%define nc_dir %{apache_serverroot}/%{name}
+%define nc_datadir /srv/%{name}-data
%endif
+%endif
+%define nc_user %{apache_user}
+%define statedir /run
Name: nextcloud
Version: 25.0.7
Release: 0
-Summary: File hosting service
+Summary: Content Collaboration Platform
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
+Source1: https://download.nextcloud.com/server/releases/%{name}-%{version}.tar.bz2.asc
+# Source2: https://nextcloud.com/nextcloud.asc
+# OBS wants a 'keyring' file which is obviously the puplic key
+Source2: nextcloud.keyring
+Source5: %{name}-cron
+Source6: %{name}-cron.service
+Source7: %{name}-cron.timer
+Source8: %{name}.http
+Source9: %{name}.http.inc
+Source11: README
+Source12: README.AlmaLinux.md
+Source13: README.SELinux
+Source14: README.SUSE
+Source20: robots.txt
Source99: %{name}-rpmlintrc
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
+%if 0%{?suse_version}
BuildRequires: apache-rpm-macros
BuildRequires: cron
BuildRequires: fdupes
+%endif
BuildRequires: unzip
#
-Requires: cron
Requires: curl
-Requires: libxml2-2
-Requires: mariadb >= 10.2
+Requires: php-bcmath
Requires: php-bz2
Requires: php-dom
Requires: php-gd
+Requires: php-gmp
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}
+%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version} || 0%{?almalinux_version}
+Requires: libxml2
Requires: php < 8.2.0
Requires: php >= 7.4.0
+Requires: php-mysqlnd
Requires: php-process
Requires: php-xml
+# NOT included in RHEL 9 php >= 8.1 appstream
+## you need REMI's repo
+Recommends: php-sodium
+#
+Recommends: mariadb-server >= 10.2
+Recommends: mod_ssl
Recommends: sqlite
+# dnf install epel-release
+Recommends: php-pecl-redis5
+Suggests: php-pecl-imagick
%endif
#
%if 0%{?suse_version}
+Requires: libxml2-2
+Requires: mariadb >= 10.2
+Requires: php-cli
Requires: php-ctype
Requires: php-curl
# SUSE does not include the fileinfo module in php-common.
Requires: php-fileinfo
Requires: php-iconv
+Requires: php-imagick
+Requires: php-mysql
Requires: php-opcache
Requires: php-openssl
Requires: php-pear
@@ -105,6 +142,8 @@ Requires: php-xmlreader
Requires: php-xmlwriter
Requires: php-zip
Requires: php-zlib
+Recommends: cron
+Recommends: php-redis
Recommends: sqlite3
%{?systemd_requires}
%endif
@@ -118,12 +157,12 @@ Requires: php-ldap
#Requires: php-smbclient
# Recommend for specific apps:
Recommends: php-exif
-Recommends: php-gmp
+#Recommends: php-gmp
# For enhanced server performance:
Recommends: php-APCu
-Recommends: php-bcmath
+#Recommends: php-bcmath
# For preview generation:
-Recommends: php-imagick
+#Recommends: php-imagick
Recommends: php-ffmpeg
#Recommends: libreoffice
# For command line processing:
@@ -134,24 +173,26 @@ Nextcloud is a suite of client-server so
hosting services and using them.
%package apache
-Summary: Apache configuration for %{name}
+Summary: Apache configuration for nextcloud
Group: Productivity/Networking/Web/Utilities
-BuildRequires: apache2 >= 2.4
+BuildRequires: %{ap_pkgname} >= 2.4
+Requires: %{ap_pkgname}
Requires: %{name} = %{version}
-Requires: apache2
+%if 0%{?suse_version}
Requires: mod_php_any < 8.2.0
Requires: mod_php_any >= 7.4.0
-Supplements: packageand(apache2:%name)
+Supplements: packageand(%{ap_pkgname}:%name)
+%endif
%description apache
This subpackage contains the Apache configuration files
%prep
%setup -q -n %{name}
-cp %{SOURCE2} .
-cp %{SOURCE3} .
-cp %{SOURCE4} .
-cp %{SOURCE5} .
+cp %{SOURCE11} .
+cp %{SOURCE12} .
+cp %{SOURCE13} .
+cp %{SOURCE14} .
### Don't remove git files!!
### git files should not be removed, otherwise nextcloud rise up integrity check failure in some situations.
###
@@ -168,47 +209,45 @@ cp %{SOURCE5} .
%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
+install -d %{buildroot}/%{nc_dir}/search
+install -d -m 0750 %{buildroot}/%{nc_datadir}
-if [ ! -f $idir/robots.txt ]; then
- install -p -D -m 644 %{SOURCE5} $idir/robots.txt
-fi
+cp -a .htaccess .user.ini * %{buildroot}/%{nc_dir}/
+rm -f %{buildroot}/%{nc_dir}/README*
-# 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
+# install apache config and php includes
+install -p -D -m 644 %{SOURCE8} %{buildroot}/%{apache_confdir}/%{name}.conf
+install -p -D -m 644 %{SOURCE9} %{buildroot}/%{apache_confdir}/%{name}.inc
+sed -i \
+ -e "s|@NC_DIR@|%{nc_dir}|g" \
+ -e "s|@APACHE_CONFDIR@|%{apache_confdir}|g" %{buildroot}/%{apache_confdir}/%{name}.conf
# not needed for distro packages
-rm -f ${idir}/indie.json
+#rm -f ${idir}/indie.json
%if 0%{?suse_version}
# link duplicate doc files
-%fdupes -s $RPM_BUILD_ROOT/%{apache_myserverroot}/%{name}
+%fdupes -s %{buildroot}/%{nc_dir}
%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}
+install -D -m 0644 %{SOURCE5} %{buildroot}%{_sysconfdir}/cron.d/%{name}
+install -D -m 0644 %{SOURCE6} %{buildroot}%{_unitdir}/%{name}-cron.service
+install -D -m 0644 %{SOURCE7} %{buildroot}%{_unitdir}/%{name}-cron.timer
+sed -i -e "s|@APACHE_USER@|%{apache_user}|g" %{buildroot}%{_sysconfdir}/cron.d/%{name}
+sed -i -e "s|@APACHE_SERVERROOT@|%{apache_serverroot}|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_SERVERROOT@|%{apache_serverroot}|g" %{buildroot}%{_unitdir}/%{name}-cron.service
+%if 0%{?suse_version}
+install -d %{buildroot}%{_sbindir}
ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-cron
+%endif
%pre
+%if 0%{?suse_version}
%service_add_pre %{name}-cron.timer %{name}-cron.service
+%endif
# avoid fatal php errors, while we are changing files
# https://github.com/nextcloud
@@ -216,39 +255,52 @@ ln -sf %{_sbindir}/service %{buildroot}%
# 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 "o %{name} pre-install: Checking for running Apache"
- # FIXME: this above should make it idempotent -- a requirement with openSUSE.
- # it does not work.
+# Upgrade mode
+if [ ${1:-0} -eq 2 ]; then
+ if [ ! -s %{statedir}/apache_stopped_during_nextcloud_install ]; then
+ ### On first install of new package we do not have the new datadir yet
+ ### Hence we do the data migration and do it only once
+ if [ ! -d %{nc_datadir} ]; then
+ echo "o %{name} pre-install: Nextcloud Data migration needed"
+ touch %{statedir}/%{name}_data_migration_needed
+ fi
+ echo "o %{name} pre-install: Checking for running Apache"
+ # FIXME: this above should make it idempotent -- a requirement with openSUSE.
+ # it does not work.
%if 0%{?suse_version} && 0
service apache2 status | grep running > %{statedir}/apache_stopped_during_nextcloud_install
service apache2 stop
%endif
-%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version}
+%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version} || 0%{?almalinux_version}
service httpd status | grep running > %{statedir}/apache_stopped_during_nextcloud_install
service httpd stop
%endif
+ fi
fi
if [ -s %{statedir}/apache_stopped_during_nextcloud_install ]; then
echo "o %{name} pre-install: Stopping Apache"
fi
-if [ $1 -eq 1 ]; then
+# Install mode
+if [ ${1:-0} -eq 1 ]; then
echo "o %{name} pre-install: First install starting"
else
echo "o %{name} pre-install: Upgrade starting ..."
fi
# https://github.com/nextcloud
-if [ -x %{ocphp_bin}/php -a -f %{nc_dir}/occ ]; then
+if [ -x %{_bindir}/php -a -f %{nc_dir}/occ ]; then
echo "o %{name} pre-install: occ maintenance:mode --on"
- su %{nc_user} -s /bin/sh -c "cd %{nc_dir}; PATH=%{ocphp_bin}:$PATH php ./occ maintenance:mode --on" || true
+ su %{nc_user} -s /bin/sh -c "cd %{nc_dir}; PATH=%{_bindir}:$PATH php ./occ maintenance:mode --on" || true
echo yes > %{statedir}/occ_maintenance_mode_during_nextcloud_install
fi
%post
+%if 0%{?suse_version}
%service_add_post %{name}-cron.timer %{name}-cron.service
+%endif
-if [ $1 -eq 1 ]; then
+# Install mode
+if [ ${1:-0} -eq 1 ]; then
%if 0%{?suse_version}
%if 0%{?sle_version} >= 150400 || 0%{?suse_version} > 1500
a2enmod php8
@@ -256,74 +308,125 @@ a2enmod php8
a2enmod php7
%endif
%endif
+ if [ ! -f "%{nc_dir}/config/config.php" ]; then
+ DOMAIN="$(hostname -f)"
+ cat > %{nc_dir}/config/config.php << EOF
+<?php
+\$CONFIG = array (
+ 'datadirectory' => '%{nc_datadir}',
+ 'default_phone_region' => 'DE',
+ 'mail_smtpmode' => 'smtp',
+ 'mail_smtphost' => 'localhost',
+ 'mail_smtpport' => '25',
+ 'mail_from_address' => 'root',
+ 'mail_domain' => '${DOMAIN}',
+);
+EOF
+ chown %{apache_user}: %{nc_dir}/config/config.php
+ fi
fi
+# # Upgrade mode
+# if [ ${1:-0} -eq 2 ]; then
+# ### On first install of new package we do not have the new datadir yet
+# ### Hence we do the data migration and do it only once
+# if [ -f %{statedir}/%{name}_data_migration_needed ]; then
+# echo "o %{name} post-install: Nextcloud Data migration ..."
+# # copy config.php to new destination
+# if [ -s %{nc_dir_old}/config/config.php ]; then
+# cp -a %{nc_dir_old}/config/config.php %{nc_dir}/config/
+# sed -i -e "s|\(.*'datadirectory'\).*|\1 => '%{nc_datadir}',|g" %{nc_dir}/config/config.php
+# mv %{nc_dir_old}/config %{nc_dir_old}/config.bkp
+# fi
+# # Migrate old data dir to new destination
+# if [ -d %{nc_datadir_old} ]; then
+# rsync -aH %{nc_datadir_old}/ %{nc_datadir}/
+# mv %{nc_datadir_old} %{nc_datadir_old}.bkp
+# fi
+# # Migrate apps
+# if [ -d %{nc_dir_old}/apps ]; then
+# rsync -aH %{nc_dir_old}/apps %{nc_dir}/
+# mv %{nc_dir_old}/apps %{nc_dir_old}/apps.bkp
+# fi
+# # Migrate core/img/filetypes
+# if [ -d %{nc_dir_old}/core ]; then
+# rsync -aH %{nc_dir_old}/core %{nc_dir}/
+# mv %{nc_dir_old}/core %{nc_dir_old}/core.bkp
+# fi
+# fi
+# rm -f %{statedir}/%{name}_data_migration_needed
+# fi
+
if [ -s %{statedir}/apache_stopped_during_nextcloud_install ]; then
echo "o %{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}
- service apache2 start
-%endif
-%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version}
- service httpd start
-%endif
+ service %{ap_pkgname} start
fi
if [ -s %{statedir}/occ_maintenance_mode_during_nextcloud_install ]; then
echo "o %{name} post-install: 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
+ su %{nc_user} -s /bin/sh -c "cd %{nc_dir}; PATH=%{_bindir}:$PATH php ./occ maintenance:repair" || true
echo "o %{name} post-install: 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
+ su %{nc_user} -s /bin/sh -c "cd %{nc_dir}; PATH=%{_bindir}:$PATH php ./occ maintenance:mimetype:update-db" || true
+ su %{nc_user} -s /bin/sh -c "cd %{nc_dir}; PATH=%{_bindir}:$PATH php ./occ db:add-missing-columns" || true
+ su %{nc_user} -s /bin/sh -c "cd %{nc_dir}; PATH=%{_bindir}:$PATH php ./occ db:add-missing-indices" || true
+ su %{nc_user} -s /bin/sh -c "cd %{nc_dir}; PATH=%{_bindir}:$PATH php ./occ db:add-missing-primary-keys" || true
echo "o %{name} post-install: occ update apps"
- su %{nc_user} -s /bin/sh -c "cd %{nc_dir}; PATH=%{ocphp_bin}:$PATH php ./occ app:update --all" || true
+ su %{nc_user} -s /bin/sh -c "cd %{nc_dir}; PATH=%{_bindir}:$PATH php ./occ app:update --all" || true
echo "o %{name} post-install: occ upgrade"
- su %{nc_user} -s /bin/sh -c "cd %{nc_dir}; PATH=%{ocphp_bin}:$PATH php ./occ upgrade" || true
+ su %{nc_user} -s /bin/sh -c "cd %{nc_dir}; PATH=%{_bindir}:$PATH php ./occ upgrade" || true
echo "o %{name} post-install: occ maintenance:mode --off"
- su %{nc_user} -s /bin/sh -c "cd %{nc_dir}; PATH=%{ocphp_bin}:$PATH php ./occ maintenance:mode --off" || true
+ su %{nc_user} -s /bin/sh -c "cd %{nc_dir}; PATH=%{_bindir}:$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
+# Install mode
+if [ ${1:-0} -eq 1 ]; then
echo "o %{name} post-install: First install complete"
else
echo "o %{name} post-install: Upgrade complete"
fi
%preun
+%if 0%{?suse_version}
%service_del_preun %{name}-cron.timer %{name}-cron.service
+%endif
%postun
+%if 0%{?suse_version}
%service_del_postun %{name}-cron.timer %{name}-cron.service
+%endif
%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
+%defattr(-,root,root)
+%if 0%{?suse_version}
+%doc README README.SUSE
+%endif
+%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version} || 0%{?almalinux_version}
+%doc README README.AlmaLinux.md README.SELinux
+%endif
%config(noreplace) %{_sysconfdir}/cron.d/%{name}
+%if 0%{?suse_version}
%{_sbindir}/rc%{name}-cron
+%endif
%{_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
-%{apache_myserverroot}/%{name}/core/img/filetypes/*
-%defattr(660,%{apache_user},%{apache_group},770)
-%{apache_myserverroot}/%{name}/config
-%{apache_myserverroot}/%{name}/data
+%{nc_dir}
+%defattr(-,%{apache_user},%{apache_group})
+%attr(0750,%{apache_user},%{apache_group}) %{nc_dir}/occ
+%config(noreplace) %{nc_dir}/.user.ini
+%{nc_dir}/apps
+%{nc_dir}/config
+%dir %{nc_dir}/core/img/filetypes
+%{nc_dir}/core/img/filetypes/*
+%{nc_dir}/core/js/mimetypelist.js
+%attr(0750,%{apache_user},%{apache_group}) %{nc_datadir}
%files apache
-%config(noreplace) %{apache_confdir}/nextcloud.conf
+%config(noreplace) %{apache_confdir}/%{name}.conf
+%config(noreplace) %{apache_confdir}/%{name}.inc
%changelog