diff --git a/README.md b/README.md index 07a82cb..5c017e5 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,6 @@ PostgreSQL is an object-relational database management system (ORDBMS) based on POSTGRES, Version 4.2, developed at the University of California at Berkeley Computer Science Department. The POSTGRES project, led by Professor Michael Stonebraker, was sponsored by the Defense Advanced Research Projects Agency (DARPA), the Army Research Office (ARO), the National Science Foundation (NSF), and ESL, Inc. - PostgreSQL is an open-source descendant of this original Berkeley code. It provides SQL92/SQL99 language support and other modern features. diff --git a/postgresql-13.1-run-socket.patch b/postgresql-13.1-run-socket.patch new file mode 100644 index 0000000..be7b467 --- /dev/null +++ b/postgresql-13.1-run-socket.patch @@ -0,0 +1,12 @@ +diff -upr postgresql-13.1.orig/src/include/pg_config_manual.h postgresql-13.1/src/include/pg_config_manual.h +--- postgresql-13.1.orig/src/include/pg_config_manual.h 2020-11-10 00:24:30.000000000 +0200 ++++ postgresql-13.1/src/include/pg_config_manual.h 2020-12-10 01:55:35.999605194 +0200 +@@ -201,7 +201,7 @@ + * support them yet. + */ + #ifndef WIN32 +-#define DEFAULT_PGSOCKET_DIR "/tmp" ++#define DEFAULT_PGSOCKET_DIR "/run/postgresql" + #else + #define DEFAULT_PGSOCKET_DIR "" + #endif diff --git a/postgresql.service b/postgresql.service new file mode 100644 index 0000000..76d5645 --- /dev/null +++ b/postgresql.service @@ -0,0 +1,42 @@ +[Unit] +Description=PostgreSQL database server +After=network.target + +[Service] +Type=notify +TimeoutSec=120 +User=postgres +Group=postgres + +Environment=PGROOT=/var/lib/pgsql + +SyslogIdentifier=postgres +PIDFile=/var/lib/pgsql/data/postmaster.pid +RuntimeDirectory=postgresql +RuntimeDirectoryMode=755 + +ExecStart=/usr/bin/postgres -D ${PGROOT}/data +ExecReload=/bin/kill -HUP ${MAINPID} +KillMode=mixed +KillSignal=SIGINT + +# Due to PostgreSQL's use of shared memory, OOM killer is often overzealous in +# killing Postgres, so adjust it downward +OOMScoreAdjust=-200 + +# Additional security-related features +PrivateTmp=true +ProtectHome=true +ProtectSystem=full +NoNewPrivileges=true +ProtectControlGroups=true +ProtectKernelModules=true +ProtectKernelTunables=true +PrivateDevices=true +RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 +RestrictNamespaces=true +RestrictRealtime=true +SystemCallArchitectures=native + +[Install] +WantedBy=multi-user.target diff --git a/postgresql.spec b/postgresql.spec index e146032..0151eba 100644 --- a/postgresql.spec +++ b/postgresql.spec @@ -4,7 +4,7 @@ Name: postgresql Version: 13.1 -Release: 1mamba +Release: 2mamba Summary: An object-relational database management system (ORDBMS) Group: Applications/Databases Vendor: openmamba @@ -13,33 +13,34 @@ Packager: Silvan Calarco URL: http://www.postgresql.org Source0: https://ftp.postgresql.org/pub/source/v%{version}/postgresql-%{version}.tar.bz2 Source1: postgresql-initscript -#Source2: http://www.postgresql.org/files/documentation/pdf/%{majver}/postgresql-%{majver}-US.pdf +Source2: postgresql.service +Source3: postgresql.tmpfiles +Patch0: postgresql-13.1-run-socket.patch License: BSD -BuildRequires: flex ## AUTOBUILDREQ-BEGIN BuildRequires: glibc-devel -BuildRequires: libe2fs-devel +BuildRequires: ldconfig BuildRequires: libkrb5-devel -BuildRequires: libncurses-devel BuildRequires: libopenldap-devel BuildRequires: libopenssl-devel -BuildRequires: libpython-devel +BuildRequires: libpam-devel +BuildRequires: libperl +BuildRequires: libpython3-devel BuildRequires: libreadline-devel +BuildRequires: libsystemd-devel BuildRequires: libtcl-devel -BuildRequires: libxml2-devel -BuildRequires: libxslt-devel BuildRequires: libz-devel -BuildRequires: pam-devel -BuildRequires: perl-devel ## AUTOBUILDREQ-END -Requires(pre): /usr/sbin/groupadd, /usr/sbin/useradd, /sbin/chkconfig +BuildRequires: flex +Requires(pre): /usr/sbin/groupadd +Requires(pre): /usr/sbin/useradd +%systemd_requires +Requires: lib%{name} = %{?epoch:%epoch:}%{version}-%{release} BuildRoot: %{_tmppath}/%{name}-%{version}-root -Requires: lib%{name} == %{version} %description PostgreSQL is an object-relational database management system (ORDBMS) based on POSTGRES, Version 4.2, developed at the University of California at Berkeley Computer Science Department. The POSTGRES project, led by Professor Michael Stonebraker, was sponsored by the Defense Advanced Research Projects Agency (DARPA), the Army Research Office (ARO), the National Science Foundation (NSF), and ESL, Inc. - PostgreSQL is an open-source descendant of this original Berkeley code. It provides SQL92/SQL99 language support and other modern features. @@ -50,94 +51,79 @@ Group: System/Libraries %description -n lib%{name} PostgreSQL is an object-relational database management system (ORDBMS) based on POSTGRES, Version 4.2, developed at the University of California at Berkeley Computer Science Department. The POSTGRES project, led by Professor Michael Stonebraker, was sponsored by the Defense Advanced Research Projects Agency (DARPA), the Army Research Office (ARO), the National Science Foundation (NSF), and ESL, Inc. - This package contains the libraries used by postgresql. %package -n lib%{name}-devel Summary: Devel files for PostgreSQL Group: Development/Libraries -Requires: lib%{name} = %{version} +Requires: lib%{name} = %{?epoch:%epoch:}%{version}-%{release} +Provides: %{name}-devel = %{?epoch:%epoch:}%{version}-%{release} Obsoletes: %{name}-devel -Provides: %{name}-devel == %{version} %description -n lib%{name}-devel PostgreSQL is an object-relational database management system (ORDBMS) based on POSTGRES, Version 4.2, developed at the University of California at Berkeley Computer Science Department. The POSTGRES project, led by Professor Michael Stonebraker, was sponsored by the Defense Advanced Research Projects Agency (DARPA), the Army Research Office (ARO), the National Science Foundation (NSF), and ESL, Inc. - -This package contains static libraries and header files need for development. +This package contains static libraries and header files needed for development. %package server Summary: PostgreSQL DBMS server Group: System/Database -Requires: %{name} = %{version} +Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release} %description server PostgreSQL is an object-relational database management system (ORDBMS) based on POSTGRES, Version 4.2, developed at the University of California at Berkeley Computer Science Department. The POSTGRES project, led by Professor Michael Stonebraker, was sponsored by the Defense Advanced Research Projects Agency (DARPA), the Army Research Office (ARO), the National Science Foundation (NSF), and ESL, Inc. PostgreSQL is an open-source descendant of this original Berkeley code. It provides SQL92/SQL99 language support and other modern features. - -This is the DBMS server. +This package provides the DBMS server. %package tcltk Summary: PostgreSQL Tcl/Tk interface Group: Graphical Desktop/Applications/Databases -Requires: %{name} = %{version} +Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release} %description tcltk PostgreSQL is an object-relational database management system (ORDBMS) based on POSTGRES, Version 4.2, developed at the University of California at Berkeley Computer Science Department. The POSTGRES project, led by Professor Michael Stonebraker, was sponsored by the Defense Advanced Research Projects Agency (DARPA), the Army Research Office (ARO), the National Science Foundation (NSF), and ESL, Inc. - This package contains the Tcl/Tk interface. %package contrib Summary: Contributed source and binaries distributed with PostgreSQL Group: Applications/Databases -Requires: %{name} = %{version}-%{release} +Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release} %description contrib PostgreSQL is an object-relational database management system (ORDBMS) based on POSTGRES, Version 4.2, developed at the University of California at Berkeley Computer Science Department. The POSTGRES project, led by Professor Michael Stonebraker, was sponsored by the Defense Advanced Research Projects Agency (DARPA), the Army Research Office (ARO), the National Science Foundation (NSF), and ESL, Inc. - -The postgresql-contrib package contains contributed packages that are -included in the PostgreSQL distribution. +The postgresql-contrib package contains contributed packages that are included in the PostgreSQL distribution. %package test Summary: The test suite distributed with PostgreSQL Group: Applications/Databases -Requires: %{name}-server = %{version}-%{release} +Requires: %{name}-server = %{?epoch:%epoch:}%{version}-%{release} %description test PostgreSQL is an object-relational database management system (ORDBMS) based on POSTGRES, Version 4.2, developed at the University of California at Berkeley Computer Science Department. The POSTGRES project, led by Professor Michael Stonebraker, was sponsored by the Defense Advanced Research Projects Agency (DARPA), the Army Research Office (ARO), the National Science Foundation (NSF), and ESL, Inc. - -The postgresql-test package includes the sources and pre-built -binaries of various tests for the PostgreSQL database management -system, including regression tests and benchmarks. +The postgresql-test package includes the sources and pre-built binaries of various tests for the PostgreSQL database management system, including regression tests and benchmarks. %package docs Summary: Extra documentation for PostgreSQL Group: Documentation -Requires: %{name} = %{version}-%{release} +Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release} %description docs PostgreSQL is an object-relational database management system (ORDBMS) based on POSTGRES, Version 4.2, developed at the University of California at Berkeley Computer Science Department. The POSTGRES project, led by Professor Michael Stonebraker, was sponsored by the Defense Advanced Research Projects Agency (DARPA), the Army Research Office (ARO), the National Science Foundation (NSF), and ESL, Inc. - -The postgresql-docs package includes some additional documentation for -PostgreSQL. Currently, this includes the main documentation in PDF format, -the FAQ, and source files for the PostgreSQL tutorial. +The postgresql-docs package includes some additional documentation for PostgreSQL. Currently, this includes the main documentation in PDF format, the FAQ, and source files for the PostgreSQL tutorial. %debug_package %prep %setup -q -#cp -p %{SOURCE2} . +%patch0 -p1 %build - -CFLAGS="%{optflags} -ltermcap"; export CFLAGS -PYTHON=%{__python} \ %configure \ --prefix=%{_prefix} \ --mandir=%{_mandir} \ @@ -151,11 +137,14 @@ PYTHON=%{__python} \ --with-perl \ --with-ldap \ --with-krb5 \ - --with-gssapi + --with-gssapi \ + --with-systemd \ + PYTHON=%{__python3} + # --with-bonjour %make -make %{?_smp_mflags} -C contrib all +make %{?_smp_mflags} -C contrib all # put correct path into tutorial scripts sed "s|C=\`pwd\`;|C=%{_libdir}/postgresql/tutorial;|" < src/tutorial/Makefile > src/tutorial/GNUmakefile @@ -187,25 +176,12 @@ strip *.so install -d -m 755 %{buildroot}%{_libdir}/postgresql/tutorial cp src/tutorial/* %{buildroot}%{_libdir}/postgresql/tutorial -# Fix some more documentation -#mv %{buildroot}%{_docdir}/pgsql/html doc -#rm -rf %{buildroot}%{_docdir}/pgsql -install -d %{buildroot}/var/pgsql/data -install -D -m0755 %{SOURCE1} %{buildroot}%{_initrddir}/postgresql - -#mv %{buildroot}%{_includedir}/postgresql/informix/esql/sqltypes.h \ -# %{buildroot}%{_includedir}/postgresql/informix/esql/sqltypes-postgres.h +install -d %{buildroot}/var/lib/pgsql/data +install -D -m0755 %{SOURCE2} %{buildroot}%{_unitdir}/postgresql.service +install -D -m0755 %{SOURCE3} %{buildroot}%{_tmpfilesdir}/postgresql.conf %find_lang %{name} --with-qt --with-man --all-name || touch %{name}.lang -#%define lang_files pg_basebackup pg_ctl psql plperl postgres plpgsql plpython pltcl pgscripts ecpg initdb pg_dump pg_config pg_controldata pg_resetxlog libpq5 ecpglib6 pg_rewind -# -#> %{name}-all.lang -#for lang_file in %{lang_files} -# do %find_lang ${lang_file}-%{majver} -# cat ${lang_file}-%{majver}.lang >> %{name}-all.lang -#done - %clean [ "%{buildroot}" != / ] && rm -rf "%{buildroot}" @@ -213,31 +189,28 @@ install -D -m0755 %{SOURCE1} %{buildroot}%{_initrddir}/postgresql if [ $1 -eq 1 ]; then /usr/sbin/groupadd postgres -g %{groupid} 2>/dev/null /usr/sbin/useradd -u %{userid} -g postgres \ - -d /var/pgsql/data -c 'PostgreSQL Server' \ + -d /var/lib/pgsql/data -c 'PostgreSQL Server' \ -s /bin/false postgres 2>/dev/null fi : %post server -[ -e /var/pgsql/data/PG_VERSION ] || su -s /bin/sh - postgres -c "%{_bindir}/initdb -D /var/pgsql/data >/dev/null" -if [ $1 -eq 1 ]; then - /sbin/chkconfig --add postgresql - service postgresql start -fi +[ -e /var/lib/pgsql/data/PG_VERSION ] || su -s /bin/sh - postgres -c "%{_bindir}/initdb -D /var/lib/pgsql/data >/dev/null" +%tmpfiles_create named.conf +%systemd_post postgresql : %preun server -if [ $1 -eq 0 ]; then - service postgresql stop - /sbin/chkconfig --del postgresql - /usr/sbin/userdel postgres -fi +%systemd_preun postgresql : %postun server -if [ $1 -eq 1 ]; then - service postgresql restart -fi +%systemd_postun_with_restart postgresql +: + +%posttrans +# clean broken old sysv links +find /etc/rc[0-6].d/ -type l -xtype l -exec rm -f {} \; : %files -f %{name}.lang @@ -255,14 +228,16 @@ fi %dir %{_datadir}/doc/postgresql %{_datadir}/doc/postgresql/* #%{_mandir}/man1/* -%doc COPYRIGHT HISTORY INSTALL README +%doc COPYRIGHT %files server %defattr(-,root,root) -%attr(755,root,root) %{_initrddir}/postgresql %{_bindir}/postmaster %{_bindir}/postgres -%attr(700,postgres,root) %dir %{_localstatedir}/pgsql/data +%{_unitdir}/postgresql.service +%{_tmpfilesdir}/postgresql.conf +%dir %dir %{_localstatedir}/lib/pgsql +%attr(700,postgres,root) %dir %{_localstatedir}/lib/pgsql/data %files -n lib%{name} %defattr(-,root,root) @@ -296,10 +271,6 @@ fi %exclude %{_libdir}/postgresql/seg.so %exclude %{_libdir}/postgresql/sslinfo.so %exclude %{_libdir}/postgresql/tablefunc.so -#%exclude %{_libdir}/postgresql/test_parser.so -#%exclude %{_libdir}/postgresql/timetravel.so -#%exclude %{_libdir}/postgresql/tsearch2.so -#%exclude %{_libdir}/postgresql/pgxml.so %{_datadir}/postgresql/* %files -n lib%{name}-devel @@ -319,6 +290,7 @@ fi %{_libdir}/pkgconfig/libecpg_compat.pc %{_libdir}/pkgconfig/libpgtypes.pc %{_libdir}/pkgconfig/libpq.pc +%doc HISTORY INSTALL README #%files tcltk #%defattr(-,root,root) @@ -356,13 +328,7 @@ fi %{_libdir}/postgresql/seg.so %{_libdir}/postgresql/sslinfo.so %{_libdir}/postgresql/tablefunc.so -#%{_libdir}/postgresql/test_parser.so -#%{_libdir}/postgresql/timetravel.so -#%{_libdir}/postgresql/tsearch2.so -#%{_libdir}/postgresql/pgxml.so -#%{_datadir}/pgsql/contrib/ %{_bindir}/oid2name -#%{_bindir}/pg_standby %{_bindir}/pgbench %{_bindir}/vacuumlo @@ -379,6 +345,9 @@ fi %{_libdir}/postgresql/tutorial/* %changelog +* Sun Jan 31 2021 Silvan Calarco 13.1-2mamba +- rebuilt with systemd support + * Fri Nov 13 2020 Automatic Build System 13.1-1mamba - automatic version update by autodist diff --git a/postgresql.tmpfiles b/postgresql.tmpfiles new file mode 100644 index 0000000..63144e8 --- /dev/null +++ b/postgresql.tmpfiles @@ -0,0 +1 @@ +d /run/postgresql 700 postgres postgres