From 38a6a04078dc93f5b8e2a14cd65f7d3ce2385fa440e278b158f8e414cd193709 Mon Sep 17 00:00:00 2001 From: Martin Pluskal Date: Thu, 14 Apr 2022 08:24:39 +0000 Subject: [PATCH] Accepting request 962913 from home:gmbr3:Active - Change to systemd-sysusers OBS-URL: https://build.opensuse.org/request/show/962913 OBS-URL: https://build.opensuse.org/package/show/server:database:postgresql/postgresql?expand=0&rev=140 --- postgresql.changes | 5 +++++ postgresql.spec | 21 +++++++++++++++++++++ postgresql.sysusers | 2 ++ 3 files changed, 28 insertions(+) create mode 100644 postgresql.sysusers diff --git a/postgresql.changes b/postgresql.changes index cb1b85f..3e22760 100644 --- a/postgresql.changes +++ b/postgresql.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Wed Mar 16 14:50:22 UTC 2022 - Callum Farmer + +- Change to systemd-sysusers + ------------------------------------------------------------------- Thu Feb 10 10:35:57 UTC 2022 - Reinhard Max diff --git a/postgresql.spec b/postgresql.spec index 98fbce4..9b32df3 100644 --- a/postgresql.spec +++ b/postgresql.spec @@ -75,6 +75,7 @@ Source5: postgresql-bashprofile Source6: postgresql-script Source7: postgresql-install-alternatives Source8: postgresql-extensions-macros +Source9: postgresql.sysusers %if 0%{?suse_version} > 1100 %define fwdir /etc/sysconfig/SuSEfirewall2.d/services @@ -104,7 +105,12 @@ Requires: postgresql-server-implementation Requires: postgresql = %version-%release Recommends: %defaultpackage-server %if 0%{?suse_version} >= 1315 +%if 0%{?suse_version} >= 1500 +BuildRequires: sysuser-tools +%sysusers_requires +%else Requires(pre): shadow +%endif %else Requires(pre): pwdutils %endif @@ -308,6 +314,9 @@ and triggers. %prep %build +%if 0%{?suse_version} >= 1500 +%sysusers_generate_pre %{SOURCE9} %{name}-server %{name}-server.conf +%endif echo "This is a dummy package to provide a dependency on the default PostgreSQL version." > README %install @@ -345,16 +354,25 @@ ln -sf /etc/init.d/postgresql %buildroot/usr/sbin/rcpostgresql install -D -m 0644 %{SOURCE8} %{buildroot}%{_rpmmacrodir}/macros.%{name} +# sysusers.d +%if 0%{?suse_version} >= 1500 +install -Dm0644 %{SOURCE9} %{buildroot}%{_sysusersdir}/%{name}-server.conf +%endif + %define eflag /run/postgresql-was-enabled %define aflag /run/postgresql-was-running +%if 0%{?suse_version} >= 1500 +%pre server -f %{name}-server.pre +%else %pre server getent group postgres > /dev/null || groupadd -g 26 -o -r postgres getent passwd postgres > /dev/null || useradd -g postgres -o -r -d /var/lib/pgsql -s /bin/bash \ -c "PostgreSQL Server" -u 26 postgres +%endif %if %{with systemd} %service_add_pre postgresql.service @@ -452,6 +470,9 @@ fi %config /etc/init.d/postgresql %dir %attr(1775,postgres,postgres) /var/run/postgresql %endif +%if 0%{?suse_version} >= 1500 +%{_sysusersdir}/%{name}-server.conf +%endif %files test %defattr(-,root,root,-) diff --git a/postgresql.sysusers b/postgresql.sysusers new file mode 100644 index 0000000..4026bd1 --- /dev/null +++ b/postgresql.sysusers @@ -0,0 +1,2 @@ +#Type Name ID GECOS Home directory Shell +u postgres - "PostgreSQL Server" /var/lib/pgsql /bin/bash