From 052a459f6bd32bbb16b572309ff008ad9288f673e2cace8712109e9b679c764a Mon Sep 17 00:00:00 2001 From: Eric Schirra Date: Thu, 10 Dec 2020 16:18:43 +0000 Subject: [PATCH 1/4] 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 --- nextcloud-cron | 2 +- nextcloud-cron.service | 4 +-- nextcloud.changes | 7 +++++ nextcloud.spec | 59 ++++++++++++++++++++++-------------------- 4 files changed, 41 insertions(+), 31 deletions(-) diff --git a/nextcloud-cron b/nextcloud-cron index c83ec90..5eafa4f 100644 --- a/nextcloud-cron +++ b/nextcloud-cron @@ -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 diff --git a/nextcloud-cron.service b/nextcloud-cron.service index 7ecea29..625dc10 100644 --- a/nextcloud-cron.service +++ b/nextcloud-cron.service @@ -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 diff --git a/nextcloud.changes b/nextcloud.changes index ba39b55..c56bfe7 100644 --- a/nextcloud.changes +++ b/nextcloud.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Thu Dec 10 12:26:39 UTC 2020 - ecsos + +- 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 diff --git a/nextcloud.spec b/nextcloud.spec index 609fb11..6fecc99 100644 --- a/nextcloud.spec +++ b/nextcloud.spec @@ -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 From a730862f2da8f0b8dffa44e67cec2e7aef7e4a79edd224901602e666cc49b327 Mon Sep 17 00:00:00 2001 From: Eric Schirra Date: Fri, 11 Dec 2020 09:15:26 +0000 Subject: [PATCH 2/4] Accepting request 854820 from home:ecsos:server - Fix problem with apache_serverroot macro in Tumbleweed. OBS-URL: https://build.opensuse.org/request/show/854820 OBS-URL: https://build.opensuse.org/package/show/server:php:applications/nextcloud?expand=0&rev=131 --- nextcloud.changes | 5 +++++ nextcloud.spec | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/nextcloud.changes b/nextcloud.changes index c56bfe7..42433d2 100644 --- a/nextcloud.changes +++ b/nextcloud.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Fri Dec 11 08:49:28 UTC 2020 - ecsos + +- Fix problem with apache_serverroot macro in Tumbleweed. + ------------------------------------------------------------------- Thu Dec 10 12:26:39 UTC 2020 - ecsos diff --git a/nextcloud.spec b/nextcloud.spec index 6fecc99..36dba55 100644 --- a/nextcloud.spec +++ b/nextcloud.spec @@ -18,7 +18,12 @@ # %if 0%{?suse_version} +# Tumbleweed has errors in apache-rpm-macros: apache_serverroot is /usr +%if 0%{?suse_version} > 1500 +%define apache_myserverroot /srv/www/htdocs +%else %define apache_myserverroot %{apache_serverroot}/htdocs +%endif %define apache_confdir %{apache_sysconfdir}/conf.d %define apache_docdir /usr/share/doc/packages %else From eac4a85af631411ec9dfc324b96a7861a2f4514f69969cd14943fe95d816dd5f Mon Sep 17 00:00:00 2001 From: Eric Schirra Date: Fri, 11 Dec 2020 13:26:58 +0000 Subject: [PATCH 3/4] Accepting request 854883 from server:php:applications Rollback OBS-URL: https://build.opensuse.org/request/show/854883 OBS-URL: https://build.opensuse.org/package/show/server:php:applications/nextcloud?expand=0&rev=132 --- nextcloud.changes | 5 ----- nextcloud.spec | 5 ----- 2 files changed, 10 deletions(-) diff --git a/nextcloud.changes b/nextcloud.changes index 42433d2..c56bfe7 100644 --- a/nextcloud.changes +++ b/nextcloud.changes @@ -1,8 +1,3 @@ -------------------------------------------------------------------- -Fri Dec 11 08:49:28 UTC 2020 - ecsos - -- Fix problem with apache_serverroot macro in Tumbleweed. - ------------------------------------------------------------------- Thu Dec 10 12:26:39 UTC 2020 - ecsos diff --git a/nextcloud.spec b/nextcloud.spec index 36dba55..6fecc99 100644 --- a/nextcloud.spec +++ b/nextcloud.spec @@ -18,12 +18,7 @@ # %if 0%{?suse_version} -# Tumbleweed has errors in apache-rpm-macros: apache_serverroot is /usr -%if 0%{?suse_version} > 1500 -%define apache_myserverroot /srv/www/htdocs -%else %define apache_myserverroot %{apache_serverroot}/htdocs -%endif %define apache_confdir %{apache_sysconfdir}/conf.d %define apache_docdir /usr/share/doc/packages %else From d10bdc0debfed9c986ac1dc0e474fb420b02dc59471a73af74d70f7adc0a7b01 Mon Sep 17 00:00:00 2001 From: Eric Schirra Date: Mon, 14 Dec 2020 11:53:46 +0000 Subject: [PATCH 4/4] Accepting request 855738 from home:ecsos:server - Put apache configuration files in separate subpackage. OBS-URL: https://build.opensuse.org/request/show/855738 OBS-URL: https://build.opensuse.org/package/show/server:php:applications/nextcloud?expand=0&rev=133 --- nextcloud.changes | 5 +++++ nextcloud.spec | 26 +++++++++++++++----------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/nextcloud.changes b/nextcloud.changes index c56bfe7..e00a254 100644 --- a/nextcloud.changes +++ b/nextcloud.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Dec 14 10:28:07 UTC 2020 - ecsos + +- Put apache configuration files in separate subpackage. + ------------------------------------------------------------------- Thu Dec 10 12:26:39 UTC 2020 - ecsos diff --git a/nextcloud.spec b/nextcloud.spec index 6fecc99..cbd4f20 100644 --- a/nextcloud.spec +++ b/nextcloud.spec @@ -65,16 +65,10 @@ Source12: %{name}-cron.timer Source99: %{name}-rpmlintrc 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 BuildRequires: fdupes -%endif BuildRequires: unzip -%endif # Requires: cron Requires: curl @@ -95,14 +89,10 @@ Requires: php < 7.5.0 Requires: php >= 7.2.0 Requires: php-process Requires: php-xml -# Recommends: sqlite %endif # %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-curl # SUSE does not include the fileinfo module in php-common. @@ -142,6 +132,18 @@ Recommends: php-pcntl 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: 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 %setup -q -n %{name} cp %{SOURCE2} . @@ -312,7 +314,6 @@ fi %{_unitdir}/%{name}-cron.timer %{apache_myserverroot}/%{name} %attr(-,%{apache_user},%{apache_group}) %{apache_myserverroot}/%{name}/occ -%config(noreplace) %{apache_confdir}/nextcloud.conf %config(noreplace) %{apache_myserverroot}/%{name}/.user.ini %defattr(664,%{apache_user},%{apache_group},775) %{apache_myserverroot}/%{name}/apps @@ -322,4 +323,7 @@ fi %{apache_myserverroot}/%{name}/config %{apache_myserverroot}/%{name}/data +%files apache +%config(noreplace) %{apache_confdir}/nextcloud.conf + %changelog