SHA256
1
0
forked from pool/nextcloud

Accepting request 904435 from home:ecsos:server

- Fix some scriptlet and their output text.

OBS-URL: https://build.opensuse.org/request/show/904435
OBS-URL: https://build.opensuse.org/package/show/server:php:applications/nextcloud?expand=0&rev=153
This commit is contained in:
2021-07-06 20:48:03 +00:00
committed by Git OBS Bridge
parent 70d616bf75
commit 8c10065994
2 changed files with 25 additions and 28 deletions

View File

@@ -1,3 +1,8 @@
-------------------------------------------------------------------
Tue Jul 6 19:58:39 UTC 2021 - ecsos <ecsos@opensuse.org>
- Fix some scriptlet and their output text.
-------------------------------------------------------------------
Tue Jul 6 14:22:09 UTC 2021 - Michael Ströder <michael@stroeder.com>

View File

@@ -36,14 +36,14 @@
%endif
%endif
%define nc_user %{apache_user}
%define nc_dir %{apache_myserverroot}/%{name}
%define ocphp_bin /usr/bin
%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
%define statedir /var/run
%else
%define statedir /run
%define statedir /run
%endif
Name: nextcloud
@@ -208,6 +208,7 @@ 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
#
@@ -215,35 +216,30 @@ ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-cron
# 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"
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
%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"
echo "o %{name} pre-install: Stopping Apache"
fi
if [ $1 -eq 1 ]; then
echo "%{name}-server: First install starting"
echo "o %{name} pre-install: First install starting"
else
echo "%{name}-server: Upgrade starting ..."
echo "o %{name} pre-install: Upgrade starting ..."
fi
# https://github.com/nextcloud
if [ -x %{ocphp_bin}/php -a -f %{nc_dir}/occ ]; then
echo "%{name}: occ maintenance:mode --on"
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
echo yes > %{statedir}/occ_maintenance_mode_during_nextcloud_install
fi
@@ -262,15 +258,11 @@ a2enmod php5
fi
if [ -s %{statedir}/apache_stopped_during_nextcloud_install ]; then
echo "%{name} post-install: Restarting Apache"
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}
%if 0%{?suse_version} <= 1310
rcapache2 start
%else
rcapache2 restart apache2.service
%endif
service apache2 start
%endif
%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version}
service httpd start
@@ -278,18 +270,18 @@ if [ -s %{statedir}/apache_stopped_during_nextcloud_install ]; then
fi
if [ -s %{statedir}/occ_maintenance_mode_during_nextcloud_install ]; then
echo "%{name}: occ maintenance:repair (fix possible errors)"
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
echo "%{name}: occ db:add-missing-* (add missing db things)"
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
echo "%{name}: occ update apps"
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
echo "%{name}: occ upgrade"
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
echo "%{name}: occ maintenance:mode --off"
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
fi
@@ -297,9 +289,9 @@ 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"
echo "o %{name} post-install: First install complete"
else
echo "%{name}-server: Upgrade complete"
echo "o %{name} post-install: Upgrade complete"
fi
%preun