Accepting request 855739 from server:php:applications

OBS-URL: https://build.opensuse.org/request/show/855739
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/nextcloud?expand=0&rev=51
This commit is contained in:
Dominique Leuenberger 2020-12-14 17:08:50 +00:00 committed by Git OBS Bridge
commit 5412e3c750
4 changed files with 60 additions and 41 deletions

View File

@ -6,4 +6,4 @@
SHELL=/bin/sh SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin PATH=/sbin:/bin:/usr/sbin:/usr/bin
#*/5 * * * * wwwrun /usr/bin/php -f /srv/www/htdocs/nextcloud/cron.php /dev/null 2>&1 #*/5 * * * * @APACHE_USER@ /usr/bin/php -f @APACHE_MYSERVERROOT@/nextcloud/cron.php /dev/null 2>&1

View File

@ -2,8 +2,8 @@
Description=Nextcloud CronJob Description=Nextcloud CronJob
[Service] [Service]
User=wwwrun User=@APACHE_USER@
ExecStart=/usr/bin/php -f /srv/www/htdocs/nextcloud/cron.php ExecStart=/usr/bin/php -f @APACHE_MYSERVERROOT@/nextcloud/cron.php
[Install] [Install]
WantedBy=basic.target WantedBy=basic.target

View File

@ -1,3 +1,15 @@
-------------------------------------------------------------------
Mon Dec 14 10:28:07 UTC 2020 - ecsos <ecsos@opensuse.org>
- Put apache configuration files in separate subpackage.
-------------------------------------------------------------------
Thu Dec 10 12:26:39 UTC 2020 - ecsos <ecsos@opensuse.org>
- Use apache-rpm-macros for SUSE.
- Change oc_* macros to nc_* macros.
- Insert macro apache_serverroot also in cron files.
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Dec 10 10:28:40 UTC 2020 - Michael Ströder <michael@stroeder.com> Thu Dec 10 10:28:40 UTC 2020 - Michael Ströder <michael@stroeder.com>

View File

@ -18,11 +18,9 @@
# #
%if 0%{?suse_version} %if 0%{?suse_version}
%define apache_serverroot /srv/www/htdocs %define apache_myserverroot %{apache_serverroot}/htdocs
%define apache_confdir /etc/apache2/conf.d %define apache_confdir %{apache_sysconfdir}/conf.d
%define apache_docdir /usr/share/doc/packages %define apache_docdir /usr/share/doc/packages
%define apache_user wwwrun
%define apache_group www
%else %else
%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version} %if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version}
%define apache_serverroot /var/www/html %define apache_serverroot /var/www/html
@ -38,8 +36,8 @@
%endif %endif
%endif %endif
%define oc_user %{apache_user} %define nc_user %{apache_user}
%define oc_dir %{apache_serverroot}/%{name} %define nc_dir %{apache_myserverroot}/%{name}
%define ocphp_bin /usr/bin %define ocphp_bin /usr/bin
%if 0%{?rhel} == 600 || 0%{?rhel_version} == 600 || 0%{?centos_version} == 600 %if 0%{?rhel} == 600 || 0%{?rhel_version} == 600 || 0%{?centos_version} == 600
@ -67,15 +65,10 @@ Source12: %{name}-cron.timer
Source99: %{name}-rpmlintrc Source99: %{name}-rpmlintrc
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch BuildArch: noarch
BuildRequires: apache-rpm-macros
%if 0%{?suse_version}
BuildRequires: apache2 >= 2.4
BuildRequires: cron BuildRequires: cron
%if 0%{?suse_version} > 1020
BuildRequires: fdupes BuildRequires: fdupes
%endif
BuildRequires: unzip BuildRequires: unzip
%endif
# #
Requires: cron Requires: cron
Requires: curl Requires: curl
@ -96,14 +89,10 @@ Requires: php < 7.5.0
Requires: php >= 7.2.0 Requires: php >= 7.2.0
Requires: php-process Requires: php-process
Requires: php-xml Requires: php-xml
#
Recommends: sqlite Recommends: sqlite
%endif %endif
# #
%if 0%{?suse_version} %if 0%{?suse_version}
Requires: apache2
Requires: mod_php_any < 7.5.0
Requires: mod_php_any >= 7.2.0
Requires: php-ctype Requires: php-ctype
Requires: php-curl Requires: php-curl
# SUSE does not include the fileinfo module in php-common. # SUSE does not include the fileinfo module in php-common.
@ -143,6 +132,18 @@ Recommends: php-pcntl
Nextcloud is a suite of client-server software for creating file Nextcloud is a suite of client-server software for creating file
hosting services and using them. hosting services and using them.
%package apache
Summary: Apache configuration for %{name}
Group: Productivity/Networking/Web/Utilities
BuildRequires: apache2 >= 2.4
Requires: apache2
Requires: mod_php_any < 7.5.0
Requires: mod_php_any >= 7.2.0
Supplements: packageand(apache2:%name)
%description apache
This subpackage contains the Apache configuration files
%prep %prep
%setup -q -n %{name} %setup -q -n %{name}
cp %{SOURCE2} . cp %{SOURCE2} .
@ -165,7 +166,7 @@ cp %{SOURCE5} .
%install %install
# no server side java code contained, alarm is false # no server side java code contained, alarm is false
idir=$RPM_BUILD_ROOT/%{apache_serverroot}/%{name} idir=$RPM_BUILD_ROOT/%{apache_myserverroot}/%{name}
mkdir -p $idir mkdir -p $idir
mkdir -p $idir/data mkdir -p $idir/data
mkdir -p $idir/search mkdir -p $idir/search
@ -181,7 +182,7 @@ fi
# create the AllowOverride directive # create the AllowOverride directive
install -p -D -m 644 %{SOURCE1} $RPM_BUILD_ROOT/%{apache_confdir}/nextcloud.conf install -p -D -m 644 %{SOURCE1} $RPM_BUILD_ROOT/%{apache_confdir}/nextcloud.conf
ocpath="%{apache_serverroot}/%{name}" ocpath="%{apache_myserverroot}/%{name}"
sed -i -e"s|@DATAPATH@|${ocpath}|g" $RPM_BUILD_ROOT/%{apache_confdir}/nextcloud.conf sed -i -e"s|@DATAPATH@|${ocpath}|g" $RPM_BUILD_ROOT/%{apache_confdir}/nextcloud.conf
# not needed for distro packages # not needed for distro packages
@ -189,7 +190,7 @@ rm -f ${idir}/indie.json
%if 0%{?suse_version} %if 0%{?suse_version}
# link duplicate doc files # link duplicate doc files
%fdupes -s $RPM_BUILD_ROOT/%{apache_serverroot}/%{name} %fdupes -s $RPM_BUILD_ROOT/%{apache_myserverroot}/%{name}
%endif %endif
# CronJob # CronJob
@ -197,6 +198,10 @@ install -d -m 0755 %{buildroot}%{_sysconfdir}/cron.d
install -D -m 0644 %{SOURCE10} %{buildroot}%{_sysconfdir}/cron.d/%{name} install -D -m 0644 %{SOURCE10} %{buildroot}%{_sysconfdir}/cron.d/%{name}
install -D -m 0644 %{SOURCE11} %{buildroot}%{_unitdir}/%{name}-cron.service install -D -m 0644 %{SOURCE11} %{buildroot}%{_unitdir}/%{name}-cron.service
install -D -m 0644 %{SOURCE12} %{buildroot}%{_unitdir}/%{name}-cron.timer 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} mkdir -p %{buildroot}%{_sbindir}
ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-cron ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-cron
@ -236,9 +241,9 @@ else
echo "%{name}-server: Upgrade starting ..." echo "%{name}-server: Upgrade starting ..."
fi fi
# https://github.com/nextcloud # https://github.com/nextcloud
if [ -x %{ocphp_bin}/php -a -f %{oc_dir}/occ ]; then if [ -x %{ocphp_bin}/php -a -f %{nc_dir}/occ ]; then
echo "%{name}: occ maintenance:mode --on" echo "%{name}: occ maintenance:mode --on"
su %{oc_user} -s /bin/sh -c "cd %{oc_dir}; PATH=%{ocphp_bin}:$PATH php ./occ maintenance:mode --on" || true 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 echo yes > %{statedir}/occ_maintenance_mode_during_nextcloud_install
fi fi
@ -273,13 +278,13 @@ fi
if [ -s %{statedir}/occ_maintenance_mode_during_nextcloud_install ]; then if [ -s %{statedir}/occ_maintenance_mode_during_nextcloud_install ]; then
echo "%{name}: occ maintenance:repair (fix possible errors)" echo "%{name}: occ maintenance:repair (fix possible errors)"
su %{oc_user} -s /bin/sh -c "cd %{oc_dir}; PATH=%{ocphp_bin}:$PATH php ./occ maintenance:repair" || true su %{nc_user} -s /bin/sh -c "cd %{nc_dir}; PATH=%{ocphp_bin}:$PATH php ./occ maintenance:repair" || true
echo "%{name}: occ update apps" echo "%{name}: occ update apps"
su %{oc_user} -s /bin/sh -c "cd %{oc_dir}; PATH=%{ocphp_bin}:$PATH php ./occ app:update --all" || true su %{nc_user} -s /bin/sh -c "cd %{nc_dir}; PATH=%{ocphp_bin}:$PATH php ./occ app:update --all" || true
echo "%{name}: occ upgrade" echo "%{name}: occ upgrade"
su %{oc_user} -s /bin/sh -c "cd %{oc_dir}; PATH=%{ocphp_bin}:$PATH php ./occ upgrade" || true su %{nc_user} -s /bin/sh -c "cd %{nc_dir}; PATH=%{ocphp_bin}:$PATH php ./occ upgrade" || true
echo "%{name}: occ maintenance:mode --off" echo "%{name}: occ maintenance:mode --off"
su %{oc_user} -s /bin/sh -c "cd %{oc_dir}; PATH=%{ocphp_bin}:$PATH php ./occ maintenance:mode --off" || true su %{nc_user} -s /bin/sh -c "cd %{nc_dir}; PATH=%{ocphp_bin}:$PATH php ./occ maintenance:mode --off" || true
fi fi
rm -f %{statedir}/apache_stopped_during_nextcloud_install rm -f %{statedir}/apache_stopped_during_nextcloud_install
@ -299,24 +304,26 @@ fi
%files %files
%defattr(644,root,root,755) %defattr(644,root,root,755)
%exclude %{apache_serverroot}/%{name}/README %exclude %{apache_myserverroot}/%{name}/README
%exclude %{apache_serverroot}/%{name}/README.SUSE %exclude %{apache_myserverroot}/%{name}/README.SUSE
%exclude %{apache_serverroot}/%{name}/README.SELinux %exclude %{apache_myserverroot}/%{name}/README.SELinux
%doc README README.SUSE README.SELinux %doc README README.SUSE README.SELinux
%config(noreplace) %{_sysconfdir}/cron.d/%{name} %config(noreplace) %{_sysconfdir}/cron.d/%{name}
%{_sbindir}/rc%{name}-cron %{_sbindir}/rc%{name}-cron
%{_unitdir}/%{name}-cron.service %{_unitdir}/%{name}-cron.service
%{_unitdir}/%{name}-cron.timer %{_unitdir}/%{name}-cron.timer
%{apache_serverroot}/%{name} %{apache_myserverroot}/%{name}
%attr(-,wwwrun,www) %{apache_serverroot}/%{name}/occ %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 %config(noreplace) %{apache_confdir}/nextcloud.conf
%config(noreplace) %{apache_serverroot}/%{name}/.user.ini
%defattr(664,wwwrun,www,775)
%{apache_serverroot}/%{name}/apps
%{apache_serverroot}/%{name}/core/js/mimetypelist.js
%dir %{apache_serverroot}/%{name}/core/img/filetypes
%defattr(660,wwwrun,www,770)
%{apache_serverroot}/%{name}/config
%{apache_serverroot}/%{name}/data
%changelog %changelog