- bsc#1209208: Drop hard dependency on systemd

OBS-URL: https://build.opensuse.org/package/show/server:database:postgresql/postgresql?expand=0&rev=146
This commit is contained in:
2023-03-27 17:12:32 +00:00
committed by Git OBS Bridge
parent 4f12378358
commit 4dfbe99e89
2 changed files with 17 additions and 1 deletions

View File

@@ -1,3 +1,8 @@
-------------------------------------------------------------------
Mon Mar 27 17:10:16 UTC 2023 - Reinhard Max <max@suse.com>
- bsc#1209208: Drop hard dependency on systemd
-------------------------------------------------------------------
Mon Jan 9 09:22:55 UTC 2023 - Reinhard Max <max@suse.com>

View File

@@ -126,7 +126,7 @@ Provides: postgresql-init = %version.0-%release
Obsoletes: postgresql-init < %version.0-%release
%if %{with systemd}
BuildRequires: pkgconfig(systemd)
%{?systemd_requires}
%{?systemd_ordering}
%else
Requires(postun): %insserv_prereq
%endif
@@ -382,6 +382,7 @@ getent passwd postgres > /dev/null ||
-c "PostgreSQL Server" -u 26 postgres
%endif
%if %{with systemd}
if test -x /usr/bin/systemctl; then
%service_add_pre postgresql.service
# Save the "enabled" and "active" state across the transition of
@@ -393,11 +394,13 @@ if [ $1 -ge 1 ]; then \
fi
systemctl is-active postgresql.service &>/dev/null && touch %aflag ||:
fi
fi
%endif
%post server
%fillup_only -n postgresql
%if %{with systemd}
if test -x /usr/bin/systemctl; then
PROFILE="/var/lib/pgsql/.bash_profile"
if test -r "$PROFILE" && test "`cat $PROFILE`" = "/usr/share/postgresql/bash_profile"
then
@@ -408,21 +411,26 @@ then
fi
%tmpfiles_create %_tmpfilesdir/postgresql.conf
%service_add_post postgresql.service
fi
%endif
%preun server
%if %{with systemd}
if test -x /usr/bin/systemctl; then
# Cannot use systemd macros here, because they're doing too much
/usr/bin/systemctl --no-reload disable postgresql.service || :
fi
%else
%stop_on_removal postgresql
%endif
%postun server
%if %{with systemd}
if test -x /usr/bin/systemctl; then
# Cannot use systemd macros here, because they're doing too much
rm -f "/var/lib/systemd/migrated/postgresql"
/usr/bin/systemctl daemon-reload || :
fi
%else
%insserv_cleanup
@@ -430,6 +438,7 @@ rm -f "/var/lib/systemd/migrated/postgresql"
%if %{with systemd}
%posttrans server
if test -x /usr/bin/systemctl; then
# Save the "enabled" and "active" state across the transition of
# ownership of postgresql.service from postgresql-init to
# postgresql-server.
@@ -437,10 +446,12 @@ if test -f %eflag; then
rm -f %eflag
systemctl enable postgresql.service
fi
if test -f %aflag; then
rm -f %aflag
systemctl start postgresql.service
fi
fi
%endif
%files