Change-Id: Id90a159231de28b7ebe8405d39261d223575abe7
Signed-off-by: Shreenidhi Shedi <shreenidhi.shedi@broadcom.com>
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/c/photon/+/23300
Tested-by: gerrit-photon <photon-checkins@vmware.com>
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,41 @@ |
| 0 |
+#!/bin/bash |
|
| 1 |
+ |
|
| 2 |
+# This script verifies that the postgresql data directory has been correctly |
|
| 3 |
+# initialized. We do not want to automatically initdb it, because that has |
|
| 4 |
+# a risk of catastrophic failure (ie, overwriting a valuable database) in |
|
| 5 |
+# corner cases, such as a remotely mounted database on a volume that's a |
|
| 6 |
+# bit slow to mount. But we can at least emit a message advising newbies |
|
| 7 |
+# what to do. |
|
| 8 |
+# |
|
| 9 |
+# Taken from |
|
| 10 |
+# https://gitlab.archlinux.org/archlinux/packaging/packages/postgresql/-/blob/main/postgresql-check-db-dir.in?ref_type=heads |
|
| 11 |
+# modified to Photon's needs |
|
| 12 |
+ |
|
| 13 |
+PGDATA="$1" |
|
| 14 |
+ |
|
| 15 |
+if [ -z "$PGDATA" ]; then |
|
| 16 |
+ echo "Usage: $0 database-path" |
|
| 17 |
+ exit 1 |
|
| 18 |
+fi |
|
| 19 |
+ |
|
| 20 |
+# PGMAJVER is major version |
|
| 21 |
+PGMAJVER=%PGMAJVER% |
|
| 22 |
+ |
|
| 23 |
+# Check for the PGDATA structure |
|
| 24 |
+if [ -f "$PGDATA/PG_VERSION" ] && [ -d "$PGDATA/base" ]; then |
|
| 25 |
+ # Check version of existing PGDATA |
|
| 26 |
+ if [ x`cat "$PGDATA/PG_VERSION"` != x"$PGMAJVER" ]; then |
|
| 27 |
+ echo $"Mismatching version of database format found." |
|
| 28 |
+ echo $"You may need to dump and reload before using PostgreSQL $PGMAJVER." |
|
| 29 |
+ echo $"See http://www.postgresql.org/docs/$PGMAJVER/static/upgrading.html" |
|
| 30 |
+ exit 1 |
|
| 31 |
+ fi |
|
| 32 |
+else |
|
| 33 |
+ # No existing PGDATA! Warn the user to initdb it. |
|
| 34 |
+ echo $"\"$PGDATA\" is missing or empty. Use a command like" |
|
| 35 |
+ echo $" su -l postgres -c \"initdb --encoding=UTF8 -D '$PGDATA'\"" |
|
| 36 |
+ echo $"with relevant options, to initialize the database cluster." |
|
| 37 |
+ exit 1 |
|
| 38 |
+fi |
|
| 39 |
+ |
|
| 40 |
+exit 0 |
| 0 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,34 @@ |
| 0 |
+# It's not recommended to modify this file in-place, because it will be |
|
| 1 |
+# overwritten during package upgrades. It is recommended to use systemd |
|
| 2 |
+# "dropin" feature; i.e. create file with suffix .conf under |
|
| 3 |
+# /etc/systemd/system/UNITNAME.service.d directory overriding the |
|
| 4 |
+# unit's defaults. Look at systemd.unit(5) manual page for more info. |
|
| 5 |
+ |
|
| 6 |
+[Unit] |
|
| 7 |
+Description=PostgreSQL database server |
|
| 8 |
+# We should start postgresql service after network is up (rhbz#2127534 and rhbz#2157651) |
|
| 9 |
+After=network-online.target |
|
| 10 |
+ |
|
| 11 |
+[Service] |
|
| 12 |
+Type=notify |
|
| 13 |
+ |
|
| 14 |
+User=postgres |
|
| 15 |
+Group=postgres |
|
| 16 |
+ |
|
| 17 |
+# Disable OOM kill on the postgres |
|
| 18 |
+OOMScoreAdjust=-1000 |
|
| 19 |
+ |
|
| 20 |
+EnvironmentFile=/etc/sysconfig/%PGNAME%.conf |
|
| 21 |
+ |
|
| 22 |
+# Even though the $PGDATA variable is exported (postgres would accept that) |
|
| 23 |
+# use the -D option here so PGDATA content is printed by /bin/ps and by |
|
| 24 |
+# 'systemctl status'. |
|
| 25 |
+ExecStart=/usr/bin/postgres -D "${PGDATA}"
|
|
| 26 |
+ExecReload=/bin/kill -HUP $MAINPID |
|
| 27 |
+KillMode=mixed |
|
| 28 |
+KillSignal=SIGINT |
|
| 29 |
+# No artificial start/stop timeout (rhbz#1525477, pgrpms#2786). |
|
| 30 |
+TimeoutSec=0 |
|
| 31 |
+ |
|
| 32 |
+[Install] |
|
| 33 |
+WantedBy=multi-user.target |
| ... | ... |
@@ -8,11 +8,12 @@ |
| 8 | 8 |
%global _pgmandir %{_pgdatadir}/man/%{srcname}
|
| 9 | 9 |
%global _pgdocdir %{_pgbaseinstdir}/share/doc/%{srcname}
|
| 10 | 10 |
%define alter_weight 300 |
| 11 |
+%global service_name %{name}.service
|
|
| 11 | 12 |
|
| 12 | 13 |
Summary: PostgreSQL database engine |
| 13 | 14 |
Name: postgresql13 |
| 14 | 15 |
Version: 13.14 |
| 15 |
-Release: 1%{?dist}
|
|
| 16 |
+Release: 2%{?dist}
|
|
| 16 | 17 |
License: PostgreSQL |
| 17 | 18 |
URL: www.postgresql.org |
| 18 | 19 |
Group: Applications/Databases |
| ... | ... |
@@ -22,6 +23,14 @@ Distribution: Photon |
| 22 | 22 |
Source0: http://ftp.postgresql.org/pub/source/v%{version}/%{srcname}-%{version}.tar.bz2
|
| 23 | 23 |
%define sha512 %{srcname}=25d545de69d6ac16b044e09939678af97b6574c71d47d98f95f0ef9ad11ff65e864e503ddff119d73fbb3c61e648e31219982d60da7fc2382ba10e0bfc370aa5
|
| 24 | 24 |
|
| 25 |
+Source1: %{srcname}.tmpfiles.d
|
|
| 26 |
+Source2: %{srcname}.service
|
|
| 27 |
+Source3: %{srcname}-check-db-dir.in
|
|
| 28 |
+Source4: %{srcname}-env-vars.conf
|
|
| 29 |
+Source5: %{srcname}.preset
|
|
| 30 |
+Source6: %{srcname}.sysusers
|
|
| 31 |
+Source7: systemd-unit-instructions |
|
| 32 |
+ |
|
| 25 | 33 |
BuildRequires: clang-devel |
| 26 | 34 |
BuildRequires: gettext-devel |
| 27 | 35 |
BuildRequires: krb5-devel |
| ... | ... |
@@ -176,7 +185,7 @@ for the backend. |
| 176 | 176 |
%autosetup -p1 -n %{srcname}-%{version}
|
| 177 | 177 |
|
| 178 | 178 |
%build |
| 179 |
-sed -i '/DEFAULT_PGSOCKET_DIR/s@/tmp@/run/postgresql@' src/include/pg_config_manual.h |
|
| 179 |
+sed -i '/DEFAULT_PGSOCKET_DIR/s@/tmp@/run/%{srcname}@' src/include/pg_config_manual.h
|
|
| 180 | 180 |
|
| 181 | 181 |
# Note that %configure is not used here as this command relies on non-default |
| 182 | 182 |
# values. |
| ... | ... |
@@ -209,10 +218,12 @@ sh ./configure \ |
| 209 | 209 |
--docdir=%{_pgdocdir} \
|
| 210 | 210 |
--mandir=%{_pgmandir}
|
| 211 | 211 |
|
| 212 |
-make world %{?_smp_mflags}
|
|
| 212 |
+%make_build world |
|
| 213 | 213 |
|
| 214 | 214 |
%install |
| 215 |
-make install-world DESTDIR=%{buildroot} %{?_smp_mflags}
|
|
| 215 |
+%make_install install-world |
|
| 216 |
+ |
|
| 217 |
+%include %{SOURCE7}
|
|
| 216 | 218 |
|
| 217 | 219 |
# Remove anything related to Python 2. These have no need to be |
| 218 | 220 |
# around as only Python 3 is supported. |
| ... | ... |
@@ -269,11 +280,9 @@ cat postgres-%{pgmajorversion}.lang pg_resetwal-%{pgmajorversion}.lang \
|
| 269 | 269 |
pg_archivecleanup-%{pgmajorversion}.lang pg_waldump-%{pgmajorversion}.lang \
|
| 270 | 270 |
pg_rewind-%{pgmajorversion}.lang pg_upgrade-%{pgmajorversion}.lang >> pg_i18n.lst
|
| 271 | 271 |
|
| 272 |
-%if 0%{?with_check}
|
|
| 273 | 272 |
%check |
| 274 | 273 |
# Run the main regression test suites in the source tree. |
| 275 |
-run_test_path() |
|
| 276 |
-{
|
|
| 274 |
+run_test_path() {
|
|
| 277 | 275 |
make_path="$1" |
| 278 | 276 |
chown -Rv nobody . |
| 279 | 277 |
sudo -u nobody -s /bin/bash -c "PATH=$PATH make -C $make_path -k check" |
| ... | ... |
@@ -289,7 +298,6 @@ run_test_path "src/test/authentication" |
| 289 | 289 |
run_test_path "src/test/recovery" |
| 290 | 290 |
run_test_path "src/test/ssl" |
| 291 | 291 |
run_test_path "src/test/subscription" |
| 292 |
-%endif |
|
| 293 | 292 |
|
| 294 | 293 |
%post |
| 295 | 294 |
/sbin/ldconfig |
| ... | ... |
@@ -323,7 +331,8 @@ alternatives --remove clusterdb %{_pgbindir}/clusterdb
|
| 323 | 323 |
/sbin/ldconfig |
| 324 | 324 |
|
| 325 | 325 |
%posttrans libs |
| 326 |
-alternatives --install %{_sysconfdir}/ld.so.conf.d/%{srcname}.conf %{srcname}.conf %{_pgbaseinstdir}/%{srcname}.conf %{alter_weight}
|
|
| 326 |
+alternatives --install %{_sysconfdir}/ld.so.conf.d/%{srcname}.conf \
|
|
| 327 |
+ %{srcname}.conf %{_pgbaseinstdir}/%{srcname}.conf %{alter_weight}
|
|
| 327 | 328 |
/sbin/ldconfig |
| 328 | 329 |
|
| 329 | 330 |
%postun libs |
| ... | ... |
@@ -357,7 +366,18 @@ alternatives --install %{_bindir}/initdb initdb %{_pgbindir}/initdb %{alter_weig
|
| 357 | 357 |
|
| 358 | 358 |
/sbin/ldconfig |
| 359 | 359 |
|
| 360 |
+%pre server |
|
| 361 |
+%sysusers_create_compat %{SOURCE6}
|
|
| 362 |
+ |
|
| 363 |
+%preun server |
|
| 364 |
+%systemd_preun %{service_name}
|
|
| 365 |
+ |
|
| 366 |
+%post server |
|
| 367 |
+/sbin/ldconfig |
|
| 368 |
+%systemd_post %{service_name}
|
|
| 369 |
+ |
|
| 360 | 370 |
%postun server |
| 371 |
+%systemd_postun_with_restart %{service_name}
|
|
| 361 | 372 |
alternatives --remove initdb %{_pgbindir}/initdb
|
| 362 | 373 |
/sbin/ldconfig |
| 363 | 374 |
|
| ... | ... |
@@ -475,6 +495,15 @@ rm -rf %{buildroot}/*
|
| 475 | 475 |
%{_pglibdir}/pgoutput.so
|
| 476 | 476 |
%{_pglibdir}/plpgsql.so
|
| 477 | 477 |
%{_pglibdir}/*_and_*.so
|
| 478 |
+%{_tmpfilesdir}/%{name}.conf
|
|
| 479 |
+%{_unitdir}/%{name}.service
|
|
| 480 |
+%{_presetdir}/99-%{name}.preset
|
|
| 481 |
+%attr(700,postgres,postgres) %dir %{_sharedstatedir}/pgsql/%{name}
|
|
| 482 |
+%attr(755,postgres,postgres) %dir %{_var}/run/%{srcname}
|
|
| 483 |
+%attr(700,postgres,postgres) %dir %{_sharedstatedir}/pgsql
|
|
| 484 |
+%attr(644,postgres,postgres) %config(noreplace) %{_sysconfdir}/sysconfig/%{name}.conf
|
|
| 485 |
+%{_libexecdir}/%{name}-check-db-dir
|
|
| 486 |
+%{_sysusersdir}/%{name}.sysusers
|
|
| 478 | 487 |
|
| 479 | 488 |
%files i18n -f pg_i18n.lst |
| 480 | 489 |
|
| ... | ... |
@@ -638,6 +667,8 @@ rm -rf %{buildroot}/*
|
| 638 | 638 |
%{_pglibdir}/plpython3.so
|
| 639 | 639 |
|
| 640 | 640 |
%changelog |
| 641 |
+* Sat Feb 17 2024 Shreenidhi Shedi <shreenidhi.shedi@broadcom.com> 13.14-2 |
|
| 642 |
+- Add systemd unit file |
|
| 641 | 643 |
* Mon Feb 12 2024 Shreenidhi Shedi <shreenidhi.shedi@broadcom.com> 13.14-1 |
| 642 | 644 |
- Upgrade to v13.14 |
| 643 | 645 |
* Sun Nov 19 2023 Shreenidhi Shedi <sshedi@vmware.com> 13.13-2 |
| ... | ... |
@@ -8,11 +8,12 @@ |
| 8 | 8 |
%global _pgmandir %{_pgdatadir}/man/%{srcname}
|
| 9 | 9 |
%global _pgdocdir %{_pgbaseinstdir}/share/doc/%{srcname}
|
| 10 | 10 |
%define alter_weight 400 |
| 11 |
+%global service_name %{name}.service
|
|
| 11 | 12 |
|
| 12 | 13 |
Summary: PostgreSQL database engine |
| 13 | 14 |
Name: postgresql14 |
| 14 | 15 |
Version: 14.11 |
| 15 |
-Release: 1%{?dist}
|
|
| 16 |
+Release: 2%{?dist}
|
|
| 16 | 17 |
License: PostgreSQL |
| 17 | 18 |
URL: www.postgresql.org |
| 18 | 19 |
Group: Applications/Databases |
| ... | ... |
@@ -22,6 +23,14 @@ Distribution: Photon |
| 22 | 22 |
Source0: http://ftp.postgresql.org/pub/source/v%{version}/%{srcname}-%{version}.tar.bz2
|
| 23 | 23 |
%define sha512 %{srcname}=67289cd638ed7b13e845263d5a34394347f33735d9e2fafd6aa3562989a3a9455ea547d1b5079138648f33b093e77841654188fc74a49c0d6d458a42cfb57ffe
|
| 24 | 24 |
|
| 25 |
+Source1: %{srcname}.tmpfiles.d
|
|
| 26 |
+Source2: %{srcname}.service
|
|
| 27 |
+Source3: %{srcname}-check-db-dir.in
|
|
| 28 |
+Source4: %{srcname}-env-vars.conf
|
|
| 29 |
+Source5: %{srcname}.preset
|
|
| 30 |
+Source6: %{srcname}.sysusers
|
|
| 31 |
+Source7: systemd-unit-instructions |
|
| 32 |
+ |
|
| 25 | 33 |
BuildRequires: clang-devel |
| 26 | 34 |
BuildRequires: gettext-devel |
| 27 | 35 |
BuildRequires: krb5-devel |
| ... | ... |
@@ -29,7 +38,6 @@ BuildRequires: icu-devel |
| 29 | 29 |
BuildRequires: libedit-devel |
| 30 | 30 |
BuildRequires: libxml2-devel |
| 31 | 31 |
BuildRequires: libxslt-devel |
| 32 |
-BuildRequires: linux-api-headers |
|
| 33 | 32 |
BuildRequires: Linux-PAM-devel |
| 34 | 33 |
BuildRequires: llvm-devel |
| 35 | 34 |
BuildRequires: lz4-devel |
| ... | ... |
@@ -188,7 +196,7 @@ for the backend. |
| 188 | 188 |
%autosetup -p1 -n %{srcname}-%{version}
|
| 189 | 189 |
|
| 190 | 190 |
%build |
| 191 |
-sed -i '/DEFAULT_PGSOCKET_DIR/s@/tmp@/run/postgresql@' src/include/pg_config_manual.h |
|
| 191 |
+sed -i '/DEFAULT_PGSOCKET_DIR/s@/tmp@/run/%{srcname}@' src/include/pg_config_manual.h
|
|
| 192 | 192 |
|
| 193 | 193 |
sh ./configure \ |
| 194 | 194 |
--prefix=%{_pgbaseinstdir} \
|
| ... | ... |
@@ -220,10 +228,12 @@ sh ./configure \ |
| 220 | 220 |
--docdir=%{_pgdocdir} \
|
| 221 | 221 |
--mandir=%{_pgmandir}
|
| 222 | 222 |
|
| 223 |
-make world %{?_smp_mflags}
|
|
| 223 |
+%make_build world |
|
| 224 | 224 |
|
| 225 | 225 |
%install |
| 226 |
-make install-world DESTDIR=%{buildroot} %{?_smp_mflags}
|
|
| 226 |
+%make_install install-world |
|
| 227 |
+ |
|
| 228 |
+%include %{SOURCE7}
|
|
| 227 | 229 |
|
| 228 | 230 |
# Remove anything related to Python 2. These have no need to be |
| 229 | 231 |
# around as only Python 3 is supported. |
| ... | ... |
@@ -281,11 +291,9 @@ cat postgres-%{pgmajorversion}.lang pg_resetwal-%{pgmajorversion}.lang \
|
| 281 | 281 |
pg_archivecleanup-%{pgmajorversion}.lang pg_waldump-%{pgmajorversion}.lang \
|
| 282 | 282 |
pg_rewind-%{pgmajorversion}.lang pg_upgrade-%{pgmajorversion}.lang >> pg_i18n.lst
|
| 283 | 283 |
|
| 284 |
-%if 0%{?with_check}
|
|
| 285 | 284 |
%check |
| 286 | 285 |
# Run the main regression test suites in the source tree. |
| 287 |
-run_test_path() |
|
| 288 |
-{
|
|
| 286 |
+run_test_path() {
|
|
| 289 | 287 |
make_path="$1" |
| 290 | 288 |
chown -Rv nobody . |
| 291 | 289 |
sudo -u nobody -s /bin/bash -c "PATH=$PATH make -C $make_path -k check" |
| ... | ... |
@@ -301,7 +309,6 @@ run_test_path "src/test/authentication" |
| 301 | 301 |
run_test_path "src/test/recovery" |
| 302 | 302 |
run_test_path "src/test/ssl" |
| 303 | 303 |
run_test_path "src/test/subscription" |
| 304 |
-%endif |
|
| 305 | 304 |
|
| 306 | 305 |
%post |
| 307 | 306 |
/sbin/ldconfig |
| ... | ... |
@@ -370,7 +377,18 @@ alternatives --install %{_bindir}/initdb initdb %{_pgbindir}/initdb %{alter_weig
|
| 370 | 370 |
|
| 371 | 371 |
/sbin/ldconfig |
| 372 | 372 |
|
| 373 |
+%pre server |
|
| 374 |
+%sysusers_create_compat %{SOURCE6}
|
|
| 375 |
+ |
|
| 376 |
+%preun server |
|
| 377 |
+%systemd_preun %{service_name}
|
|
| 378 |
+ |
|
| 379 |
+%post server |
|
| 380 |
+/sbin/ldconfig |
|
| 381 |
+%systemd_post %{service_name}
|
|
| 382 |
+ |
|
| 373 | 383 |
%postun server |
| 384 |
+%systemd_postun_with_restart %{service_name}
|
|
| 374 | 385 |
alternatives --remove initdb %{_pgbindir}/initdb
|
| 375 | 386 |
/sbin/ldconfig |
| 376 | 387 |
|
| ... | ... |
@@ -491,6 +509,15 @@ rm -rf %{buildroot}/*
|
| 491 | 491 |
%{_pglibdir}/pgoutput.so
|
| 492 | 492 |
%{_pglibdir}/plpgsql.so
|
| 493 | 493 |
%{_pglibdir}/*_and_*.so
|
| 494 |
+%{_tmpfilesdir}/%{name}.conf
|
|
| 495 |
+%{_unitdir}/%{name}.service
|
|
| 496 |
+%{_presetdir}/99-%{name}.preset
|
|
| 497 |
+%attr(700,postgres,postgres) %dir %{_sharedstatedir}/pgsql/%{name}
|
|
| 498 |
+%attr(755,postgres,postgres) %dir %{_var}/run/%{srcname}
|
|
| 499 |
+%attr(700,postgres,postgres) %dir %{_sharedstatedir}/pgsql
|
|
| 500 |
+%attr(644,postgres,postgres) %config(noreplace) %{_sysconfdir}/sysconfig/%{name}.conf
|
|
| 501 |
+%{_libexecdir}/%{name}-check-db-dir
|
|
| 502 |
+%{_sysusersdir}/%{name}.sysusers
|
|
| 494 | 503 |
|
| 495 | 504 |
%files i18n -f pg_i18n.lst |
| 496 | 505 |
|
| ... | ... |
@@ -655,6 +682,8 @@ rm -rf %{buildroot}/*
|
| 655 | 655 |
%{_pglibdir}/plpython3.so
|
| 656 | 656 |
|
| 657 | 657 |
%changelog |
| 658 |
+* Sat Feb 17 2024 Shreenidhi Shedi <shreenidhi.shedi@broadcom.com> 14.11-2 |
|
| 659 |
+- Add systemd unit file |
|
| 658 | 660 |
* Mon Feb 12 2024 Shreenidhi Shedi <shreenidhi.shedi@broadcom.com> 14.11-1 |
| 659 | 661 |
- Upgrade to v14.11 |
| 660 | 662 |
* Sun Nov 19 2023 Shreenidhi Shedi <sshedi@vmware.com> 14.10-2 |
| ... | ... |
@@ -8,11 +8,12 @@ |
| 8 | 8 |
%global _pgmandir %{_pgdatadir}/man/%{srcname}
|
| 9 | 9 |
%global _pgdocdir %{_pgbaseinstdir}/share/doc/%{srcname}
|
| 10 | 10 |
%define alter_weight 500 |
| 11 |
+%global service_name %{name}.service
|
|
| 11 | 12 |
|
| 12 | 13 |
Summary: PostgreSQL database engine |
| 13 | 14 |
Name: postgresql15 |
| 14 | 15 |
Version: 15.6 |
| 15 |
-Release: 1%{?dist}
|
|
| 16 |
+Release: 2%{?dist}
|
|
| 16 | 17 |
License: PostgreSQL |
| 17 | 18 |
URL: www.postgresql.org |
| 18 | 19 |
Group: Applications/Databases |
| ... | ... |
@@ -22,8 +23,16 @@ Distribution: Photon |
| 22 | 22 |
Source0: http://ftp.postgresql.org/pub/source/v%{version}/%{srcname}-%{version}.tar.bz2
|
| 23 | 23 |
%define sha512 %{srcname}=d9f158d844ec21bc5a7eccad9193dfe026d3df46a011980412ad7d150b3894c01754be0053bed530976047d7eff657204ac321138ba8da6eac8fb7b93b9520ad
|
| 24 | 24 |
|
| 25 |
+Source1: %{srcname}.tmpfiles.d
|
|
| 26 |
+Source2: %{srcname}.service
|
|
| 27 |
+Source3: %{srcname}-check-db-dir.in
|
|
| 28 |
+Source4: %{srcname}-env-vars.conf
|
|
| 29 |
+Source5: %{srcname}.preset
|
|
| 30 |
+Source6: %{srcname}.sysusers
|
|
| 31 |
+Source7: systemd-unit-instructions |
|
| 32 |
+ |
|
| 25 | 33 |
BuildRequires: clang-devel |
| 26 |
-BuildRequires: gettext-devel |
|
| 34 |
+BuildRequires: gettext |
|
| 27 | 35 |
BuildRequires: krb5-devel |
| 28 | 36 |
BuildRequires: icu-devel |
| 29 | 37 |
BuildRequires: libedit-devel |
| ... | ... |
@@ -187,7 +196,7 @@ for the backend. |
| 187 | 187 |
%autosetup -p1 -n %{srcname}-%{version}
|
| 188 | 188 |
|
| 189 | 189 |
%build |
| 190 |
-sed -i '/DEFAULT_PGSOCKET_DIR/s@/tmp@/run/postgresql@' src/include/pg_config_manual.h |
|
| 190 |
+sed -i '/DEFAULT_PGSOCKET_DIR/s@/tmp@/run/%{srcname}@' src/include/pg_config_manual.h
|
|
| 191 | 191 |
|
| 192 | 192 |
sh ./configure \ |
| 193 | 193 |
--prefix=%{_pgbaseinstdir} \
|
| ... | ... |
@@ -219,10 +228,12 @@ sh ./configure \ |
| 219 | 219 |
--docdir=%{_pgdocdir} \
|
| 220 | 220 |
--mandir=%{_pgmandir}
|
| 221 | 221 |
|
| 222 |
-make world %{?_smp_mflags}
|
|
| 222 |
+%make_build world |
|
| 223 | 223 |
|
| 224 | 224 |
%install |
| 225 |
-make install-world DESTDIR=%{buildroot} %{?_smp_mflags}
|
|
| 225 |
+%make_install install-world |
|
| 226 |
+ |
|
| 227 |
+%include %{SOURCE7}
|
|
| 226 | 228 |
|
| 227 | 229 |
# Remove anything related to Python 2. These have no need to be |
| 228 | 230 |
# around as only Python 3 is supported. |
| ... | ... |
@@ -280,11 +291,9 @@ cat postgres-%{pgmajorversion}.lang pg_resetwal-%{pgmajorversion}.lang \
|
| 280 | 280 |
pg_archivecleanup-%{pgmajorversion}.lang pg_waldump-%{pgmajorversion}.lang \
|
| 281 | 281 |
pg_rewind-%{pgmajorversion}.lang pg_upgrade-%{pgmajorversion}.lang >> pg_i18n.lst
|
| 282 | 282 |
|
| 283 |
-%if 0%{?with_check}
|
|
| 284 | 283 |
%check |
| 285 | 284 |
# Run the main regression test suites in the source tree. |
| 286 |
-run_test_path() |
|
| 287 |
-{
|
|
| 285 |
+run_test_path() {
|
|
| 288 | 286 |
make_path="$1" |
| 289 | 287 |
chown -Rv nobody . |
| 290 | 288 |
sudo -u nobody -s /bin/bash -c "PATH=$PATH make -C $make_path -k check" |
| ... | ... |
@@ -300,7 +309,6 @@ run_test_path "src/test/authentication" |
| 300 | 300 |
run_test_path "src/test/recovery" |
| 301 | 301 |
run_test_path "src/test/ssl" |
| 302 | 302 |
run_test_path "src/test/subscription" |
| 303 |
-%endif |
|
| 304 | 303 |
|
| 305 | 304 |
%post |
| 306 | 305 |
/sbin/ldconfig |
| ... | ... |
@@ -369,7 +377,18 @@ alternatives --install %{_bindir}/initdb initdb %{_pgbindir}/initdb %{alter_weig
|
| 369 | 369 |
|
| 370 | 370 |
/sbin/ldconfig |
| 371 | 371 |
|
| 372 |
+%pre server |
|
| 373 |
+%sysusers_create_compat %{SOURCE6}
|
|
| 374 |
+ |
|
| 375 |
+%preun server |
|
| 376 |
+%systemd_preun %{service_name}
|
|
| 377 |
+ |
|
| 378 |
+%post server |
|
| 379 |
+/sbin/ldconfig |
|
| 380 |
+%systemd_post %{service_name}
|
|
| 381 |
+ |
|
| 372 | 382 |
%postun server |
| 383 |
+%systemd_postun_with_restart %{service_name}
|
|
| 373 | 384 |
alternatives --remove initdb %{_pgbindir}/initdb
|
| 374 | 385 |
/sbin/ldconfig |
| 375 | 386 |
|
| ... | ... |
@@ -490,6 +509,15 @@ rm -rf %{buildroot}/*
|
| 490 | 490 |
%{_pglibdir}/pgoutput.so
|
| 491 | 491 |
%{_pglibdir}/plpgsql.so
|
| 492 | 492 |
%{_pglibdir}/*_and_*.so
|
| 493 |
+%{_tmpfilesdir}/%{name}.conf
|
|
| 494 |
+%{_unitdir}/%{name}.service
|
|
| 495 |
+%{_presetdir}/99-%{name}.preset
|
|
| 496 |
+%attr(700,postgres,postgres) %dir %{_sharedstatedir}/pgsql/%{name}
|
|
| 497 |
+%attr(755,postgres,postgres) %dir %{_var}/run/%{srcname}
|
|
| 498 |
+%attr(700,postgres,postgres) %dir %{_sharedstatedir}/pgsql
|
|
| 499 |
+%attr(644,postgres,postgres) %config(noreplace) %{_sysconfdir}/sysconfig/%{name}.conf
|
|
| 500 |
+%{_libexecdir}/%{name}-check-db-dir
|
|
| 501 |
+%{_sysusersdir}/%{name}.sysusers
|
|
| 493 | 502 |
|
| 494 | 503 |
%files i18n -f pg_i18n.lst |
| 495 | 504 |
|
| ... | ... |
@@ -658,6 +686,8 @@ rm -rf %{buildroot}/*
|
| 658 | 658 |
%{_pglibdir}/plpython3.so
|
| 659 | 659 |
|
| 660 | 660 |
%changelog |
| 661 |
+* Sat Feb 17 2024 Shreenidhi Shedi <shreenidhi.shedi@broadcom.com> 15.6-2 |
|
| 662 |
+- Add systemd unit file |
|
| 661 | 663 |
* Mon Feb 12 2024 Shreenidhi Shedi <shreenidhi.shedi@broadcom.com> 15.6-1 |
| 662 | 664 |
- Upgrade to v15.6 |
| 663 | 665 |
* Sun Nov 19 2023 Shreenidhi Shedi <sshedi@vmware.com> 15.5-2 |
| ... | ... |
@@ -8,11 +8,12 @@ |
| 8 | 8 |
%global _pgmandir %{_pgdatadir}/man/%{srcname}
|
| 9 | 9 |
%global _pgdocdir %{_pgbaseinstdir}/share/doc/%{srcname}
|
| 10 | 10 |
%define alter_weight 600 |
| 11 |
+%global service_name %{name}.service
|
|
| 11 | 12 |
|
| 12 | 13 |
Summary: PostgreSQL database engine |
| 13 | 14 |
Name: postgresql16 |
| 14 | 15 |
Version: 16.2 |
| 15 |
-Release: 1%{?dist}
|
|
| 16 |
+Release: 2%{?dist}
|
|
| 16 | 17 |
License: PostgreSQL |
| 17 | 18 |
URL: www.postgresql.org |
| 18 | 19 |
Group: Applications/Databases |
| ... | ... |
@@ -22,6 +23,14 @@ Distribution: Photon |
| 22 | 22 |
Source0: http://ftp.postgresql.org/pub/source/v%{version}/%{srcname}-%{version}.tar.bz2
|
| 23 | 23 |
%define sha512 %{srcname}=3194941cc3f1ec86b6cf4f08c6422d268d99890441f8fc9ab87b6a7fd16c990fa230b544308644cbef54e6960c4984e3703752e40930bdc0537b7bfda3ab7ccf
|
| 24 | 24 |
|
| 25 |
+Source1: %{srcname}.tmpfiles.d
|
|
| 26 |
+Source2: %{srcname}.service
|
|
| 27 |
+Source3: %{srcname}-check-db-dir.in
|
|
| 28 |
+Source4: %{srcname}-env-vars.conf
|
|
| 29 |
+Source5: %{srcname}.preset
|
|
| 30 |
+Source6: %{srcname}.sysusers
|
|
| 31 |
+Source7: systemd-unit-instructions |
|
| 32 |
+ |
|
| 25 | 33 |
BuildRequires: clang-devel |
| 26 | 34 |
BuildRequires: gettext-devel |
| 27 | 35 |
BuildRequires: krb5-devel |
| ... | ... |
@@ -188,7 +197,7 @@ for the backend. |
| 188 | 188 |
%autosetup -p1 -n %{srcname}-%{version}
|
| 189 | 189 |
|
| 190 | 190 |
%build |
| 191 |
-sed -i '/DEFAULT_PGSOCKET_DIR/s@/tmp@/run/postgresql@' src/include/pg_config_manual.h |
|
| 191 |
+sed -i '/DEFAULT_PGSOCKET_DIR/s@/tmp@/run/%{srcname}@' src/include/pg_config_manual.h
|
|
| 192 | 192 |
|
| 193 | 193 |
sh ./configure \ |
| 194 | 194 |
--prefix=%{_pgbaseinstdir} \
|
| ... | ... |
@@ -225,6 +234,8 @@ sh ./configure \ |
| 225 | 225 |
%install |
| 226 | 226 |
%make_install install-world |
| 227 | 227 |
|
| 228 |
+%include %{SOURCE7}
|
|
| 229 |
+ |
|
| 228 | 230 |
# Remove anything related to Python 2. These have no need to be |
| 229 | 231 |
# around as only Python 3 is supported. |
| 230 | 232 |
rm -f %{buildroot}%{_pgdatadir}/extension/*plpython2u* \
|
| ... | ... |
@@ -366,7 +377,18 @@ alternatives --install %{_bindir}/initdb initdb %{_pgbindir}/initdb %{alter_weig
|
| 366 | 366 |
|
| 367 | 367 |
/sbin/ldconfig |
| 368 | 368 |
|
| 369 |
+%pre server |
|
| 370 |
+%sysusers_create_compat %{SOURCE6}
|
|
| 371 |
+ |
|
| 372 |
+%preun server |
|
| 373 |
+%systemd_preun %{service_name}
|
|
| 374 |
+ |
|
| 375 |
+%post server |
|
| 376 |
+/sbin/ldconfig |
|
| 377 |
+%systemd_post %{service_name}
|
|
| 378 |
+ |
|
| 369 | 379 |
%postun server |
| 380 |
+%systemd_postun_with_restart %{service_name}
|
|
| 370 | 381 |
alternatives --remove initdb %{_pgbindir}/initdb
|
| 371 | 382 |
/sbin/ldconfig |
| 372 | 383 |
|
| ... | ... |
@@ -485,6 +507,15 @@ rm -rf %{buildroot}/*
|
| 485 | 485 |
%{_pglibdir}/pgoutput.so
|
| 486 | 486 |
%{_pglibdir}/plpgsql.so
|
| 487 | 487 |
%{_pglibdir}/*_and_*.so
|
| 488 |
+%{_tmpfilesdir}/%{name}.conf
|
|
| 489 |
+%{_unitdir}/%{name}.service
|
|
| 490 |
+%{_presetdir}/99-%{name}.preset
|
|
| 491 |
+%attr(700,postgres,postgres) %dir %{_sharedstatedir}/pgsql/%{name}
|
|
| 492 |
+%attr(755,postgres,postgres) %dir %{_var}/run/%{srcname}
|
|
| 493 |
+%attr(700,postgres,postgres) %dir %{_sharedstatedir}/pgsql
|
|
| 494 |
+%attr(644,postgres,postgres) %config(noreplace) %{_sysconfdir}/sysconfig/%{name}.conf
|
|
| 495 |
+%{_libexecdir}/%{name}-check-db-dir
|
|
| 496 |
+%{_sysusersdir}/%{name}.sysusers
|
|
| 488 | 497 |
|
| 489 | 498 |
%files i18n -f pg_i18n.lst |
| 490 | 499 |
|
| ... | ... |
@@ -653,6 +684,8 @@ rm -rf %{buildroot}/*
|
| 653 | 653 |
%{_pglibdir}/plpython3.so
|
| 654 | 654 |
|
| 655 | 655 |
%changelog |
| 656 |
+* Sat Feb 17 2024 Shreenidhi Shedi <shreenidhi.shedi@broadcom.com> 16.2-2 |
|
| 657 |
+- Add systemd unit file |
|
| 656 | 658 |
* Mon Feb 12 2024 Shreenidhi Shedi <shreenidhi.shedi@broadcom.com> 16.2-1 |
| 657 | 659 |
- Upgrade to v16.2 |
| 658 | 660 |
* Tue Nov 14 2023 Shreenidhi Shedi <sshedi@vmware.com> 16.1-1 |
| 659 | 661 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,21 @@ |
| 0 |
+mkdir -p %{buildroot}{%{_tmpfilesdir},%{_unitdir},%{_libexecdir}} \
|
|
| 1 |
+ %{buildroot}{%{_sysconfdir}/sysconfig,%{_presetdir}}
|
|
| 2 |
+ |
|
| 3 |
+install -m 0644 %{SOURCE1} %{buildroot}%{_tmpfilesdir}/%{name}.conf
|
|
| 4 |
+ |
|
| 5 |
+sed -i -e "s/%PGNAME%/%{name}/g" %{SOURCE2}
|
|
| 6 |
+cp %{SOURCE2} %{buildroot}%{_unitdir}/%{name}.service
|
|
| 7 |
+ |
|
| 8 |
+sed -i -e "s/%PGMAJVER%/%{pgmajorversion}/g" %{SOURCE3}
|
|
| 9 |
+install -m 755 %{SOURCE3} %{buildroot}%{_libexecdir}/%{name}-check-db-dir
|
|
| 10 |
+ |
|
| 11 |
+sed -i -e "s/%PGNAME%/%{name}/g" %{SOURCE4}
|
|
| 12 |
+install -m 644 %{SOURCE4} %{buildroot}%{_sysconfdir}/sysconfig/%{name}.conf
|
|
| 13 |
+ |
|
| 14 |
+sed -i -e "s/%PGNAME%/%{name}/g" %{SOURCE5}
|
|
| 15 |
+cp %{SOURCE5} %{buildroot}%{_presetdir}/99-%{name}.preset
|
|
| 16 |
+ |
|
| 17 |
+install -p -D -m 0644 %{SOURCE6} %{buildroot}%{_sysusersdir}/%{name}.sysusers
|
|
| 18 |
+ |
|
| 19 |
+install -d -m 755 %{buildroot}%{_var}/run/%{srcname}
|
|
| 20 |
+install -d -m 700 %{buildroot}%{_sharedstatedir}/pgsql/%{name}
|