Accepting request 854624 from home:ecsos:server

- Use apache-rpm-macros for SUSE.
- Change oc_* macros to nc_* macros.
- Insert macro apache_serverroot also in cron files.

OBS-URL: https://build.opensuse.org/request/show/854624
OBS-URL: https://build.opensuse.org/package/show/server:php:applications/nextcloud?expand=0&rev=130
This commit is contained in:
Eric Schirra 2020-12-10 16:18:43 +00:00 committed by Git OBS Bridge
parent d4da3977b4
commit 052a459f6b
4 changed files with 41 additions and 31 deletions

View File

@ -6,4 +6,4 @@
SHELL=/bin/sh
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
[Service]
User=wwwrun
ExecStart=/usr/bin/php -f /srv/www/htdocs/nextcloud/cron.php
User=@APACHE_USER@
ExecStart=/usr/bin/php -f @APACHE_MYSERVERROOT@/nextcloud/cron.php
[Install]
WantedBy=basic.target

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
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>

View File

@ -18,11 +18,9 @@
#
%if 0%{?suse_version}
%define apache_serverroot /srv/www/htdocs
%define apache_confdir /etc/apache2/conf.d
%define apache_myserverroot %{apache_serverroot}/htdocs
%define apache_confdir %{apache_sysconfdir}/conf.d
%define apache_docdir /usr/share/doc/packages
%define apache_user wwwrun
%define apache_group www
%else
%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version}
%define apache_serverroot /var/www/html
@ -38,8 +36,8 @@
%endif
%endif
%define oc_user %{apache_user}
%define oc_dir %{apache_serverroot}/%{name}
%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
@ -69,6 +67,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
%if 0%{?suse_version}
BuildRequires: apache-rpm-macros
BuildRequires: apache2 >= 2.4
BuildRequires: cron
%if 0%{?suse_version} > 1020
@ -165,7 +164,7 @@ cp %{SOURCE5} .
%install
# 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/data
mkdir -p $idir/search
@ -181,7 +180,7 @@ fi
# create the AllowOverride directive
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
# not needed for distro packages
@ -189,7 +188,7 @@ rm -f ${idir}/indie.json
%if 0%{?suse_version}
# link duplicate doc files
%fdupes -s $RPM_BUILD_ROOT/%{apache_serverroot}/%{name}
%fdupes -s $RPM_BUILD_ROOT/%{apache_myserverroot}/%{name}
%endif
# CronJob
@ -197,6 +196,10 @@ 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
@ -236,9 +239,9 @@ else
echo "%{name}-server: Upgrade starting ..."
fi
# 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"
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
fi
@ -273,13 +276,13 @@ fi
if [ -s %{statedir}/occ_maintenance_mode_during_nextcloud_install ]; then
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"
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"
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"
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
rm -f %{statedir}/apache_stopped_during_nextcloud_install
@ -299,24 +302,24 @@ fi
%files
%defattr(644,root,root,755)
%exclude %{apache_serverroot}/%{name}/README
%exclude %{apache_serverroot}/%{name}/README.SUSE
%exclude %{apache_serverroot}/%{name}/README.SELinux
%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_serverroot}/%{name}
%attr(-,wwwrun,www) %{apache_serverroot}/%{name}/occ
%{apache_myserverroot}/%{name}
%attr(-,%{apache_user},%{apache_group}) %{apache_myserverroot}/%{name}/occ
%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
%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
%changelog