Place Unix sockets in /var/run/postgresql.
This commit is contained in:
parent
0011b0bd43
commit
497da8cf86
@ -22,7 +22,7 @@ TARGETFILE=postgresql-$VERSION-US.pdf
|
||||
|
||||
echo Building $TARGETFILE ...
|
||||
|
||||
# Unpack and configure postgresql
|
||||
# Unpack postgresql
|
||||
|
||||
rm -rf postgresql-$VERSION
|
||||
|
||||
@ -30,6 +30,12 @@ tar xfj postgresql-$VERSION.tar.bz2
|
||||
|
||||
cd postgresql-$VERSION
|
||||
|
||||
# Apply any patches that affect the PDF documentation
|
||||
|
||||
patch -p1 < ../postgresql-multi-sockets.patch
|
||||
|
||||
# Configure ...
|
||||
|
||||
./configure >/dev/null
|
||||
|
||||
# Build the PDF docs
|
||||
|
26
postgresql-config-comment.patch
Normal file
26
postgresql-config-comment.patch
Normal file
@ -0,0 +1,26 @@
|
||||
Add notes warning users that the data directory and port number are
|
||||
forced in the service file (the latter now mostly because it's traditional
|
||||
in Red Hat installations to set it there rather than in postgresql.conf).
|
||||
|
||||
|
||||
diff -Naur postgresql-9.1.4.orig/src/backend/utils/misc/postgresql.conf.sample postgresql-9.1.4/src/backend/utils/misc/postgresql.conf.sample
|
||||
--- postgresql-9.1.4.orig/src/backend/utils/misc/postgresql.conf.sample 2012-05-31 19:07:09.000000000 -0400
|
||||
+++ postgresql-9.1.4/src/backend/utils/misc/postgresql.conf.sample 2012-08-13 12:15:10.939846705 -0400
|
||||
@@ -38,6 +38,8 @@
|
||||
# The default values of these variables are driven from the -D command-line
|
||||
# option or PGDATA environment variable, represented here as ConfigDir.
|
||||
|
||||
+# Note: In RHEL/Fedora installations, you can't set data_directory here;
|
||||
+# adjust it in the service file instead.
|
||||
#data_directory = 'ConfigDir' # use data in another directory
|
||||
# (change requires restart)
|
||||
#hba_file = 'ConfigDir/pg_hba.conf' # host-based authentication file
|
||||
@@ -60,6 +62,8 @@
|
||||
# comma-separated list of addresses;
|
||||
# defaults to 'localhost', '*' = all
|
||||
# (change requires restart)
|
||||
+# Note: In RHEL/Fedora installations, you can't set the port number here;
|
||||
+# adjust it in the service file instead.
|
||||
#port = 5432 # (change requires restart)
|
||||
#max_connections = 100 # (change requires restart)
|
||||
# Note: Increasing max_connections costs ~400 bytes of shared memory per
|
1182
postgresql-multi-sockets.patch
Normal file
1182
postgresql-multi-sockets.patch
Normal file
File diff suppressed because it is too large
Load Diff
94
postgresql-var-run-socket.patch
Normal file
94
postgresql-var-run-socket.patch
Normal file
@ -0,0 +1,94 @@
|
||||
Change the built-in default socket directory to be /var/run/postgresql.
|
||||
For backwards compatibility with (probably non-libpq-based) clients that
|
||||
might still expect to find the socket in /tmp, also create a socket in
|
||||
/tmp. This is to resolve communication problems with clients operating
|
||||
under systemd's PrivateTmp environment, which won't be using the same
|
||||
global /tmp directory as the server; see bug #825448.
|
||||
|
||||
Note that we apply the socket directory change at the level of the
|
||||
hard-wired defaults in the C code, not by just twiddling the setting in
|
||||
postgresql.conf.sample; this is so that the change will take effect on
|
||||
server package update, without requiring any existing postgresql.conf
|
||||
to be updated. (Of course, a user who dislikes this behavior can still
|
||||
override it via postgresql.conf.)
|
||||
|
||||
This patch must be applied after postgresql-multi-sockets.patch, at
|
||||
least until 9.3 when that will be part of the upstream package.
|
||||
|
||||
|
||||
diff -Naur postgresql-9.1.4.sockets/contrib/pg_upgrade/server.c postgresql-9.1.4/contrib/pg_upgrade/server.c
|
||||
--- postgresql-9.1.4.sockets/contrib/pg_upgrade/server.c 2012-05-31 19:07:09.000000000 -0400
|
||||
+++ postgresql-9.1.4/contrib/pg_upgrade/server.c 2012-08-12 22:43:10.388873678 -0400
|
||||
@@ -179,11 +179,14 @@
|
||||
*/
|
||||
snprintf(cmd, sizeof(cmd),
|
||||
SYSTEMQUOTE "\"%s/pg_ctl\" -w -l \"%s\" -D \"%s\" "
|
||||
- "-o \"-p %d %s\" start >> \"%s\" 2>&1" SYSTEMQUOTE,
|
||||
+ "-o \"-p %d %s %s\" start >> \"%s\" 2>&1" SYSTEMQUOTE,
|
||||
cluster->bindir, output_filename, cluster->pgdata, cluster->port,
|
||||
(cluster->controldata.cat_ver >=
|
||||
BINARY_UPGRADE_SERVER_FLAG_CAT_VER) ? "-b" :
|
||||
"-c autovacuum=off -c autovacuum_freeze_max_age=2000000000",
|
||||
+ /* assume 9.1 builds will have newer socket directory */
|
||||
+ (GET_MAJOR_VERSION(cluster->major_version) < 901) ?
|
||||
+ "-c unix_socket_directory=/var/run/postgresql" : "",
|
||||
output_filename);
|
||||
|
||||
/*
|
||||
diff -Naur postgresql-9.1.4.sockets/src/backend/utils/misc/guc.c postgresql-9.1.4/src/backend/utils/misc/guc.c
|
||||
--- postgresql-9.1.4.sockets/src/backend/utils/misc/guc.c 2012-08-12 20:35:22.559682963 -0400
|
||||
+++ postgresql-9.1.4/src/backend/utils/misc/guc.c 2012-08-12 20:35:55.071983609 -0400
|
||||
@@ -2874,7 +2874,7 @@
|
||||
},
|
||||
&Unix_socket_directories,
|
||||
#ifdef HAVE_UNIX_SOCKETS
|
||||
- DEFAULT_PGSOCKET_DIR,
|
||||
+ DEFAULT_PGSOCKET_DIR ", /tmp",
|
||||
#else
|
||||
"",
|
||||
#endif
|
||||
diff -Naur postgresql-9.1.4.sockets/src/bin/initdb/initdb.c postgresql-9.1.4/src/bin/initdb/initdb.c
|
||||
--- postgresql-9.1.4.sockets/src/bin/initdb/initdb.c 2012-08-12 20:35:22.561682693 -0400
|
||||
+++ postgresql-9.1.4/src/bin/initdb/initdb.c 2012-08-12 20:35:55.073983799 -0400
|
||||
@@ -970,7 +970,7 @@
|
||||
|
||||
#ifdef HAVE_UNIX_SOCKETS
|
||||
snprintf(repltok, sizeof(repltok), "#unix_socket_directories = '%s'",
|
||||
- DEFAULT_PGSOCKET_DIR);
|
||||
+ DEFAULT_PGSOCKET_DIR ", /tmp");
|
||||
#else
|
||||
snprintf(repltok, sizeof(repltok), "#unix_socket_directories = ''");
|
||||
#endif
|
||||
diff -Naur postgresql-9.1.4.sockets/src/include/pg_config_manual.h postgresql-9.1.4/src/include/pg_config_manual.h
|
||||
--- postgresql-9.1.4.sockets/src/include/pg_config_manual.h 2012-05-31 19:07:09.000000000 -0400
|
||||
+++ postgresql-9.1.4/src/include/pg_config_manual.h 2012-08-12 20:35:55.073983799 -0400
|
||||
@@ -141,7 +141,7 @@
|
||||
* here's where to twiddle it. You can also override this at runtime
|
||||
* with the postmaster's -k switch.
|
||||
*/
|
||||
-#define DEFAULT_PGSOCKET_DIR "/tmp"
|
||||
+#define DEFAULT_PGSOCKET_DIR "/var/run/postgresql"
|
||||
|
||||
/*
|
||||
* The random() function is expected to yield values between 0 and
|
||||
diff -Naur postgresql-9.1.4.sockets/src/test/regress/pg_regress.c postgresql-9.1.4/src/test/regress/pg_regress.c
|
||||
--- postgresql-9.1.4.sockets/src/test/regress/pg_regress.c 2012-05-31 19:07:09.000000000 -0400
|
||||
+++ postgresql-9.1.4/src/test/regress/pg_regress.c 2012-08-12 20:38:43.933609334 -0400
|
||||
@@ -781,7 +781,7 @@
|
||||
if (hostname != NULL)
|
||||
doputenv("PGHOST", hostname);
|
||||
else
|
||||
- unsetenv("PGHOST");
|
||||
+ doputenv("PGHOST", "/tmp");
|
||||
unsetenv("PGHOSTADDR");
|
||||
if (port != -1)
|
||||
{
|
||||
@@ -2240,7 +2240,7 @@
|
||||
*/
|
||||
header(_("starting postmaster"));
|
||||
snprintf(buf, sizeof(buf),
|
||||
- SYSTEMQUOTE "\"%s/postgres\" -D \"%s/data\" -F%s -c \"listen_addresses=%s\" > \"%s/log/postmaster.log\" 2>&1" SYSTEMQUOTE,
|
||||
+ SYSTEMQUOTE "\"%s/postgres\" -D \"%s/data\" -F%s -c \"listen_addresses=%s\" -c \"unix_socket_directories=/tmp\" > \"%s/log/postmaster.log\" 2>&1" SYSTEMQUOTE,
|
||||
bindir, temp_install,
|
||||
debug ? " -d 5" : "",
|
||||
hostname ? hostname : "",
|
@ -53,7 +53,7 @@ Summary: PostgreSQL client programs
|
||||
Name: postgresql
|
||||
%global majorversion 9.1
|
||||
Version: 9.1.4
|
||||
Release: 4%{?dist}
|
||||
Release: 5%{?dist}
|
||||
|
||||
# The PostgreSQL license is very similar to other MIT licenses, but the OSI
|
||||
# recognizes it as an independent license, so we do as well.
|
||||
@ -85,6 +85,7 @@ Source9: postgresql-setup
|
||||
Source10: postgresql.service
|
||||
Source11: initdb.sh
|
||||
Source12: upgrade.sh
|
||||
Source13: postgresql.tmpfiles.d
|
||||
Source14: postgresql.pam
|
||||
Source15: postgresql-bashprofile
|
||||
|
||||
@ -93,6 +94,9 @@ Patch1: rpm-pgsql.patch
|
||||
Patch2: postgresql-logging.patch
|
||||
Patch3: postgresql-perl-rpath.patch
|
||||
Patch4: postgresql-oom_score_adj.patch
|
||||
Patch5: postgresql-multi-sockets.patch
|
||||
Patch6: postgresql-var-run-socket.patch
|
||||
Patch7: postgresql-config-comment.patch
|
||||
|
||||
BuildRequires: perl(ExtUtils::MakeMaker) glibc-devel bison flex gawk
|
||||
BuildRequires: perl(ExtUtils::Embed), perl-devel
|
||||
@ -146,8 +150,6 @@ BuildRequires: libselinux-devel
|
||||
# main package requires -libs subpackage
|
||||
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
|
||||
|
||||
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root
|
||||
|
||||
%description
|
||||
PostgreSQL is an advanced Object-Relational database management system (DBMS).
|
||||
The base postgresql package contains the client programs that you'll need to
|
||||
@ -182,7 +184,9 @@ Requires(pre): /usr/sbin/useradd
|
||||
# for /sbin/ldconfig
|
||||
Requires(post): glibc
|
||||
Requires(postun): glibc
|
||||
# pre/post stuff needs systemd too
|
||||
# We require this to be present for %%{_prefix}/lib/tmpfiles.d
|
||||
Requires: systemd-units
|
||||
# Make sure it's there when scriptlets run, too
|
||||
Requires(post): systemd-units
|
||||
Requires(preun): systemd-units
|
||||
Requires(postun): systemd-units
|
||||
@ -305,6 +309,9 @@ benchmarks.
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
%patch6 -p1
|
||||
%patch7 -p1
|
||||
|
||||
# We used to run autoconf here, but there's no longer any real need to,
|
||||
# since Postgres ships with a reasonably modern configure script.
|
||||
@ -435,7 +442,6 @@ rm -f src/tutorial/GNUmakefile
|
||||
%endif
|
||||
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
make DESTDIR=$RPM_BUILD_ROOT install-world
|
||||
|
||||
@ -486,6 +492,13 @@ install -d $RPM_BUILD_ROOT/etc/pam.d
|
||||
install -m 644 %{SOURCE14} $RPM_BUILD_ROOT/etc/pam.d/postgresql
|
||||
%endif
|
||||
|
||||
# Create the directory for sockets.
|
||||
install -d -m 755 $RPM_BUILD_ROOT/var/run/postgresql
|
||||
|
||||
# ... and make a tmpfiles script to recreate it at reboot.
|
||||
mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/tmpfiles.d
|
||||
install -m 0644 %{SOURCE13} $RPM_BUILD_ROOT%{_prefix}/lib/tmpfiles.d/postgresql.conf
|
||||
|
||||
# PGDATA needs removal of group and world permissions due to pg_pwd hole.
|
||||
install -d -m 700 $RPM_BUILD_ROOT/var/lib/pgsql/data
|
||||
|
||||
@ -678,13 +691,9 @@ fi
|
||||
%postun -p /sbin/ldconfig pltcl
|
||||
%endif
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
# FILES section.
|
||||
|
||||
%files -f main.lst
|
||||
%defattr(-,root,root)
|
||||
%doc doc/KNOWN_BUGS doc/MISSING_FEATURES doc/TODO
|
||||
%doc COPYRIGHT README HISTORY doc/bug.template
|
||||
%doc README.rpm-dist
|
||||
@ -721,12 +730,10 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%dir %{_libdir}/pgsql
|
||||
|
||||
%files docs
|
||||
%defattr(-,root,root)
|
||||
%doc *-US.pdf
|
||||
%{_libdir}/pgsql/tutorial/
|
||||
|
||||
%files contrib
|
||||
%defattr(-,root,root)
|
||||
%{_datadir}/pgsql/extension/adminpack*
|
||||
%{_datadir}/pgsql/extension/autoinc*
|
||||
%{_datadir}/pgsql/extension/btree_gin*
|
||||
@ -828,7 +835,6 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%doc contrib/spi/*.example
|
||||
|
||||
%files libs -f libs.lst
|
||||
%defattr(-,root,root)
|
||||
%doc COPYRIGHT
|
||||
%{_libdir}/libpq.so.*
|
||||
%{_libdir}/libecpg.so.*
|
||||
@ -836,7 +842,6 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{_libdir}/libecpg_compat.so.*
|
||||
|
||||
%files server -f server.lst
|
||||
%defattr(-,root,root)
|
||||
%{_unitdir}/postgresql.service
|
||||
%dir /usr/libexec/initscripts/legacy-actions/postgresql
|
||||
/usr/libexec/initscripts/legacy-actions/postgresql/*
|
||||
@ -872,6 +877,8 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%dir %{_datadir}/pgsql/contrib
|
||||
%dir %{_datadir}/pgsql/extension
|
||||
%{_datadir}/pgsql/extension/plpgsql*
|
||||
%{_prefix}/lib/tmpfiles.d/postgresql.conf
|
||||
%attr(755,postgres,postgres) %dir /var/run/postgresql
|
||||
%attr(700,postgres,postgres) %dir /var/lib/pgsql
|
||||
%attr(700,postgres,postgres) %dir /var/lib/pgsql/data
|
||||
%attr(700,postgres,postgres) %dir /var/lib/pgsql/backups
|
||||
@ -885,7 +892,6 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{_datadir}/pgsql/sql_features.txt
|
||||
|
||||
%files devel -f devel.lst
|
||||
%defattr(-,root,root)
|
||||
/usr/include/*
|
||||
%{_bindir}/ecpg
|
||||
%{_libdir}/libpq.so
|
||||
@ -898,7 +904,6 @@ rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%if %upgrade
|
||||
%files upgrade
|
||||
%defattr(-,root,root)
|
||||
%{_bindir}/pg_upgrade
|
||||
%{_libdir}/pgsql/pg_upgrade_support.so
|
||||
%{_libdir}/pgsql/postgresql-%{prevmajorversion}
|
||||
@ -906,14 +911,12 @@ rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%if %plperl
|
||||
%files plperl -f plperl.lst
|
||||
%defattr(-,root,root)
|
||||
%{_datadir}/pgsql/extension/plperl*
|
||||
%{_libdir}/pgsql/plperl.so
|
||||
%endif
|
||||
|
||||
%if %pltcl
|
||||
%files pltcl -f pltcl.lst
|
||||
%defattr(-,root,root)
|
||||
%{_datadir}/pgsql/extension/pltcl*
|
||||
%{_libdir}/pgsql/pltcl.so
|
||||
%{_bindir}/pltcl_delmod
|
||||
@ -924,7 +927,6 @@ rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%if %plpython
|
||||
%files plpython -f plpython.lst
|
||||
%defattr(-,root,root)
|
||||
%{_datadir}/pgsql/extension/plpython*
|
||||
%{_libdir}/pgsql/plpython2.so
|
||||
%endif
|
||||
@ -937,6 +939,15 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Mon Aug 13 2012 Tom Lane <tgl@redhat.com> 9.1.4-5
|
||||
- Back-port upstream support for postmaster listening on multiple Unix sockets
|
||||
- Configure postmaster to create sockets in both /var/run/postgresql and /tmp;
|
||||
the former is now the default place for libpq to contact the postmaster.
|
||||
Resolves: #825448
|
||||
- Annotate postgresql.config about not setting port number there
|
||||
- Minor specfile cleanup per suggestions from Tom Callaway
|
||||
Related: #845110
|
||||
|
||||
* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 9.1.4-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
|
||||
|
||||
|
1
postgresql.tmpfiles.d
Normal file
1
postgresql.tmpfiles.d
Normal file
@ -0,0 +1 @@
|
||||
d /var/run/postgresql 0755 postgres postgres -
|
Loading…
Reference in New Issue
Block a user