PostgreSQL 18: Add sysusers.d config file to allow rpm to create users/groups automa...
authorDevrim Gunduz <devrim@gunduz.org>
Sun, 21 Sep 2025 21:08:00 +0000 (16:08 -0500)
committerDevrim Gunduz <devrim@gunduz.org>
Sun, 21 Sep 2025 21:08:00 +0000 (16:08 -0500)
rpm/redhat/main/non-common/postgresql-18/EL-10/postgresql-18-sysusers.conf [new symlink]
rpm/redhat/main/non-common/postgresql-18/EL-8/postgresql-18-sysusers.conf [new symlink]
rpm/redhat/main/non-common/postgresql-18/EL-9/postgresql-18-sysusers.conf [new symlink]
rpm/redhat/main/non-common/postgresql-18/F-41/postgresql-18-sysusers.conf [new symlink]
rpm/redhat/main/non-common/postgresql-18/F-42/postgresql-18-sysusers.conf [new symlink]
rpm/redhat/main/non-common/postgresql-18/F-43/postgresql-18-sysusers.conf [new symlink]
rpm/redhat/main/non-common/postgresql-18/SLES-15/postgresql-18-sysusers.conf [new symlink]
rpm/redhat/main/non-common/postgresql-18/main/postgresql-18-sysusers.conf [new file with mode: 0644]
rpm/redhat/main/non-common/postgresql-18/main/postgresql-18.spec

diff --git a/rpm/redhat/main/non-common/postgresql-18/EL-10/postgresql-18-sysusers.conf b/rpm/redhat/main/non-common/postgresql-18/EL-10/postgresql-18-sysusers.conf
new file mode 120000 (symlink)
index 0000000..9c15d39
--- /dev/null
@@ -0,0 +1 @@
+../main/postgresql-18-sysusers.conf
\ No newline at end of file
diff --git a/rpm/redhat/main/non-common/postgresql-18/EL-8/postgresql-18-sysusers.conf b/rpm/redhat/main/non-common/postgresql-18/EL-8/postgresql-18-sysusers.conf
new file mode 120000 (symlink)
index 0000000..9c15d39
--- /dev/null
@@ -0,0 +1 @@
+../main/postgresql-18-sysusers.conf
\ No newline at end of file
diff --git a/rpm/redhat/main/non-common/postgresql-18/EL-9/postgresql-18-sysusers.conf b/rpm/redhat/main/non-common/postgresql-18/EL-9/postgresql-18-sysusers.conf
new file mode 120000 (symlink)
index 0000000..9c15d39
--- /dev/null
@@ -0,0 +1 @@
+../main/postgresql-18-sysusers.conf
\ No newline at end of file
diff --git a/rpm/redhat/main/non-common/postgresql-18/F-41/postgresql-18-sysusers.conf b/rpm/redhat/main/non-common/postgresql-18/F-41/postgresql-18-sysusers.conf
new file mode 120000 (symlink)
index 0000000..9c15d39
--- /dev/null
@@ -0,0 +1 @@
+../main/postgresql-18-sysusers.conf
\ No newline at end of file
diff --git a/rpm/redhat/main/non-common/postgresql-18/F-42/postgresql-18-sysusers.conf b/rpm/redhat/main/non-common/postgresql-18/F-42/postgresql-18-sysusers.conf
new file mode 120000 (symlink)
index 0000000..9c15d39
--- /dev/null
@@ -0,0 +1 @@
+../main/postgresql-18-sysusers.conf
\ No newline at end of file
diff --git a/rpm/redhat/main/non-common/postgresql-18/F-43/postgresql-18-sysusers.conf b/rpm/redhat/main/non-common/postgresql-18/F-43/postgresql-18-sysusers.conf
new file mode 120000 (symlink)
index 0000000..9c15d39
--- /dev/null
@@ -0,0 +1 @@
+../main/postgresql-18-sysusers.conf
\ No newline at end of file
diff --git a/rpm/redhat/main/non-common/postgresql-18/SLES-15/postgresql-18-sysusers.conf b/rpm/redhat/main/non-common/postgresql-18/SLES-15/postgresql-18-sysusers.conf
new file mode 120000 (symlink)
index 0000000..9c15d39
--- /dev/null
@@ -0,0 +1 @@
+../main/postgresql-18-sysusers.conf
\ No newline at end of file
diff --git a/rpm/redhat/main/non-common/postgresql-18/main/postgresql-18-sysusers.conf b/rpm/redhat/main/non-common/postgresql-18/main/postgresql-18-sysusers.conf
new file mode 100644 (file)
index 0000000..aa3389d
--- /dev/null
@@ -0,0 +1 @@
+u postgres 26 'PostgreSQL Server' /var/lib/pgsql /usr/bin/bash
index ffe1e28feb74dc39dabd56c898660d786b047640..a7357657863e3cf2d245a7f77527eda7e3114467 100644 (file)
@@ -45,9 +45,9 @@ Version:      18
 %if 0%{?suse_version} >= 1500
 # SuSE upstream packages have release numbers like 150200.5.19.1
 # which overrides our packages. Increase our release number on SuSE.
-Release:       rc1_4200001PGDG%{?dist}
+Release:       rc1_4200002PGDG%{?dist}
 %else
-Release:       rc1_1PGDG%{?dist}
+Release:       rc1_2PGDG%{?dist}
 %endif
 License:       PostgreSQL
 Url:           https://www.postgresql.org/
@@ -67,6 +67,7 @@ Source17:     %{sname}-%{pgmajorversion}-setup
 Source10:      %{sname}-%{pgmajorversion}-check-db-dir
 Source18:      %{sname}-%{pgmajorversion}.service
 Source19:      %{sname}-%{pgmajorversion}-tmpfiles.d
+Source20:      %{sname}-%{pgmajorversion}-sysusers.conf
 
 Patch1:                %{sname}-%{pgmajorversion}-rpm-pgsql.patch
 Patch3:                %{sname}-%{pgmajorversion}-conf.patch
@@ -432,7 +433,6 @@ for the backend.
 Summary:       The programs needed to create and run a PostgreSQL server
 Requires:      %{name}%{?_isa} = %{version}-%{release}
 Requires:      %{name}-libs%{?_isa} = %{version}-%{release}
-Requires(pre): /usr/sbin/useradd /usr/sbin/groupadd
 Requires:      util-linux
 %if %liburing
 %if 0%{?fedora} || 0%{?rhel}
@@ -722,6 +722,9 @@ touch -r %{SOURCE10} %{sname}-%{pgmajorversion}-check-db-dir
 %{__install} -d -m 755 %{buildroot}%{pgbaseinstdir}/share/
 %{__install} -m 700 %{SOURCE9} %{buildroot}%{pgbaseinstdir}/share/
 
+# Install sysusers.d config file to allow rpm to create users/groups automatically.
+%{__install} -m 0644 -D %{SOURCE20} %{buildroot}%{_sysusersdir}/%{sname}%{pgpackageversion}.conf
+
 %if %test
        # tests. There are many files included here that are unnecessary,
        # but include them anyway for completeness. We replace the original
@@ -820,11 +823,6 @@ cat initdb-%{pgmajorversion}.lang pg_ctl-%{pgmajorversion}.lang psql-%{pgmajorve
 cat postgres-%{pgmajorversion}.lang pg_resetwal-%{pgmajorversion}.lang pg_checksums-%{pgmajorversion}.lang pg_verifybackup-%{pgmajorversion}.lang pg_controldata-%{pgmajorversion}.lang plpgsql-%{pgmajorversion}.lang pg_test_timing-%{pgmajorversion}.lang pg_test_fsync-%{pgmajorversion}.lang pg_archivecleanup-%{pgmajorversion}.lang pg_waldump-%{pgmajorversion}.lang pg_rewind-%{pgmajorversion}.lang pg_upgrade-%{pgmajorversion}.lang > pg_server.lst
 %endif
 
-%pre server
-groupadd -g 26 -o -r postgres >/dev/null 2>&1 || :
-useradd -M -g postgres -o -r -d /var/lib/pgsql -s /bin/bash \
-       -c "PostgreSQL Server" -u 26 postgres >/dev/null 2>&1 || :
-
 %post server
 /sbin/ldconfig
 if [ $1 -eq 1 ] ; then
@@ -1230,6 +1228,7 @@ fi
 %{pgbaseinstdir}/bin/%{sname}-%{pgmajorversion}-setup
 %{_bindir}/%{sname}-%{pgmajorversion}-setup
 %{pgbaseinstdir}/bin/%{sname}-%{pgmajorversion}-check-db-dir
+%{_sysusersdir}/%{sname}%{pgpackageversion}.conf
 %{_tmpfilesdir}/%{sname}-%{pgmajorversion}.conf
 %{_unitdir}/%{sname}-%{pgmajorversion}.service
 %if %pam
@@ -1304,6 +1303,9 @@ fi
 %endif
 
 %changelog
+* Sun Sep 21 2025 Devrim Gunduz <devrim@gunduz.org> - 18.0rc1-2PGDG
+- Add sysusers.d config file to allow rpm to create users/groups automatically
+
 * Tue Sep 2 2025 Devrim Gunduz <devrim@gunduz.org> - 18.0rc1-1PGDG
 - Update to 18.0 RC1