1 |
commit: 8c4bdffecf85910f41f143610c68bea3632858a2 |
2 |
Author: Patrick Lauer <patrick <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Oct 28 09:33:40 2016 +0000 |
4 |
Commit: Patrick Lauer <patrick <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Oct 28 09:33:54 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8c4bdffe |
7 |
|
8 |
dev-db/postgresql: Bump |
9 |
|
10 |
Package-Manager: portage-2.3.2 |
11 |
|
12 |
dev-db/postgresql/Manifest | 6 + |
13 |
dev-db/postgresql/postgresql-9.1.24.ebuild | 384 +++++++++++++++++++++++++ |
14 |
dev-db/postgresql/postgresql-9.2.19.ebuild | 394 ++++++++++++++++++++++++++ |
15 |
dev-db/postgresql/postgresql-9.3.15.ebuild | 399 ++++++++++++++++++++++++++ |
16 |
dev-db/postgresql/postgresql-9.4.10.ebuild | 431 ++++++++++++++++++++++++++++ |
17 |
dev-db/postgresql/postgresql-9.5.5.ebuild | 437 +++++++++++++++++++++++++++++ |
18 |
dev-db/postgresql/postgresql-9.6.1.ebuild | 434 ++++++++++++++++++++++++++++ |
19 |
7 files changed, 2485 insertions(+) |
20 |
|
21 |
diff --git a/dev-db/postgresql/Manifest b/dev-db/postgresql/Manifest |
22 |
index 34f2505..a9fe408 100644 |
23 |
--- a/dev-db/postgresql/Manifest |
24 |
+++ b/dev-db/postgresql/Manifest |
25 |
@@ -1,11 +1,17 @@ |
26 |
DIST postgresql-9.1.21.tar.bz2 15850128 SHA256 d66ee9076f3149a4cab4be3c6f47e13bc047138d17dfcb531ad01f78cfdeb393 SHA512 75a96ce2c080b2e657b6f591e18c4778635a9f8c74870bbe7c99cb82bf1dfaad124942214ab6e3079b565c41b7fc77af1a4a49672e7ddba075374402c8832a5b WHIRLPOOL 4de012763b985d1fa675e151d68988f4dd4de4ae8860d67fab3818666b3e135849465a0a41bc1f073eb4d679415fb18871f8156c99376c7860c51258e607771e |
27 |
DIST postgresql-9.1.23.tar.bz2 15856178 SHA256 7f7471e8b3b369726f1c1df0e6a163dde63b6546c4bba985c1f36a574c75f6d5 SHA512 192f48ed8db510663c85c217afee8eff732d467fe10f600c9be834371ccb6a788acd380c582d80f0096a0b7d7ee0daa378d1fb8177281bf4e6e2fcc39fffdc67 WHIRLPOOL 55a60cdc6a0c1e570d2a1f7fce9c160637101cf77c7dda3d1a2ccd31350d16678f07949c8bd7519f54bc6008e18074d0d57f1201c870b044e765c8057a358441 |
28 |
+DIST postgresql-9.1.24.tar.bz2 15863767 SHA256 de0d84e9f32af145fcd66d8d324f6ef1a0b17944ea344b7bbe9d99fff68ae5d3 SHA512 a9ad0d62846598afee317eeda83406b5f85a658bfe7eb78aff6c59c904223dd165adbd5870598b74aa0e012878489f0c285e6ac7b07ebddf3cf8d81ba70bea7e WHIRLPOOL f58d79df5562c3fc22dae96ba064e19a4c83f42358911575f854cb2e062457f9331547cb19f9970003a2e15b7e8c609b9aab2a1e17099a446c89786581ccb13b |
29 |
DIST postgresql-9.2.16.tar.bz2 16490199 SHA256 d2164cb8706bf828161871c195299841c5be1fbd9bc85d7866704e54f0741b11 SHA512 0f0b317473b4b42ae4261993c704a7c6cd28c7e6bd83e77a81850695655baa473d7d52e97441ee5500d646d405c84145a54f42b9bae89a0ddfebb0418d608820 WHIRLPOOL 8dfdca52555889d20e857ecc01ee75a14fd18bb7fa1ac50f5d54415a423d62223d0d389d43b143ae927446946aaff06b68cbf8214e26e2f432c39a50c0296b08 |
30 |
DIST postgresql-9.2.18.tar.bz2 16448429 SHA256 d7aa37d586ae4d46d07a4fac417ff966e45a9dd99bac8b3cd149be8df9ea35f4 SHA512 c311f621ac38e2dfaf5fd57a4500430333dcbb2d7f1719bc7d99fef54e06a22f93aea595391c3607d44c89c372d0e89daf18f8f295b33e3b21e5285fbbb87d5b WHIRLPOOL 08664a3378eca1a509066a6a841c1489d7cf8cbda60cd836ad67b0cb2bf112b58191d0a1170f97aec09ef5a0984916263c754bc108de2cec6945417e97ce0e66 |
31 |
+DIST postgresql-9.2.19.tar.bz2 16466698 SHA256 1d29d73a4f590fcc348280f13ac2ff6a0f72c94908c54e3c20b7ab1560e8dbad SHA512 d3b4c5578bf6d6580028e775bff81a921258cb53b6b06567d96a352d14f3b63063adb480b2f5e2029baf8a034e14b5cd75eebc04f1ed7b16c849e1a5ec1f4867 WHIRLPOOL c13b45fd7aee08ea472557c9f40d79c45abd572fefcc215002b562b8046b1937bf522f6f7f6e280ff1e434c9698734cda9f1c3dacd3c8fee5f33dad0da21f75f |
32 |
DIST postgresql-9.3.12.tar.bz2 17052755 SHA256 f3339ea23f86d07f3730adc878b2e5d433087ff44aad65a5ec9c22c32b112e67 SHA512 d88cb167ca78bd8588e3ff9b3f13b77f661e3ddec7e5b726cc0a46512db2584b15ce5f691fe7e4ab84855f102cb88014245921a38f5da41ad19e762a88968883 WHIRLPOOL 8738e18f8534f70ddbfa7c0c0ae1ab585330cb9df2d2da3a3e5f5c15a2e5070aebd38124b7295214e0105c482a79011d00c8cbe2a9061edc90bfd5ed07000dcb |
33 |
DIST postgresql-9.3.14.tar.bz2 17042199 SHA256 5c4322f1c42ba1ff4b28383069c56663b46160bb08e85d41fa2ab9a5009d039d SHA512 97bd92ffdd661f7428c47a8bc87fde88a2b150e7d08bd577a7159ac65aec319d358495b883b95dff2069d24a8d15d1e7c10c3fae81fc76186bfef0127f257ac4 WHIRLPOOL d603e2016cba37fd0ea68b00c1493d23588aeeb334cceeb7fce521ed66618ffa70b4eb281e8a37650e30151cd4f1353879c63fe4076caa144d085ac96e8b5a79 |
34 |
+DIST postgresql-9.3.15.tar.bz2 17059932 SHA256 a9fcba1446a93aa95e3e1b6535756f0472d10b0f267a0845f8b2b29f89de5c4f SHA512 35c30cdb5599f99c94ab921f9f5e7671a8c0b7bca8fe3b616630ae13d6eda8d329e77e7e802da6a83cb09c3c9ca10fa8ce0de8a184e6fff471130e1cd68ce762 WHIRLPOOL 7a627b2da1dc3671df7edfe58420f81ce24202c1251225054674d79e431bc36e1a70c84aaacb76c59e9eefb26429cbbb9ea80c45a989e3564b69e334d3dd4d84 |
35 |
+DIST postgresql-9.4.10.tar.bz2 17802812 SHA256 7061678bed1981c681ce54c76b98b6ec17743f090a9775104a45e7e1a8826ecf SHA512 2fcf47769b22c69bc82c9d6edc317e18dfcb4a96534e012bae4355e5088afa83da98b21e08a07766794f0a166888acbd16705a806464ea11711ed97c3b4012fb WHIRLPOOL e6ed3c209043cbbacb0698e1be367f20028d649d4cff62b5d6edd162c6ad629a3ec5f55854bd12334a3d3165462fecb34188bd62cd398cfc242a3579810b5b85 |
36 |
DIST postgresql-9.4.7.tar.bz2 17746987 SHA256 cc795e6c35b30e697e5891e3056376af685f848a4e67fab1702e74a2385f81e0 SHA512 e61d74a4a9caeb7d4a3fb9509b37aaeb5bd563d61d20739edd777ec990c92011286a7485f275178f9f8c1ebb8c84a98290e2b5351b11e0f9a1baa781f323e374 WHIRLPOOL 2ae25affc35e12fd250161585bc5cf318930d9864c9fccbf44c9bd697933aa75860467256b811501947c0fad8c6cdc0622889e9991904a4db9fda2d19efa2b37 |
37 |
DIST postgresql-9.4.9.tar.bz2 17763281 SHA256 c120a62e90214c20d9160da3ca3fbaec97d5f1656f1dd033f60e7297b7a1e1c9 SHA512 980b1a8828d07151e67793367ea0ee08e4231cd76d9b20b4f4bca08a7976ee82a3aea51ce801a4107680c8203f8ebdb4cf5a0a6aaf93d580c9f337658d50819b WHIRLPOOL f5c9922bd12008a87a6ed0b8efaf8280d1a3ce8ef47fc853efd4d4d1a754e878f9cb27a4049cfb6d7c50968083e1286670a9b79588e29e127bd3f96b927f4999 |
38 |
DIST postgresql-9.5.2.tar.bz2 18446616 SHA256 f8d132e464506b551ef498719f18cfe9d777709c7a1589dc360afc0b20e47c41 SHA512 ba31dddee8a960a4b1a97394eae5ea7efaa5e74e21c755882efcef90404676c6052dff55f40b585932e4f752cbcda5ceac0e29d601ea6651cfbab7a49190381a WHIRLPOOL 0b9abe3a5b3933485e5d0b2c08daa20d421e5920ae5b4640b36971463915d7e7b2767575564d80bb5dfa3a353c646c9c4ca8e483dfd64df39370774e76fa1cee |
39 |
DIST postgresql-9.5.4.tar.bz2 18496299 SHA256 cf5e571164ad66028ecd7dd8819e3765470d45bcd440d258b686be7e69c76ed0 SHA512 e5220bc967443d54b9dcff7ba5aefccedbe1c219f953eb0d67254c709d52b0e647d1dc473446640804165b596fc5b75fa4ff8d63696123b87d8096c3a7795c34 WHIRLPOOL d429d853062b2d2f8e999db1733b3206020f2d521401e0510376213ecaa2049b6d87987b9ee999ab81faacf6ce65ddfdcf43b0922fc23e91961594956c556e0d |
40 |
+DIST postgresql-9.5.5.tar.bz2 18525082 SHA256 02c65290be74de6604c3fed87c9fd3e6b32e949f0ab8105a75bd7ed5aa71f394 SHA512 727ab57796cd393ec3755e9aabf515ebbdc3152b4062c20e64511e866a7e7038ba5c5e2843f13f3a79e2263296451f0e93108346b6f638611fba2449394e338e WHIRLPOOL ec5262fd8cecea20fd12bcec8e6e015817ae8181d9e9ff6d8aca6ed43cadedac1bd5006c3d04262b99b9a79aa02c409920ab3392136f3ff3dc480fe1155cade8 |
41 |
DIST postgresql-9.6.0.tar.bz2 19157472 SHA256 3b5fe9634b80a4511aac1832a087586a7caa8c3413619562bdda009a015863ce SHA512 46ec903eed13bf5fb5510d56e4814405ba4510c9e5f43c533189b6ed07c7955dba326107ae0dbeebb5abdd00b7007971ca5d7213274bd653d8d4295f93e6cbf8 WHIRLPOOL aa5d30d41aca14eee3a00d5f3805b28187278a538c0f00b9cb70fad9e2c401dedc797512b9851a04c67f21e7b8cfbcf6d2f85c1486795803840b7111cccb2b19 |
42 |
+DIST postgresql-9.6.1.tar.bz2 19260568 SHA256 e5101e0a49141fc12a7018c6dad594694d3a3325f5ab71e93e0e51bd94e51fcd SHA512 f27af67f9a96f6327150330bf091a803e10eabbac4e488cf5e4d72907e2eb1dbde7282fe0b89fd75711fd8bdcdb3688b5a9eac1e4d6871f4e8681c9c8b0e7c45 WHIRLPOOL 1ea7933817895ec4ddd531b60eead2c0c3324b90fe48224bd49748d11e76313bb7699670edaf5c8f41b8424026bed59d29aab69208c5ced5161196a4827c78f8 |
43 |
|
44 |
diff --git a/dev-db/postgresql/postgresql-9.1.24.ebuild b/dev-db/postgresql/postgresql-9.1.24.ebuild |
45 |
new file mode 100644 |
46 |
index 00000000..6e1262f |
47 |
--- /dev/null |
48 |
+++ b/dev-db/postgresql/postgresql-9.1.24.ebuild |
49 |
@@ -0,0 +1,384 @@ |
50 |
+# Copyright 1999-2016 Gentoo Foundation |
51 |
+# Distributed under the terms of the GNU General Public License v2 |
52 |
+# $Id$ |
53 |
+ |
54 |
+EAPI="5" |
55 |
+ |
56 |
+# Testing within Portage's environment is broken, and the patch no |
57 |
+# longer applies cleanly. |
58 |
+RESTRICT="test" |
59 |
+ |
60 |
+PYTHON_COMPAT=( python{2_7,3_4} ) |
61 |
+ |
62 |
+inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \ |
63 |
+ systemd user versionator |
64 |
+ |
65 |
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris" |
66 |
+ |
67 |
+SLOT="$(get_version_component_range 1-2)" |
68 |
+ |
69 |
+SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2" |
70 |
+ |
71 |
+LICENSE="POSTGRESQL GPL-2" |
72 |
+DESCRIPTION="PostgreSQL RDBMS" |
73 |
+HOMEPAGE="http://www.postgresql.org/" |
74 |
+ |
75 |
+LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr |
76 |
+ zh_CN zh_TW" |
77 |
+IUSE="doc kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python |
78 |
+ +readline selinux +server ssl static-libs tcl threads uuid xml zlib" |
79 |
+ |
80 |
+for lingua in ${LINGUAS}; do |
81 |
+ IUSE+=" linguas_${lingua}" |
82 |
+done |
83 |
+ |
84 |
+wanted_languages() { |
85 |
+ local enable_langs |
86 |
+ |
87 |
+ for lingua in ${LINGUAS} ; do |
88 |
+ use linguas_${lingua} && enable_langs+="${lingua} " |
89 |
+ done |
90 |
+ |
91 |
+ echo -n ${enable_langs} |
92 |
+} |
93 |
+ |
94 |
+CDEPEND=" |
95 |
+>=app-eselect/eselect-postgresql-1.2.0 |
96 |
+sys-apps/less |
97 |
+virtual/libintl |
98 |
+kerberos? ( virtual/krb5 ) |
99 |
+ldap? ( net-nds/openldap ) |
100 |
+pam? ( virtual/pam ) |
101 |
+perl? ( >=dev-lang/perl-5.8:= ) |
102 |
+python? ( ${PYTHON_DEPS} ) |
103 |
+readline? ( sys-libs/readline:0= ) |
104 |
+ssl? ( |
105 |
+ !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= ) |
106 |
+ libressl? ( dev-libs/libressl:= ) |
107 |
+) |
108 |
+tcl? ( >=dev-lang/tcl-8:0= ) |
109 |
+uuid? ( dev-libs/ossp-uuid ) |
110 |
+xml? ( dev-libs/libxml2 dev-libs/libxslt ) |
111 |
+zlib? ( sys-libs/zlib ) |
112 |
+" |
113 |
+ |
114 |
+DEPEND="${CDEPEND} |
115 |
+!!<sys-apps/sandbox-2.0 |
116 |
+sys-devel/bison |
117 |
+sys-devel/flex |
118 |
+nls? ( sys-devel/gettext ) |
119 |
+xml? ( virtual/pkgconfig ) |
120 |
+" |
121 |
+ |
122 |
+RDEPEND="${CDEPEND} |
123 |
+!dev-db/postgresql-docs:${SLOT} |
124 |
+!dev-db/postgresql-base:${SLOT} |
125 |
+!dev-db/postgresql-server:${SLOT} |
126 |
+selinux? ( sec-policy/selinux-postgresql ) |
127 |
+" |
128 |
+ |
129 |
+pkg_setup() { |
130 |
+ use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup |
131 |
+ |
132 |
+ enewgroup postgres 70 |
133 |
+ enewuser postgres 70 /bin/sh /var/lib/postgresql postgres |
134 |
+ |
135 |
+ use python && python-single-r1_pkg_setup |
136 |
+} |
137 |
+ |
138 |
+src_prepare() { |
139 |
+ # Work around PPC{,64} compilation bug where bool is already defined |
140 |
+ sed '/#ifndef __cplusplus/a #undef bool' -i src/include/c.h || die |
141 |
+ |
142 |
+ # Set proper run directory |
143 |
+ sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \ |
144 |
+ -i src/include/pg_config_manual.h || die |
145 |
+ |
146 |
+ epatch "${FILESDIR}/pg_ctl-exit-status.patch" |
147 |
+ |
148 |
+ use server || epatch "${FILESDIR}/${PN}-${SLOT}-no-server.patch" |
149 |
+ |
150 |
+ # Fix bug 486556 where the server would crash at start up because of |
151 |
+ # an infinite loop caused by a self-referencing symlink. |
152 |
+ epatch "${FILESDIR}/postgresql-9.1-tz-dir-overflow.patch" |
153 |
+ |
154 |
+ if use pam ; then |
155 |
+ sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \ |
156 |
+ -i src/backend/libpq/auth.c || \ |
157 |
+ die 'PGSQL_PAM_SERVICE rename failed.' |
158 |
+ fi |
159 |
+ |
160 |
+ epatch_user |
161 |
+} |
162 |
+ |
163 |
+src_configure() { |
164 |
+ case ${CHOST} in |
165 |
+ *-darwin*|*-solaris*) |
166 |
+ use nls && append-libs intl |
167 |
+ ;; |
168 |
+ esac |
169 |
+ |
170 |
+ export LDFLAGS_SL="${LDFLAGS}" |
171 |
+ export LDFLAGS_EX="${LDFLAGS}" |
172 |
+ |
173 |
+ local PO="${EPREFIX%/}" |
174 |
+ |
175 |
+ econf \ |
176 |
+ --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \ |
177 |
+ --datadir="${PO}/usr/share/postgresql-${SLOT}" \ |
178 |
+ --docdir="${PO}/usr/share/doc/${PF}" \ |
179 |
+ --includedir="${PO}/usr/include/postgresql-${SLOT}" \ |
180 |
+ --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \ |
181 |
+ --sysconfdir="${PO}/etc/postgresql-${SLOT}" \ |
182 |
+ --with-system-tzdata="${PO}/usr/share/zoneinfo" \ |
183 |
+ $(use_enable !pg_legacytimestamp integer-datetimes) \ |
184 |
+ $(use_enable threads thread-safety) \ |
185 |
+ $(use_with kerberos gssapi) \ |
186 |
+ $(use_with kerberos krb5) \ |
187 |
+ $(use_with ldap) \ |
188 |
+ $(use_with pam) \ |
189 |
+ $(use_with perl) \ |
190 |
+ $(use_with python) \ |
191 |
+ $(use_with readline) \ |
192 |
+ $(use_with ssl openssl) \ |
193 |
+ $(use_with tcl) \ |
194 |
+ $(use_with uuid ossp-uuid) \ |
195 |
+ $(use_with xml libxml) \ |
196 |
+ $(use_with xml libxslt) \ |
197 |
+ $(use_with zlib) \ |
198 |
+ "$(use_enable nls nls "$(wanted_languages)")" |
199 |
+} |
200 |
+ |
201 |
+src_compile() { |
202 |
+ emake |
203 |
+ emake -C contrib |
204 |
+} |
205 |
+ |
206 |
+src_install() { |
207 |
+ emake DESTDIR="${D}" install |
208 |
+ emake DESTDIR="${D}" install -C contrib |
209 |
+ |
210 |
+ dodoc README HISTORY doc/{TODO,bug.template} |
211 |
+ |
212 |
+ # man pages are already built, but if we have the target make them, |
213 |
+ # they'll be generated from source before being installed so we |
214 |
+ # manually install man pages. |
215 |
+ # We use ${SLOT} instead of doman for postgresql.eselect |
216 |
+ insinto /usr/share/postgresql-${SLOT}/man/ |
217 |
+ doins -r doc/src/sgml/man{1,3,7} |
218 |
+ if ! use server; then |
219 |
+ # Remove man pages for non-existent binaries |
220 |
+ for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do |
221 |
+ rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1" |
222 |
+ done |
223 |
+ fi |
224 |
+ docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7} |
225 |
+ |
226 |
+ insinto /etc/postgresql-${SLOT} |
227 |
+ newins src/bin/psql/psqlrc.sample psqlrc |
228 |
+ |
229 |
+ dodir /etc/eselect/postgresql/slots/${SLOT} |
230 |
+ echo "postgres_ebuilds=\"\${postgres_ebuilds} ${PF}\"" > \ |
231 |
+ "${ED}/etc/eselect/postgresql/slots/${SLOT}/base" |
232 |
+ |
233 |
+ use static-libs || find "${ED}" -name '*.a' -delete |
234 |
+ |
235 |
+ if use doc ; then |
236 |
+ docinto html |
237 |
+ dodoc doc/src/sgml/html/* |
238 |
+ |
239 |
+ docinto sgml |
240 |
+ dodoc doc/src/sgml/*.{sgml,dsl} |
241 |
+ fi |
242 |
+ |
243 |
+ if use server; then |
244 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
245 |
+ "${FILESDIR}/${PN}.confd" | newconfd - ${PN}-${SLOT} |
246 |
+ |
247 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
248 |
+ "${FILESDIR}/${PN}.init-pre_9.2" | newinitd - ${PN}-${SLOT} |
249 |
+ |
250 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
251 |
+ "${FILESDIR}/${PN}.service" | \ |
252 |
+ systemd_newunit - ${PN}-${SLOT}.service |
253 |
+ |
254 |
+ newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir |
255 |
+ |
256 |
+ use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session |
257 |
+ |
258 |
+ if use prefix ; then |
259 |
+ keepdir /run/postgresql |
260 |
+ fperms 0775 /run/postgresql |
261 |
+ fi |
262 |
+ fi |
263 |
+} |
264 |
+ |
265 |
+pkg_postinst() { |
266 |
+ postgresql-config update |
267 |
+ |
268 |
+ elog "If you need a global psqlrc-file, you can place it in:" |
269 |
+ elog " ${EROOT%/}/etc/postgresql-${SLOT}/" |
270 |
+ |
271 |
+ if [[ -z ${REPLACING_VERSIONS} ]] ; then |
272 |
+ elog |
273 |
+ elog "It looks like this is your first time installing PostgreSQL. Run the" |
274 |
+ elog "following command in all active shells to pick up changes to the default" |
275 |
+ elog "environment:" |
276 |
+ elog " source /etc/profile" |
277 |
+ fi |
278 |
+ |
279 |
+ if use server ; then |
280 |
+ elog |
281 |
+ elog "Gentoo specific documentation:" |
282 |
+ elog "https://wiki.gentoo.org/wiki/PostgreSQL" |
283 |
+ elog |
284 |
+ elog "Official documentation:" |
285 |
+ elog "http://www.postgresql.org/docs/${SLOT}/static/index.html" |
286 |
+ elog |
287 |
+ elog "The default location of the Unix-domain socket is:" |
288 |
+ elog " ${EROOT%/}/run/postgresql/" |
289 |
+ elog |
290 |
+ elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" |
291 |
+ elog "so that it contains your preferred locale in:" |
292 |
+ elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
293 |
+ elog |
294 |
+ elog "Then, execute the following command to setup the initial database" |
295 |
+ elog "environment:" |
296 |
+ elog " emerge --config =${CATEGORY}/${PF}" |
297 |
+ fi |
298 |
+} |
299 |
+ |
300 |
+pkg_prerm() { |
301 |
+ if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then |
302 |
+ ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?" |
303 |
+ ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL" |
304 |
+ |
305 |
+ ebegin "Resuming removal in 10 seconds (Control-C to cancel)" |
306 |
+ sleep 10 |
307 |
+ eend 0 |
308 |
+ fi |
309 |
+} |
310 |
+ |
311 |
+pkg_postrm() { |
312 |
+ postgresql-config update |
313 |
+} |
314 |
+ |
315 |
+pkg_config() { |
316 |
+ use server || die "USE flag 'server' not enabled. Nothing to configure." |
317 |
+ |
318 |
+ [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \ |
319 |
+ && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
320 |
+ [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/" |
321 |
+ [[ -z "${DATA_DIR}" ]] \ |
322 |
+ && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data" |
323 |
+ |
324 |
+ # environment.bz2 may not contain the same locale as the current system |
325 |
+ # locale. Unset and source from the current system locale. |
326 |
+ if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then |
327 |
+ unset LANG |
328 |
+ unset LC_CTYPE |
329 |
+ unset LC_NUMERIC |
330 |
+ unset LC_TIME |
331 |
+ unset LC_COLLATE |
332 |
+ unset LC_MONETARY |
333 |
+ unset LC_MESSAGES |
334 |
+ unset LC_ALL |
335 |
+ source "${EROOT%/}/etc/env.d/02locale" |
336 |
+ [ -n "${LANG}" ] && export LANG |
337 |
+ [ -n "${LC_CTYPE}" ] && export LC_CTYPE |
338 |
+ [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC |
339 |
+ [ -n "${LC_TIME}" ] && export LC_TIME |
340 |
+ [ -n "${LC_COLLATE}" ] && export LC_COLLATE |
341 |
+ [ -n "${LC_MONETARY}" ] && export LC_MONETARY |
342 |
+ [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES |
343 |
+ [ -n "${LC_ALL}" ] && export LC_ALL |
344 |
+ fi |
345 |
+ |
346 |
+ einfo "You can modify the paths and options passed to initdb by editing:" |
347 |
+ einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
348 |
+ einfo |
349 |
+ einfo "Information on options that can be passed to initdb are found at:" |
350 |
+ einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html" |
351 |
+ einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html" |
352 |
+ einfo |
353 |
+ einfo "PG_INITDB_OPTS is currently set to:" |
354 |
+ if [[ -z "${PG_INITDB_OPTS}" ]] ; then |
355 |
+ einfo " (none)" |
356 |
+ else |
357 |
+ einfo " ${PG_INITDB_OPTS}" |
358 |
+ fi |
359 |
+ einfo |
360 |
+ einfo "Configuration files will be installed to:" |
361 |
+ einfo " ${PGDATA}" |
362 |
+ einfo |
363 |
+ einfo "The database cluster will be created in:" |
364 |
+ einfo " ${DATA_DIR}" |
365 |
+ einfo |
366 |
+ while [ "$correct" != "true" ] ; do |
367 |
+ einfo "Are you ready to continue? (y/n)" |
368 |
+ read answer |
369 |
+ if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then |
370 |
+ correct="true" |
371 |
+ elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then |
372 |
+ die "Aborting initialization." |
373 |
+ else |
374 |
+ echo "Answer not recognized" |
375 |
+ fi |
376 |
+ done |
377 |
+ |
378 |
+ if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then |
379 |
+ eerror "The given directory, '${DATA_DIR}', is not empty." |
380 |
+ eerror "Modify DATA_DIR to point to an empty directory." |
381 |
+ die "${DATA_DIR} is not empty." |
382 |
+ fi |
383 |
+ |
384 |
+ einfo "Creating the data directory ..." |
385 |
+ if [[ ${EUID} == 0 ]] ; then |
386 |
+ mkdir -p "${DATA_DIR}" |
387 |
+ chown -Rf postgres:postgres "${DATA_DIR}" |
388 |
+ chmod 0700 "${DATA_DIR}" |
389 |
+ fi |
390 |
+ |
391 |
+ einfo "Initializing the database ..." |
392 |
+ |
393 |
+ if [[ ${EUID} == 0 ]] ; then |
394 |
+ su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}" |
395 |
+ else |
396 |
+ "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS} |
397 |
+ fi |
398 |
+ |
399 |
+ if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then |
400 |
+ mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}" |
401 |
+ ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}" |
402 |
+ fi |
403 |
+ |
404 |
+ cat <<- EOF >> "${PGDATA%/}"/postgresql.conf |
405 |
+ # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522 |
406 |
+ # On the off-chance that you might need to work with UTF-8 encoded |
407 |
+ # characters in PL/Perl |
408 |
+ plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";' |
409 |
+ EOF |
410 |
+ |
411 |
+ einfo "The autovacuum function, which was in contrib, has been moved to the main" |
412 |
+ einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled" |
413 |
+ einfo "by default. You can disable it in the cluster's:" |
414 |
+ einfo " ${PGDATA%/}/postgresql.conf" |
415 |
+ einfo |
416 |
+ einfo "The PostgreSQL server, by default, will log events to:" |
417 |
+ einfo " ${DATA_DIR%/}/postmaster.log" |
418 |
+ einfo |
419 |
+ if use prefix ; then |
420 |
+ einfo "The location of the configuration files have moved to:" |
421 |
+ einfo " ${PGDATA}" |
422 |
+ einfo "To start the server:" |
423 |
+ einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'" |
424 |
+ einfo "To stop:" |
425 |
+ einfo " pg_ctl stop -D ${DATA_DIR}" |
426 |
+ einfo |
427 |
+ einfo "Or move the configuration files back:" |
428 |
+ einfo "mv ${PGDATA}*.conf ${DATA_DIR}" |
429 |
+ else |
430 |
+ einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL" |
431 |
+ einfo "instead of 'pg_ctl'." |
432 |
+ fi |
433 |
+} |
434 |
|
435 |
diff --git a/dev-db/postgresql/postgresql-9.2.19.ebuild b/dev-db/postgresql/postgresql-9.2.19.ebuild |
436 |
new file mode 100644 |
437 |
index 00000000..73fdad1 |
438 |
--- /dev/null |
439 |
+++ b/dev-db/postgresql/postgresql-9.2.19.ebuild |
440 |
@@ -0,0 +1,394 @@ |
441 |
+# Copyright 1999-2016 Gentoo Foundation |
442 |
+# Distributed under the terms of the GNU General Public License v2 |
443 |
+# $Id$ |
444 |
+ |
445 |
+EAPI="5" |
446 |
+ |
447 |
+PYTHON_COMPAT=( python{2_7,3_4} ) |
448 |
+ |
449 |
+inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \ |
450 |
+ systemd user versionator |
451 |
+ |
452 |
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris" |
453 |
+ |
454 |
+SLOT="$(get_version_component_range 1-2)" |
455 |
+ |
456 |
+SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2" |
457 |
+ |
458 |
+LICENSE="POSTGRESQL GPL-2" |
459 |
+DESCRIPTION="PostgreSQL RDBMS" |
460 |
+HOMEPAGE="http://www.postgresql.org/" |
461 |
+ |
462 |
+LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr |
463 |
+ zh_CN zh_TW" |
464 |
+IUSE="doc kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python |
465 |
+ +readline selinux +server ssl static-libs tcl threads uuid xml zlib" |
466 |
+ |
467 |
+for lingua in ${LINGUAS}; do |
468 |
+ IUSE+=" linguas_${lingua}" |
469 |
+done |
470 |
+ |
471 |
+wanted_languages() { |
472 |
+ local enable_langs |
473 |
+ |
474 |
+ for lingua in ${LINGUAS} ; do |
475 |
+ use linguas_${lingua} && enable_langs+="${lingua} " |
476 |
+ done |
477 |
+ |
478 |
+ echo -n ${enable_langs} |
479 |
+} |
480 |
+ |
481 |
+CDEPEND=" |
482 |
+>=app-eselect/eselect-postgresql-1.2.0 |
483 |
+sys-apps/less |
484 |
+virtual/libintl |
485 |
+kerberos? ( virtual/krb5 ) |
486 |
+ldap? ( net-nds/openldap ) |
487 |
+pam? ( virtual/pam ) |
488 |
+perl? ( >=dev-lang/perl-5.8:= ) |
489 |
+python? ( ${PYTHON_DEPS} ) |
490 |
+readline? ( sys-libs/readline:0= ) |
491 |
+ssl? ( |
492 |
+ !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= ) |
493 |
+ libressl? ( dev-libs/libressl:= ) |
494 |
+) |
495 |
+tcl? ( >=dev-lang/tcl-8:0= ) |
496 |
+uuid? ( dev-libs/ossp-uuid ) |
497 |
+xml? ( dev-libs/libxml2 dev-libs/libxslt ) |
498 |
+zlib? ( sys-libs/zlib ) |
499 |
+" |
500 |
+ |
501 |
+DEPEND="${CDEPEND} |
502 |
+!!<sys-apps/sandbox-2.0 |
503 |
+sys-devel/bison |
504 |
+sys-devel/flex |
505 |
+nls? ( sys-devel/gettext ) |
506 |
+xml? ( virtual/pkgconfig ) |
507 |
+" |
508 |
+ |
509 |
+RDEPEND="${CDEPEND} |
510 |
+!dev-db/postgresql-docs:${SLOT} |
511 |
+!dev-db/postgresql-base:${SLOT} |
512 |
+!dev-db/postgresql-server:${SLOT} |
513 |
+selinux? ( sec-policy/selinux-postgresql ) |
514 |
+" |
515 |
+ |
516 |
+pkg_setup() { |
517 |
+ use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup |
518 |
+ |
519 |
+ enewgroup postgres 70 |
520 |
+ enewuser postgres 70 /bin/sh /var/lib/postgresql postgres |
521 |
+ |
522 |
+ use python && python-single-r1_pkg_setup |
523 |
+} |
524 |
+ |
525 |
+src_prepare() { |
526 |
+ # Work around PPC{,64} compilation bug where bool is already defined |
527 |
+ sed '/#ifndef __cplusplus/a #undef bool' -i src/include/c.h || die |
528 |
+ |
529 |
+ # Set proper run directory |
530 |
+ sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \ |
531 |
+ -i src/include/pg_config_manual.h || die |
532 |
+ |
533 |
+ use server || epatch "${FILESDIR}/${PN}-${SLOT}-no-server.patch" |
534 |
+ |
535 |
+ # Fix bug 486556 where the server would crash at start up because of |
536 |
+ # an infinite loop caused by a self-referencing symlink. |
537 |
+ epatch "${FILESDIR}/postgresql-9.2-9.4-tz-dir-overflow.patch" |
538 |
+ |
539 |
+ if use pam ; then |
540 |
+ sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \ |
541 |
+ -i src/backend/libpq/auth.c || \ |
542 |
+ die 'PGSQL_PAM_SERVICE rename failed.' |
543 |
+ fi |
544 |
+ |
545 |
+ epatch_user |
546 |
+} |
547 |
+ |
548 |
+src_configure() { |
549 |
+ case ${CHOST} in |
550 |
+ *-darwin*|*-solaris*) |
551 |
+ use nls && append-libs intl |
552 |
+ ;; |
553 |
+ esac |
554 |
+ |
555 |
+ export LDFLAGS_SL="${LDFLAGS}" |
556 |
+ export LDFLAGS_EX="${LDFLAGS}" |
557 |
+ |
558 |
+ local PO="${EPREFIX%/}" |
559 |
+ |
560 |
+ econf \ |
561 |
+ --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \ |
562 |
+ --datadir="${PO}/usr/share/postgresql-${SLOT}" \ |
563 |
+ --docdir="${PO}/usr/share/doc/${PF}" \ |
564 |
+ --includedir="${PO}/usr/include/postgresql-${SLOT}" \ |
565 |
+ --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \ |
566 |
+ --sysconfdir="${PO}/etc/postgresql-${SLOT}" \ |
567 |
+ --with-system-tzdata="${PO}/usr/share/zoneinfo" \ |
568 |
+ $(use_enable !pg_legacytimestamp integer-datetimes) \ |
569 |
+ $(use_enable threads thread-safety) \ |
570 |
+ $(use_with kerberos gssapi) \ |
571 |
+ $(use_with kerberos krb5) \ |
572 |
+ $(use_with ldap) \ |
573 |
+ $(use_with pam) \ |
574 |
+ $(use_with perl) \ |
575 |
+ $(use_with python) \ |
576 |
+ $(use_with readline) \ |
577 |
+ $(use_with ssl openssl) \ |
578 |
+ $(use_with tcl) \ |
579 |
+ $(use_with uuid ossp-uuid) \ |
580 |
+ $(use_with xml libxml) \ |
581 |
+ $(use_with xml libxslt) \ |
582 |
+ $(use_with zlib) \ |
583 |
+ "$(use_enable nls nls "$(wanted_languages)")" |
584 |
+} |
585 |
+ |
586 |
+src_compile() { |
587 |
+ emake |
588 |
+ emake -C contrib |
589 |
+} |
590 |
+ |
591 |
+src_install() { |
592 |
+ emake DESTDIR="${D}" install |
593 |
+ emake DESTDIR="${D}" install -C contrib |
594 |
+ |
595 |
+ dodoc README HISTORY doc/{TODO,bug.template} |
596 |
+ |
597 |
+ # man pages are already built, but if we have the target make them, |
598 |
+ # they'll be generated from source before being installed so we |
599 |
+ # manually install man pages. |
600 |
+ # We use ${SLOT} instead of doman for postgresql.eselect |
601 |
+ insinto /usr/share/postgresql-${SLOT}/man/ |
602 |
+ doins -r doc/src/sgml/man{1,3,7} |
603 |
+ if ! use server; then |
604 |
+ # Remove man pages for non-existent binaries |
605 |
+ for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do |
606 |
+ rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1" |
607 |
+ done |
608 |
+ fi |
609 |
+ docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7} |
610 |
+ |
611 |
+ insinto /etc/postgresql-${SLOT} |
612 |
+ newins src/bin/psql/psqlrc.sample psqlrc |
613 |
+ |
614 |
+ dodir /etc/eselect/postgresql/slots/${SLOT} |
615 |
+ echo "postgres_ebuilds=\"\${postgres_ebuilds} ${PF}\"" > \ |
616 |
+ "${ED}/etc/eselect/postgresql/slots/${SLOT}/base" |
617 |
+ |
618 |
+ use static-libs || find "${ED}" -name '*.a' -delete |
619 |
+ |
620 |
+ if use doc ; then |
621 |
+ docinto html |
622 |
+ dodoc doc/src/sgml/html/* |
623 |
+ |
624 |
+ docinto sgml |
625 |
+ dodoc doc/src/sgml/*.{sgml,dsl} |
626 |
+ fi |
627 |
+ |
628 |
+ if use server; then |
629 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
630 |
+ "${FILESDIR}/${PN}.confd" | newconfd - ${PN}-${SLOT} |
631 |
+ |
632 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
633 |
+ "${FILESDIR}/${PN}.init" | newinitd - ${PN}-${SLOT} |
634 |
+ |
635 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
636 |
+ "${FILESDIR}/${PN}.service" | \ |
637 |
+ systemd_newunit - ${PN}-${SLOT}.service |
638 |
+ |
639 |
+ newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir |
640 |
+ |
641 |
+ use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session |
642 |
+ |
643 |
+ if use prefix ; then |
644 |
+ keepdir /run/postgresql |
645 |
+ fperms 0775 /run/postgresql |
646 |
+ fi |
647 |
+ fi |
648 |
+} |
649 |
+ |
650 |
+pkg_postinst() { |
651 |
+ postgresql-config update |
652 |
+ |
653 |
+ elog "If you need a global psqlrc-file, you can place it in:" |
654 |
+ elog " ${EROOT%/}/etc/postgresql-${SLOT}/" |
655 |
+ |
656 |
+ if [[ -z ${REPLACING_VERSIONS} ]] ; then |
657 |
+ elog |
658 |
+ elog "It looks like this is your first time installing PostgreSQL. Run the" |
659 |
+ elog "following command in all active shells to pick up changes to the default" |
660 |
+ elog "environment:" |
661 |
+ elog " source /etc/profile" |
662 |
+ fi |
663 |
+ |
664 |
+ if use server ; then |
665 |
+ elog |
666 |
+ elog "Gentoo specific documentation:" |
667 |
+ elog "https://wiki.gentoo.org/wiki/PostgreSQL" |
668 |
+ elog |
669 |
+ elog "Official documentation:" |
670 |
+ elog "http://www.postgresql.org/docs/${SLOT}/static/index.html" |
671 |
+ elog |
672 |
+ elog "The default location of the Unix-domain socket is:" |
673 |
+ elog " ${EROOT%/}/run/postgresql/" |
674 |
+ elog |
675 |
+ elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" |
676 |
+ elog "so that it contains your preferred locale in:" |
677 |
+ elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
678 |
+ elog |
679 |
+ elog "Then, execute the following command to setup the initial database" |
680 |
+ elog "environment:" |
681 |
+ elog " emerge --config =${CATEGORY}/${PF}" |
682 |
+ fi |
683 |
+} |
684 |
+ |
685 |
+pkg_prerm() { |
686 |
+ if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then |
687 |
+ ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?" |
688 |
+ ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL" |
689 |
+ |
690 |
+ ebegin "Resuming removal in 10 seconds (Control-C to cancel)" |
691 |
+ sleep 10 |
692 |
+ eend 0 |
693 |
+ fi |
694 |
+} |
695 |
+ |
696 |
+pkg_postrm() { |
697 |
+ postgresql-config update |
698 |
+} |
699 |
+ |
700 |
+pkg_config() { |
701 |
+ use server || die "USE flag 'server' not enabled. Nothing to configure." |
702 |
+ |
703 |
+ [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \ |
704 |
+ && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
705 |
+ [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/" |
706 |
+ [[ -z "${DATA_DIR}" ]] \ |
707 |
+ && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data" |
708 |
+ |
709 |
+ # environment.bz2 may not contain the same locale as the current system |
710 |
+ # locale. Unset and source from the current system locale. |
711 |
+ if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then |
712 |
+ unset LANG |
713 |
+ unset LC_CTYPE |
714 |
+ unset LC_NUMERIC |
715 |
+ unset LC_TIME |
716 |
+ unset LC_COLLATE |
717 |
+ unset LC_MONETARY |
718 |
+ unset LC_MESSAGES |
719 |
+ unset LC_ALL |
720 |
+ source "${EROOT%/}/etc/env.d/02locale" |
721 |
+ [ -n "${LANG}" ] && export LANG |
722 |
+ [ -n "${LC_CTYPE}" ] && export LC_CTYPE |
723 |
+ [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC |
724 |
+ [ -n "${LC_TIME}" ] && export LC_TIME |
725 |
+ [ -n "${LC_COLLATE}" ] && export LC_COLLATE |
726 |
+ [ -n "${LC_MONETARY}" ] && export LC_MONETARY |
727 |
+ [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES |
728 |
+ [ -n "${LC_ALL}" ] && export LC_ALL |
729 |
+ fi |
730 |
+ |
731 |
+ einfo "You can modify the paths and options passed to initdb by editing:" |
732 |
+ einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
733 |
+ einfo |
734 |
+ einfo "Information on options that can be passed to initdb are found at:" |
735 |
+ einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html" |
736 |
+ einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html" |
737 |
+ einfo |
738 |
+ einfo "PG_INITDB_OPTS is currently set to:" |
739 |
+ if [[ -z "${PG_INITDB_OPTS}" ]] ; then |
740 |
+ einfo " (none)" |
741 |
+ else |
742 |
+ einfo " ${PG_INITDB_OPTS}" |
743 |
+ fi |
744 |
+ einfo |
745 |
+ einfo "Configuration files will be installed to:" |
746 |
+ einfo " ${PGDATA}" |
747 |
+ einfo |
748 |
+ einfo "The database cluster will be created in:" |
749 |
+ einfo " ${DATA_DIR}" |
750 |
+ einfo |
751 |
+ while [ "$correct" != "true" ] ; do |
752 |
+ einfo "Are you ready to continue? (y/n)" |
753 |
+ read answer |
754 |
+ if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then |
755 |
+ correct="true" |
756 |
+ elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then |
757 |
+ die "Aborting initialization." |
758 |
+ else |
759 |
+ echo "Answer not recognized" |
760 |
+ fi |
761 |
+ done |
762 |
+ |
763 |
+ if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then |
764 |
+ eerror "The given directory, '${DATA_DIR}', is not empty." |
765 |
+ eerror "Modify DATA_DIR to point to an empty directory." |
766 |
+ die "${DATA_DIR} is not empty." |
767 |
+ fi |
768 |
+ |
769 |
+ einfo "Creating the data directory ..." |
770 |
+ if [[ ${EUID} == 0 ]] ; then |
771 |
+ mkdir -p "${DATA_DIR}" |
772 |
+ chown -Rf postgres:postgres "${DATA_DIR}" |
773 |
+ chmod 0700 "${DATA_DIR}" |
774 |
+ fi |
775 |
+ |
776 |
+ einfo "Initializing the database ..." |
777 |
+ |
778 |
+ if [[ ${EUID} == 0 ]] ; then |
779 |
+ su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}" |
780 |
+ else |
781 |
+ "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS} |
782 |
+ fi |
783 |
+ |
784 |
+ if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then |
785 |
+ mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}" |
786 |
+ ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}" |
787 |
+ fi |
788 |
+ |
789 |
+ cat <<- EOF >> "${PGDATA%/}"/postgresql.conf |
790 |
+ # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522 |
791 |
+ # On the off-chance that you might need to work with UTF-8 encoded |
792 |
+ # characters in PL/Perl |
793 |
+ plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";' |
794 |
+ EOF |
795 |
+ |
796 |
+ einfo "The autovacuum function, which was in contrib, has been moved to the main" |
797 |
+ einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled" |
798 |
+ einfo "by default. You can disable it in the cluster's:" |
799 |
+ einfo " ${PGDATA%/}/postgresql.conf" |
800 |
+ einfo |
801 |
+ einfo "The PostgreSQL server, by default, will log events to:" |
802 |
+ einfo " ${DATA_DIR%/}/postmaster.log" |
803 |
+ einfo |
804 |
+ if use prefix ; then |
805 |
+ einfo "The location of the configuration files have moved to:" |
806 |
+ einfo " ${PGDATA}" |
807 |
+ einfo "To start the server:" |
808 |
+ einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'" |
809 |
+ einfo "To stop:" |
810 |
+ einfo " pg_ctl stop -D ${DATA_DIR}" |
811 |
+ einfo |
812 |
+ einfo "Or move the configuration files back:" |
813 |
+ einfo "mv ${PGDATA}*.conf ${DATA_DIR}" |
814 |
+ else |
815 |
+ einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL" |
816 |
+ einfo "instead of 'pg_ctl'." |
817 |
+ fi |
818 |
+} |
819 |
+ |
820 |
+src_test() { |
821 |
+ if use server && [[ ${UID} -ne 0 ]] ; then |
822 |
+ emake check |
823 |
+ |
824 |
+ einfo "If you think other tests besides the regression tests are necessary, please" |
825 |
+ einfo "submit a bug including a patch for this ebuild to enable them." |
826 |
+ else |
827 |
+ use server || \ |
828 |
+ ewarn 'Tests cannot be run without the "server" use flag enabled.' |
829 |
+ [[ ${UID} -eq 0 ]] || \ |
830 |
+ ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.' |
831 |
+ |
832 |
+ ewarn 'Skipping.' |
833 |
+ fi |
834 |
+} |
835 |
|
836 |
diff --git a/dev-db/postgresql/postgresql-9.3.15.ebuild b/dev-db/postgresql/postgresql-9.3.15.ebuild |
837 |
new file mode 100644 |
838 |
index 00000000..bc1ce93 |
839 |
--- /dev/null |
840 |
+++ b/dev-db/postgresql/postgresql-9.3.15.ebuild |
841 |
@@ -0,0 +1,399 @@ |
842 |
+# Copyright 1999-2016 Gentoo Foundation |
843 |
+# Distributed under the terms of the GNU General Public License v2 |
844 |
+# $Id$ |
845 |
+ |
846 |
+EAPI="5" |
847 |
+ |
848 |
+PYTHON_COMPAT=( python{2_7,3_4} ) |
849 |
+ |
850 |
+inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \ |
851 |
+ systemd user versionator |
852 |
+ |
853 |
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris" |
854 |
+ |
855 |
+SLOT="$(get_version_component_range 1-2)" |
856 |
+ |
857 |
+SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2" |
858 |
+ |
859 |
+LICENSE="POSTGRESQL GPL-2" |
860 |
+DESCRIPTION="PostgreSQL RDBMS" |
861 |
+HOMEPAGE="http://www.postgresql.org/" |
862 |
+ |
863 |
+LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr |
864 |
+ zh_CN zh_TW" |
865 |
+IUSE="doc kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python |
866 |
+ +readline selinux +server ssl static-libs tcl threads uuid xml zlib" |
867 |
+ |
868 |
+for lingua in ${LINGUAS}; do |
869 |
+ IUSE+=" linguas_${lingua}" |
870 |
+done |
871 |
+ |
872 |
+wanted_languages() { |
873 |
+ local enable_langs |
874 |
+ |
875 |
+ for lingua in ${LINGUAS} ; do |
876 |
+ use linguas_${lingua} && enable_langs+="${lingua} " |
877 |
+ done |
878 |
+ |
879 |
+ echo -n ${enable_langs} |
880 |
+} |
881 |
+ |
882 |
+CDEPEND=" |
883 |
+>=app-eselect/eselect-postgresql-1.2.0 |
884 |
+sys-apps/less |
885 |
+virtual/libintl |
886 |
+kerberos? ( virtual/krb5 ) |
887 |
+ldap? ( net-nds/openldap ) |
888 |
+pam? ( virtual/pam ) |
889 |
+perl? ( >=dev-lang/perl-5.8:= ) |
890 |
+python? ( ${PYTHON_DEPS} ) |
891 |
+readline? ( sys-libs/readline:0= ) |
892 |
+ssl? ( |
893 |
+ !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= ) |
894 |
+ libressl? ( dev-libs/libressl:= ) |
895 |
+) |
896 |
+tcl? ( >=dev-lang/tcl-8:0= ) |
897 |
+uuid? ( dev-libs/ossp-uuid ) |
898 |
+xml? ( dev-libs/libxml2 dev-libs/libxslt ) |
899 |
+zlib? ( sys-libs/zlib ) |
900 |
+" |
901 |
+ |
902 |
+DEPEND="${CDEPEND} |
903 |
+!!<sys-apps/sandbox-2.0 |
904 |
+sys-devel/bison |
905 |
+sys-devel/flex |
906 |
+nls? ( sys-devel/gettext ) |
907 |
+xml? ( virtual/pkgconfig ) |
908 |
+" |
909 |
+ |
910 |
+RDEPEND="${CDEPEND} |
911 |
+!dev-db/postgresql-docs:${SLOT} |
912 |
+!dev-db/postgresql-base:${SLOT} |
913 |
+!dev-db/postgresql-server:${SLOT} |
914 |
+selinux? ( sec-policy/selinux-postgresql ) |
915 |
+" |
916 |
+ |
917 |
+pkg_setup() { |
918 |
+ use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup |
919 |
+ |
920 |
+ enewgroup postgres 70 |
921 |
+ enewuser postgres 70 /bin/sh /var/lib/postgresql postgres |
922 |
+ |
923 |
+ use python && python-single-r1_pkg_setup |
924 |
+} |
925 |
+ |
926 |
+src_prepare() { |
927 |
+ # Work around PPC{,64} compilation bug where bool is already defined |
928 |
+ sed '/#ifndef __cplusplus/a #undef bool' -i src/include/c.h || die |
929 |
+ |
930 |
+ # Set proper run directory |
931 |
+ sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \ |
932 |
+ -i src/include/pg_config_manual.h || die |
933 |
+ |
934 |
+ # Rely on $PATH being in the proper order so that the correct |
935 |
+ # install program is used for modules utilizing PGXS in both |
936 |
+ # hardened and non-hardened environments. (Bug #528786) |
937 |
+ sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die |
938 |
+ |
939 |
+ use server || epatch "${FILESDIR}/${PN}-${SLOT}-no-server.patch" |
940 |
+ |
941 |
+ # Fix bug 486556 where the server would crash at start up because of |
942 |
+ # an infinite loop caused by a self-referencing symlink. |
943 |
+ epatch "${FILESDIR}/postgresql-9.2-9.4-tz-dir-overflow.patch" |
944 |
+ |
945 |
+ if use pam ; then |
946 |
+ sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \ |
947 |
+ -i src/backend/libpq/auth.c || \ |
948 |
+ die 'PGSQL_PAM_SERVICE rename failed.' |
949 |
+ fi |
950 |
+ |
951 |
+ epatch_user |
952 |
+} |
953 |
+ |
954 |
+src_configure() { |
955 |
+ case ${CHOST} in |
956 |
+ *-darwin*|*-solaris*) |
957 |
+ use nls && append-libs intl |
958 |
+ ;; |
959 |
+ esac |
960 |
+ |
961 |
+ export LDFLAGS_SL="${LDFLAGS}" |
962 |
+ export LDFLAGS_EX="${LDFLAGS}" |
963 |
+ |
964 |
+ local PO="${EPREFIX%/}" |
965 |
+ |
966 |
+ econf \ |
967 |
+ --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \ |
968 |
+ --datadir="${PO}/usr/share/postgresql-${SLOT}" \ |
969 |
+ --docdir="${PO}/usr/share/doc/${PF}" \ |
970 |
+ --includedir="${PO}/usr/include/postgresql-${SLOT}" \ |
971 |
+ --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \ |
972 |
+ --sysconfdir="${PO}/etc/postgresql-${SLOT}" \ |
973 |
+ --with-system-tzdata="${PO}/usr/share/zoneinfo" \ |
974 |
+ $(use_enable !pg_legacytimestamp integer-datetimes) \ |
975 |
+ $(use_enable threads thread-safety) \ |
976 |
+ $(use_with kerberos gssapi) \ |
977 |
+ $(use_with kerberos krb5) \ |
978 |
+ $(use_with ldap) \ |
979 |
+ $(use_with pam) \ |
980 |
+ $(use_with perl) \ |
981 |
+ $(use_with python) \ |
982 |
+ $(use_with readline) \ |
983 |
+ $(use_with ssl openssl) \ |
984 |
+ $(use_with tcl) \ |
985 |
+ $(use_with uuid ossp-uuid) \ |
986 |
+ $(use_with xml libxml) \ |
987 |
+ $(use_with xml libxslt) \ |
988 |
+ $(use_with zlib) \ |
989 |
+ "$(use_enable nls nls "$(wanted_languages)")" |
990 |
+} |
991 |
+ |
992 |
+src_compile() { |
993 |
+ emake |
994 |
+ emake -C contrib |
995 |
+} |
996 |
+ |
997 |
+src_install() { |
998 |
+ emake DESTDIR="${D}" install |
999 |
+ emake DESTDIR="${D}" install -C contrib |
1000 |
+ |
1001 |
+ dodoc README HISTORY doc/{TODO,bug.template} |
1002 |
+ |
1003 |
+ # man pages are already built, but if we have the target make them, |
1004 |
+ # they'll be generated from source before being installed so we |
1005 |
+ # manually install man pages. |
1006 |
+ # We use ${SLOT} instead of doman for postgresql.eselect |
1007 |
+ insinto /usr/share/postgresql-${SLOT}/man/ |
1008 |
+ doins -r doc/src/sgml/man{1,3,7} |
1009 |
+ if ! use server; then |
1010 |
+ # Remove man pages for non-existent binaries |
1011 |
+ for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do |
1012 |
+ rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1" |
1013 |
+ done |
1014 |
+ fi |
1015 |
+ docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7} |
1016 |
+ |
1017 |
+ insinto /etc/postgresql-${SLOT} |
1018 |
+ newins src/bin/psql/psqlrc.sample psqlrc |
1019 |
+ |
1020 |
+ dodir /etc/eselect/postgresql/slots/${SLOT} |
1021 |
+ echo "postgres_ebuilds=\"\${postgres_ebuilds} ${PF}\"" > \ |
1022 |
+ "${ED}/etc/eselect/postgresql/slots/${SLOT}/base" |
1023 |
+ |
1024 |
+ use static-libs || find "${ED}" -name '*.a' -delete |
1025 |
+ |
1026 |
+ if use doc ; then |
1027 |
+ docinto html |
1028 |
+ dodoc doc/src/sgml/html/* |
1029 |
+ |
1030 |
+ docinto sgml |
1031 |
+ dodoc doc/src/sgml/*.{sgml,dsl} |
1032 |
+ fi |
1033 |
+ |
1034 |
+ if use server; then |
1035 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1036 |
+ "${FILESDIR}/${PN}.confd" | newconfd - ${PN}-${SLOT} |
1037 |
+ |
1038 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1039 |
+ "${FILESDIR}/${PN}.init-9.3" | newinitd - ${PN}-${SLOT} |
1040 |
+ |
1041 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1042 |
+ "${FILESDIR}/${PN}.service" | \ |
1043 |
+ systemd_newunit - ${PN}-${SLOT}.service |
1044 |
+ |
1045 |
+ newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir |
1046 |
+ |
1047 |
+ use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session |
1048 |
+ |
1049 |
+ if use prefix ; then |
1050 |
+ keepdir /run/postgresql |
1051 |
+ fperms 0775 /run/postgresql |
1052 |
+ fi |
1053 |
+ fi |
1054 |
+} |
1055 |
+ |
1056 |
+pkg_postinst() { |
1057 |
+ postgresql-config update |
1058 |
+ |
1059 |
+ elog "If you need a global psqlrc-file, you can place it in:" |
1060 |
+ elog " ${EROOT%/}/etc/postgresql-${SLOT}/" |
1061 |
+ |
1062 |
+ if [[ -z ${REPLACING_VERSIONS} ]] ; then |
1063 |
+ elog |
1064 |
+ elog "It looks like this is your first time installing PostgreSQL. Run the" |
1065 |
+ elog "following command in all active shells to pick up changes to the default" |
1066 |
+ elog "environment:" |
1067 |
+ elog " source /etc/profile" |
1068 |
+ fi |
1069 |
+ |
1070 |
+ if use server ; then |
1071 |
+ elog |
1072 |
+ elog "Gentoo specific documentation:" |
1073 |
+ elog "https://wiki.gentoo.org/wiki/PostgreSQL" |
1074 |
+ elog |
1075 |
+ elog "Official documentation:" |
1076 |
+ elog "http://www.postgresql.org/docs/${SLOT}/static/index.html" |
1077 |
+ elog |
1078 |
+ elog "The default location of the Unix-domain socket is:" |
1079 |
+ elog " ${EROOT%/}/run/postgresql/" |
1080 |
+ elog |
1081 |
+ elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" |
1082 |
+ elog "so that it contains your preferred locale in:" |
1083 |
+ elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
1084 |
+ elog |
1085 |
+ elog "Then, execute the following command to setup the initial database" |
1086 |
+ elog "environment:" |
1087 |
+ elog " emerge --config =${CATEGORY}/${PF}" |
1088 |
+ fi |
1089 |
+} |
1090 |
+ |
1091 |
+pkg_prerm() { |
1092 |
+ if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then |
1093 |
+ ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?" |
1094 |
+ ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL" |
1095 |
+ |
1096 |
+ ebegin "Resuming removal in 10 seconds (Control-C to cancel)" |
1097 |
+ sleep 10 |
1098 |
+ eend 0 |
1099 |
+ fi |
1100 |
+} |
1101 |
+ |
1102 |
+pkg_postrm() { |
1103 |
+ postgresql-config update |
1104 |
+} |
1105 |
+ |
1106 |
+pkg_config() { |
1107 |
+ use server || die "USE flag 'server' not enabled. Nothing to configure." |
1108 |
+ |
1109 |
+ [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \ |
1110 |
+ && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
1111 |
+ [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/" |
1112 |
+ [[ -z "${DATA_DIR}" ]] \ |
1113 |
+ && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data" |
1114 |
+ |
1115 |
+ # environment.bz2 may not contain the same locale as the current system |
1116 |
+ # locale. Unset and source from the current system locale. |
1117 |
+ if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then |
1118 |
+ unset LANG |
1119 |
+ unset LC_CTYPE |
1120 |
+ unset LC_NUMERIC |
1121 |
+ unset LC_TIME |
1122 |
+ unset LC_COLLATE |
1123 |
+ unset LC_MONETARY |
1124 |
+ unset LC_MESSAGES |
1125 |
+ unset LC_ALL |
1126 |
+ source "${EROOT%/}/etc/env.d/02locale" |
1127 |
+ [ -n "${LANG}" ] && export LANG |
1128 |
+ [ -n "${LC_CTYPE}" ] && export LC_CTYPE |
1129 |
+ [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC |
1130 |
+ [ -n "${LC_TIME}" ] && export LC_TIME |
1131 |
+ [ -n "${LC_COLLATE}" ] && export LC_COLLATE |
1132 |
+ [ -n "${LC_MONETARY}" ] && export LC_MONETARY |
1133 |
+ [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES |
1134 |
+ [ -n "${LC_ALL}" ] && export LC_ALL |
1135 |
+ fi |
1136 |
+ |
1137 |
+ einfo "You can modify the paths and options passed to initdb by editing:" |
1138 |
+ einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
1139 |
+ einfo |
1140 |
+ einfo "Information on options that can be passed to initdb are found at:" |
1141 |
+ einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html" |
1142 |
+ einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html" |
1143 |
+ einfo |
1144 |
+ einfo "PG_INITDB_OPTS is currently set to:" |
1145 |
+ if [[ -z "${PG_INITDB_OPTS}" ]] ; then |
1146 |
+ einfo " (none)" |
1147 |
+ else |
1148 |
+ einfo " ${PG_INITDB_OPTS}" |
1149 |
+ fi |
1150 |
+ einfo |
1151 |
+ einfo "Configuration files will be installed to:" |
1152 |
+ einfo " ${PGDATA}" |
1153 |
+ einfo |
1154 |
+ einfo "The database cluster will be created in:" |
1155 |
+ einfo " ${DATA_DIR}" |
1156 |
+ einfo |
1157 |
+ while [ "$correct" != "true" ] ; do |
1158 |
+ einfo "Are you ready to continue? (y/n)" |
1159 |
+ read answer |
1160 |
+ if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then |
1161 |
+ correct="true" |
1162 |
+ elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then |
1163 |
+ die "Aborting initialization." |
1164 |
+ else |
1165 |
+ echo "Answer not recognized" |
1166 |
+ fi |
1167 |
+ done |
1168 |
+ |
1169 |
+ if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then |
1170 |
+ eerror "The given directory, '${DATA_DIR}', is not empty." |
1171 |
+ eerror "Modify DATA_DIR to point to an empty directory." |
1172 |
+ die "${DATA_DIR} is not empty." |
1173 |
+ fi |
1174 |
+ |
1175 |
+ einfo "Creating the data directory ..." |
1176 |
+ if [[ ${EUID} == 0 ]] ; then |
1177 |
+ mkdir -p "${DATA_DIR}" |
1178 |
+ chown -Rf postgres:postgres "${DATA_DIR}" |
1179 |
+ chmod 0700 "${DATA_DIR}" |
1180 |
+ fi |
1181 |
+ |
1182 |
+ einfo "Initializing the database ..." |
1183 |
+ |
1184 |
+ if [[ ${EUID} == 0 ]] ; then |
1185 |
+ su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}" |
1186 |
+ else |
1187 |
+ "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS} |
1188 |
+ fi |
1189 |
+ |
1190 |
+ if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then |
1191 |
+ mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}" |
1192 |
+ ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}" |
1193 |
+ fi |
1194 |
+ |
1195 |
+ cat <<- EOF >> "${PGDATA%/}"/postgresql.conf |
1196 |
+ # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522 |
1197 |
+ # On the off-chance that you might need to work with UTF-8 encoded |
1198 |
+ # characters in PL/Perl |
1199 |
+ plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";' |
1200 |
+ EOF |
1201 |
+ |
1202 |
+ einfo "The autovacuum function, which was in contrib, has been moved to the main" |
1203 |
+ einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled" |
1204 |
+ einfo "by default. You can disable it in the cluster's:" |
1205 |
+ einfo " ${PGDATA%/}/postgresql.conf" |
1206 |
+ einfo |
1207 |
+ einfo "The PostgreSQL server, by default, will log events to:" |
1208 |
+ einfo " ${DATA_DIR%/}/postmaster.log" |
1209 |
+ einfo |
1210 |
+ if use prefix ; then |
1211 |
+ einfo "The location of the configuration files have moved to:" |
1212 |
+ einfo " ${PGDATA}" |
1213 |
+ einfo "To start the server:" |
1214 |
+ einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'" |
1215 |
+ einfo "To stop:" |
1216 |
+ einfo " pg_ctl stop -D ${DATA_DIR}" |
1217 |
+ einfo |
1218 |
+ einfo "Or move the configuration files back:" |
1219 |
+ einfo "mv ${PGDATA}*.conf ${DATA_DIR}" |
1220 |
+ else |
1221 |
+ einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL" |
1222 |
+ einfo "instead of 'pg_ctl'." |
1223 |
+ fi |
1224 |
+} |
1225 |
+ |
1226 |
+src_test() { |
1227 |
+ if use server && [[ ${UID} -ne 0 ]] ; then |
1228 |
+ emake check |
1229 |
+ |
1230 |
+ einfo "If you think other tests besides the regression tests are necessary, please" |
1231 |
+ einfo "submit a bug including a patch for this ebuild to enable them." |
1232 |
+ else |
1233 |
+ use server || \ |
1234 |
+ ewarn 'Tests cannot be run without the "server" use flag enabled.' |
1235 |
+ [[ ${UID} -eq 0 ]] || \ |
1236 |
+ ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.' |
1237 |
+ |
1238 |
+ ewarn 'Skipping.' |
1239 |
+ fi |
1240 |
+} |
1241 |
|
1242 |
diff --git a/dev-db/postgresql/postgresql-9.4.10.ebuild b/dev-db/postgresql/postgresql-9.4.10.ebuild |
1243 |
new file mode 100644 |
1244 |
index 00000000..42b20ad |
1245 |
--- /dev/null |
1246 |
+++ b/dev-db/postgresql/postgresql-9.4.10.ebuild |
1247 |
@@ -0,0 +1,431 @@ |
1248 |
+# Copyright 1999-2016 Gentoo Foundation |
1249 |
+# Distributed under the terms of the GNU General Public License v2 |
1250 |
+# $Id$ |
1251 |
+ |
1252 |
+EAPI="5" |
1253 |
+ |
1254 |
+PYTHON_COMPAT=( python{2_7,3_4} ) |
1255 |
+ |
1256 |
+inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \ |
1257 |
+ systemd user versionator |
1258 |
+ |
1259 |
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris" |
1260 |
+ |
1261 |
+SLOT="$(get_version_component_range 1-2)" |
1262 |
+ |
1263 |
+SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2" |
1264 |
+ |
1265 |
+LICENSE="POSTGRESQL GPL-2" |
1266 |
+DESCRIPTION="PostgreSQL RDBMS" |
1267 |
+HOMEPAGE="http://www.postgresql.org/" |
1268 |
+ |
1269 |
+LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr |
1270 |
+ zh_CN zh_TW" |
1271 |
+IUSE="doc kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python |
1272 |
+ +readline selinux +server ssl static-libs tcl threads uuid xml zlib" |
1273 |
+ |
1274 |
+for lingua in ${LINGUAS}; do |
1275 |
+ IUSE+=" linguas_${lingua}" |
1276 |
+done |
1277 |
+ |
1278 |
+wanted_languages() { |
1279 |
+ local enable_langs |
1280 |
+ |
1281 |
+ for lingua in ${LINGUAS} ; do |
1282 |
+ use linguas_${lingua} && enable_langs+="${lingua} " |
1283 |
+ done |
1284 |
+ |
1285 |
+ echo -n ${enable_langs} |
1286 |
+} |
1287 |
+ |
1288 |
+CDEPEND=" |
1289 |
+>=app-eselect/eselect-postgresql-1.2.0 |
1290 |
+sys-apps/less |
1291 |
+virtual/libintl |
1292 |
+kerberos? ( virtual/krb5 ) |
1293 |
+ldap? ( net-nds/openldap ) |
1294 |
+pam? ( virtual/pam ) |
1295 |
+perl? ( >=dev-lang/perl-5.8:= ) |
1296 |
+python? ( ${PYTHON_DEPS} ) |
1297 |
+readline? ( sys-libs/readline:0= ) |
1298 |
+ssl? ( |
1299 |
+ !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= ) |
1300 |
+ libressl? ( dev-libs/libressl:= ) |
1301 |
+) |
1302 |
+tcl? ( >=dev-lang/tcl-8:0= ) |
1303 |
+xml? ( dev-libs/libxml2 dev-libs/libxslt ) |
1304 |
+zlib? ( sys-libs/zlib ) |
1305 |
+" |
1306 |
+ |
1307 |
+# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no |
1308 |
+# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems, |
1309 |
+# the libc includes UUID functions. |
1310 |
+UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} ) |
1311 |
+BSD_LIBC=( elibc_{Free,Net,Open}BSD ) |
1312 |
+ |
1313 |
+nest_usedep() { |
1314 |
+ local front back |
1315 |
+ while [[ ${#} -gt 1 ]]; do |
1316 |
+ front+="${1}? ( " |
1317 |
+ back+=" )" |
1318 |
+ shift |
1319 |
+ done |
1320 |
+ echo "${front}${1}${back}" |
1321 |
+} |
1322 |
+ |
1323 |
+IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}" |
1324 |
+CDEPEND+=" |
1325 |
+uuid? ( |
1326 |
+ ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )} |
1327 |
+ $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid) |
1328 |
+)" |
1329 |
+ |
1330 |
+DEPEND="${CDEPEND} |
1331 |
+!!<sys-apps/sandbox-2.0 |
1332 |
+sys-devel/bison |
1333 |
+sys-devel/flex |
1334 |
+nls? ( sys-devel/gettext ) |
1335 |
+xml? ( virtual/pkgconfig ) |
1336 |
+" |
1337 |
+ |
1338 |
+RDEPEND="${CDEPEND} |
1339 |
+!dev-db/postgresql-docs:${SLOT} |
1340 |
+!dev-db/postgresql-base:${SLOT} |
1341 |
+!dev-db/postgresql-server:${SLOT} |
1342 |
+selinux? ( sec-policy/selinux-postgresql ) |
1343 |
+" |
1344 |
+ |
1345 |
+pkg_setup() { |
1346 |
+ use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup |
1347 |
+ |
1348 |
+ enewgroup postgres 70 |
1349 |
+ enewuser postgres 70 /bin/sh /var/lib/postgresql postgres |
1350 |
+ |
1351 |
+ use python && python-single-r1_pkg_setup |
1352 |
+} |
1353 |
+ |
1354 |
+src_prepare() { |
1355 |
+ # Work around PPC{,64} compilation bug where bool is already defined |
1356 |
+ sed '/#ifndef __cplusplus/a #undef bool' -i src/include/c.h || die |
1357 |
+ |
1358 |
+ # Set proper run directory |
1359 |
+ sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \ |
1360 |
+ -i src/include/pg_config_manual.h || die |
1361 |
+ |
1362 |
+ # Rely on $PATH being in the proper order so that the correct |
1363 |
+ # install program is used for modules utilizing PGXS in both |
1364 |
+ # hardened and non-hardened environments. (Bug #528786) |
1365 |
+ sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die |
1366 |
+ |
1367 |
+ use server || epatch "${FILESDIR}/${PN}-${SLOT}-no-server.patch" |
1368 |
+ |
1369 |
+ # Fix bug 486556 where the server would crash at start up because of |
1370 |
+ # an infinite loop caused by a self-referencing symlink. |
1371 |
+ epatch "${FILESDIR}/postgresql-9.2-9.4-tz-dir-overflow.patch" |
1372 |
+ |
1373 |
+ if use pam ; then |
1374 |
+ sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \ |
1375 |
+ -i src/backend/libpq/auth.c || \ |
1376 |
+ die 'PGSQL_PAM_SERVICE rename failed.' |
1377 |
+ fi |
1378 |
+ |
1379 |
+ epatch_user |
1380 |
+} |
1381 |
+ |
1382 |
+src_configure() { |
1383 |
+ case ${CHOST} in |
1384 |
+ *-darwin*|*-solaris*) |
1385 |
+ use nls && append-libs intl |
1386 |
+ ;; |
1387 |
+ esac |
1388 |
+ |
1389 |
+ export LDFLAGS_SL="${LDFLAGS}" |
1390 |
+ export LDFLAGS_EX="${LDFLAGS}" |
1391 |
+ |
1392 |
+ local PO="${EPREFIX%/}" |
1393 |
+ |
1394 |
+ local i uuid_config="" |
1395 |
+ if use uuid; then |
1396 |
+ for i in ${UTIL_LINUX_LIBC[@]}; do |
1397 |
+ use ${i} && uuid_config="--with-uuid=e2fs" |
1398 |
+ done |
1399 |
+ for i in ${BSD_LIBC[@]}; do |
1400 |
+ use ${i} && uuid_config="--with-uuid=bsd" |
1401 |
+ done |
1402 |
+ [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp" |
1403 |
+ fi |
1404 |
+ |
1405 |
+ econf \ |
1406 |
+ --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \ |
1407 |
+ --datadir="${PO}/usr/share/postgresql-${SLOT}" \ |
1408 |
+ --docdir="${PO}/usr/share/doc/${PF}" \ |
1409 |
+ --includedir="${PO}/usr/include/postgresql-${SLOT}" \ |
1410 |
+ --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \ |
1411 |
+ --sysconfdir="${PO}/etc/postgresql-${SLOT}" \ |
1412 |
+ --with-system-tzdata="${PO}/usr/share/zoneinfo" \ |
1413 |
+ $(use_enable !pg_legacytimestamp integer-datetimes) \ |
1414 |
+ $(use_enable threads thread-safety) \ |
1415 |
+ $(use_with kerberos gssapi) \ |
1416 |
+ $(use_with ldap) \ |
1417 |
+ $(use_with pam) \ |
1418 |
+ $(use_with perl) \ |
1419 |
+ $(use_with python) \ |
1420 |
+ $(use_with readline) \ |
1421 |
+ $(use_with ssl openssl) \ |
1422 |
+ $(use_with tcl) \ |
1423 |
+ ${uuid_config} \ |
1424 |
+ $(use_with xml libxml) \ |
1425 |
+ $(use_with xml libxslt) \ |
1426 |
+ $(use_with zlib) \ |
1427 |
+ "$(use_enable nls nls "$(wanted_languages)")" |
1428 |
+} |
1429 |
+ |
1430 |
+src_compile() { |
1431 |
+ emake |
1432 |
+ emake -C contrib |
1433 |
+} |
1434 |
+ |
1435 |
+src_install() { |
1436 |
+ emake DESTDIR="${D}" install |
1437 |
+ emake DESTDIR="${D}" install -C contrib |
1438 |
+ |
1439 |
+ dodoc README HISTORY doc/{TODO,bug.template} |
1440 |
+ |
1441 |
+ # man pages are already built, but if we have the target make them, |
1442 |
+ # they'll be generated from source before being installed so we |
1443 |
+ # manually install man pages. |
1444 |
+ # We use ${SLOT} instead of doman for postgresql.eselect |
1445 |
+ insinto /usr/share/postgresql-${SLOT}/man/ |
1446 |
+ doins -r doc/src/sgml/man{1,3,7} |
1447 |
+ if ! use server; then |
1448 |
+ # Remove man pages for non-existent binaries |
1449 |
+ for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do |
1450 |
+ rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1" |
1451 |
+ done |
1452 |
+ fi |
1453 |
+ docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7} |
1454 |
+ |
1455 |
+ insinto /etc/postgresql-${SLOT} |
1456 |
+ newins src/bin/psql/psqlrc.sample psqlrc |
1457 |
+ |
1458 |
+ dodir /etc/eselect/postgresql/slots/${SLOT} |
1459 |
+ echo "postgres_ebuilds=\"\${postgres_ebuilds} ${PF}\"" > \ |
1460 |
+ "${ED}/etc/eselect/postgresql/slots/${SLOT}/base" |
1461 |
+ |
1462 |
+ use static-libs || find "${ED}" -name '*.a' -delete |
1463 |
+ |
1464 |
+ if use doc ; then |
1465 |
+ docinto html |
1466 |
+ dodoc doc/src/sgml/html/* |
1467 |
+ |
1468 |
+ docinto sgml |
1469 |
+ dodoc doc/src/sgml/*.{sgml,dsl} |
1470 |
+ fi |
1471 |
+ |
1472 |
+ if use server; then |
1473 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1474 |
+ "${FILESDIR}/${PN}.confd" | newconfd - ${PN}-${SLOT} |
1475 |
+ |
1476 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1477 |
+ "${FILESDIR}/${PN}.init-9.3" | newinitd - ${PN}-${SLOT} |
1478 |
+ |
1479 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1480 |
+ "${FILESDIR}/${PN}.service" | \ |
1481 |
+ systemd_newunit - ${PN}-${SLOT}.service |
1482 |
+ |
1483 |
+ newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir |
1484 |
+ |
1485 |
+ use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session |
1486 |
+ |
1487 |
+ if use prefix ; then |
1488 |
+ keepdir /run/postgresql |
1489 |
+ fperms 0775 /run/postgresql |
1490 |
+ fi |
1491 |
+ fi |
1492 |
+} |
1493 |
+ |
1494 |
+pkg_postinst() { |
1495 |
+ postgresql-config update |
1496 |
+ |
1497 |
+ elog "If you need a global psqlrc-file, you can place it in:" |
1498 |
+ elog " ${EROOT%/}/etc/postgresql-${SLOT}/" |
1499 |
+ |
1500 |
+ if [[ -z ${REPLACING_VERSIONS} ]] ; then |
1501 |
+ elog |
1502 |
+ elog "It looks like this is your first time installing PostgreSQL. Run the" |
1503 |
+ elog "following command in all active shells to pick up changes to the default" |
1504 |
+ elog "environment:" |
1505 |
+ elog " source /etc/profile" |
1506 |
+ fi |
1507 |
+ |
1508 |
+ if use server ; then |
1509 |
+ elog |
1510 |
+ elog "Gentoo specific documentation:" |
1511 |
+ elog "https://wiki.gentoo.org/wiki/PostgreSQL" |
1512 |
+ elog |
1513 |
+ elog "Official documentation:" |
1514 |
+ elog "http://www.postgresql.org/docs/${SLOT}/static/index.html" |
1515 |
+ elog |
1516 |
+ elog "The default location of the Unix-domain socket is:" |
1517 |
+ elog " ${EROOT%/}/run/postgresql/" |
1518 |
+ elog |
1519 |
+ elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" |
1520 |
+ elog "so that it contains your preferred locale in:" |
1521 |
+ elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
1522 |
+ elog |
1523 |
+ elog "Then, execute the following command to setup the initial database" |
1524 |
+ elog "environment:" |
1525 |
+ elog " emerge --config =${CATEGORY}/${PF}" |
1526 |
+ fi |
1527 |
+} |
1528 |
+ |
1529 |
+pkg_prerm() { |
1530 |
+ if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then |
1531 |
+ ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?" |
1532 |
+ ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL" |
1533 |
+ |
1534 |
+ ebegin "Resuming removal in 10 seconds (Control-C to cancel)" |
1535 |
+ sleep 10 |
1536 |
+ eend 0 |
1537 |
+ fi |
1538 |
+} |
1539 |
+ |
1540 |
+pkg_postrm() { |
1541 |
+ postgresql-config update |
1542 |
+} |
1543 |
+ |
1544 |
+pkg_config() { |
1545 |
+ use server || die "USE flag 'server' not enabled. Nothing to configure." |
1546 |
+ |
1547 |
+ [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \ |
1548 |
+ && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
1549 |
+ [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/" |
1550 |
+ [[ -z "${DATA_DIR}" ]] \ |
1551 |
+ && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data" |
1552 |
+ |
1553 |
+ # environment.bz2 may not contain the same locale as the current system |
1554 |
+ # locale. Unset and source from the current system locale. |
1555 |
+ if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then |
1556 |
+ unset LANG |
1557 |
+ unset LC_CTYPE |
1558 |
+ unset LC_NUMERIC |
1559 |
+ unset LC_TIME |
1560 |
+ unset LC_COLLATE |
1561 |
+ unset LC_MONETARY |
1562 |
+ unset LC_MESSAGES |
1563 |
+ unset LC_ALL |
1564 |
+ source "${EROOT%/}/etc/env.d/02locale" |
1565 |
+ [ -n "${LANG}" ] && export LANG |
1566 |
+ [ -n "${LC_CTYPE}" ] && export LC_CTYPE |
1567 |
+ [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC |
1568 |
+ [ -n "${LC_TIME}" ] && export LC_TIME |
1569 |
+ [ -n "${LC_COLLATE}" ] && export LC_COLLATE |
1570 |
+ [ -n "${LC_MONETARY}" ] && export LC_MONETARY |
1571 |
+ [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES |
1572 |
+ [ -n "${LC_ALL}" ] && export LC_ALL |
1573 |
+ fi |
1574 |
+ |
1575 |
+ einfo "You can modify the paths and options passed to initdb by editing:" |
1576 |
+ einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
1577 |
+ einfo |
1578 |
+ einfo "Information on options that can be passed to initdb are found at:" |
1579 |
+ einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html" |
1580 |
+ einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html" |
1581 |
+ einfo |
1582 |
+ einfo "PG_INITDB_OPTS is currently set to:" |
1583 |
+ if [[ -z "${PG_INITDB_OPTS}" ]] ; then |
1584 |
+ einfo " (none)" |
1585 |
+ else |
1586 |
+ einfo " ${PG_INITDB_OPTS}" |
1587 |
+ fi |
1588 |
+ einfo |
1589 |
+ einfo "Configuration files will be installed to:" |
1590 |
+ einfo " ${PGDATA}" |
1591 |
+ einfo |
1592 |
+ einfo "The database cluster will be created in:" |
1593 |
+ einfo " ${DATA_DIR}" |
1594 |
+ einfo |
1595 |
+ while [ "$correct" != "true" ] ; do |
1596 |
+ einfo "Are you ready to continue? (y/n)" |
1597 |
+ read answer |
1598 |
+ if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then |
1599 |
+ correct="true" |
1600 |
+ elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then |
1601 |
+ die "Aborting initialization." |
1602 |
+ else |
1603 |
+ echo "Answer not recognized" |
1604 |
+ fi |
1605 |
+ done |
1606 |
+ |
1607 |
+ if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then |
1608 |
+ eerror "The given directory, '${DATA_DIR}', is not empty." |
1609 |
+ eerror "Modify DATA_DIR to point to an empty directory." |
1610 |
+ die "${DATA_DIR} is not empty." |
1611 |
+ fi |
1612 |
+ |
1613 |
+ einfo "Creating the data directory ..." |
1614 |
+ if [[ ${EUID} == 0 ]] ; then |
1615 |
+ mkdir -p "${DATA_DIR}" |
1616 |
+ chown -Rf postgres:postgres "${DATA_DIR}" |
1617 |
+ chmod 0700 "${DATA_DIR}" |
1618 |
+ fi |
1619 |
+ |
1620 |
+ einfo "Initializing the database ..." |
1621 |
+ |
1622 |
+ if [[ ${EUID} == 0 ]] ; then |
1623 |
+ su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}" |
1624 |
+ else |
1625 |
+ "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS} |
1626 |
+ fi |
1627 |
+ |
1628 |
+ if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then |
1629 |
+ mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}" |
1630 |
+ ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}" |
1631 |
+ fi |
1632 |
+ |
1633 |
+ cat <<- EOF >> "${PGDATA%/}"/postgresql.conf |
1634 |
+ # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522 |
1635 |
+ # On the off-chance that you might need to work with UTF-8 encoded |
1636 |
+ # characters in PL/Perl |
1637 |
+ plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";' |
1638 |
+ EOF |
1639 |
+ |
1640 |
+ einfo "The autovacuum function, which was in contrib, has been moved to the main" |
1641 |
+ einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled" |
1642 |
+ einfo "by default. You can disable it in the cluster's:" |
1643 |
+ einfo " ${PGDATA%/}/postgresql.conf" |
1644 |
+ einfo |
1645 |
+ einfo "The PostgreSQL server, by default, will log events to:" |
1646 |
+ einfo " ${DATA_DIR%/}/postmaster.log" |
1647 |
+ einfo |
1648 |
+ if use prefix ; then |
1649 |
+ einfo "The location of the configuration files have moved to:" |
1650 |
+ einfo " ${PGDATA}" |
1651 |
+ einfo "To start the server:" |
1652 |
+ einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'" |
1653 |
+ einfo "To stop:" |
1654 |
+ einfo " pg_ctl stop -D ${DATA_DIR}" |
1655 |
+ einfo |
1656 |
+ einfo "Or move the configuration files back:" |
1657 |
+ einfo "mv ${PGDATA}*.conf ${DATA_DIR}" |
1658 |
+ else |
1659 |
+ einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL" |
1660 |
+ einfo "instead of 'pg_ctl'." |
1661 |
+ fi |
1662 |
+} |
1663 |
+ |
1664 |
+src_test() { |
1665 |
+ if use server && [[ ${UID} -ne 0 ]] ; then |
1666 |
+ emake check |
1667 |
+ |
1668 |
+ einfo "If you think other tests besides the regression tests are necessary, please" |
1669 |
+ einfo "submit a bug including a patch for this ebuild to enable them." |
1670 |
+ else |
1671 |
+ use server || \ |
1672 |
+ ewarn 'Tests cannot be run without the "server" use flag enabled.' |
1673 |
+ [[ ${UID} -eq 0 ]] || \ |
1674 |
+ ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.' |
1675 |
+ |
1676 |
+ ewarn 'Skipping.' |
1677 |
+ fi |
1678 |
+} |
1679 |
|
1680 |
diff --git a/dev-db/postgresql/postgresql-9.5.5.ebuild b/dev-db/postgresql/postgresql-9.5.5.ebuild |
1681 |
new file mode 100644 |
1682 |
index 00000000..886d41c |
1683 |
--- /dev/null |
1684 |
+++ b/dev-db/postgresql/postgresql-9.5.5.ebuild |
1685 |
@@ -0,0 +1,437 @@ |
1686 |
+# Copyright 1999-2016 Gentoo Foundation |
1687 |
+# Distributed under the terms of the GNU General Public License v2 |
1688 |
+# $Id$ |
1689 |
+ |
1690 |
+EAPI="5" |
1691 |
+ |
1692 |
+PYTHON_COMPAT=( python{2_7,3_4,3_5} ) |
1693 |
+ |
1694 |
+inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \ |
1695 |
+ systemd user versionator |
1696 |
+ |
1697 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris" |
1698 |
+ |
1699 |
+SLOT="$(get_version_component_range 1-2)" |
1700 |
+ |
1701 |
+SRC_URI="mirror://postgresql/source/v${PV}/postgresql-${PV}.tar.bz2" |
1702 |
+ |
1703 |
+LICENSE="POSTGRESQL GPL-2" |
1704 |
+DESCRIPTION="PostgreSQL RDBMS" |
1705 |
+HOMEPAGE="http://www.postgresql.org/" |
1706 |
+ |
1707 |
+LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr |
1708 |
+ zh_CN zh_TW" |
1709 |
+IUSE="doc kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python |
1710 |
+ +readline selinux +server ssl static-libs tcl threads uuid xml zlib" |
1711 |
+ |
1712 |
+for lingua in ${LINGUAS}; do |
1713 |
+ IUSE+=" linguas_${lingua}" |
1714 |
+done |
1715 |
+ |
1716 |
+wanted_languages() { |
1717 |
+ local enable_langs |
1718 |
+ |
1719 |
+ for lingua in ${LINGUAS} ; do |
1720 |
+ use linguas_${lingua} && enable_langs+="${lingua} " |
1721 |
+ done |
1722 |
+ |
1723 |
+ echo -n ${enable_langs} |
1724 |
+} |
1725 |
+ |
1726 |
+CDEPEND=" |
1727 |
+>=app-eselect/eselect-postgresql-1.2.0 |
1728 |
+sys-apps/less |
1729 |
+virtual/libintl |
1730 |
+kerberos? ( virtual/krb5 ) |
1731 |
+ldap? ( net-nds/openldap ) |
1732 |
+pam? ( virtual/pam ) |
1733 |
+perl? ( >=dev-lang/perl-5.8:= ) |
1734 |
+python? ( ${PYTHON_DEPS} ) |
1735 |
+readline? ( sys-libs/readline:0= ) |
1736 |
+ssl? ( |
1737 |
+ !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= ) |
1738 |
+ libressl? ( dev-libs/libressl:= ) |
1739 |
+) |
1740 |
+tcl? ( >=dev-lang/tcl-8:0= ) |
1741 |
+xml? ( dev-libs/libxml2 dev-libs/libxslt ) |
1742 |
+zlib? ( sys-libs/zlib ) |
1743 |
+" |
1744 |
+ |
1745 |
+# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no |
1746 |
+# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems, |
1747 |
+# the libc includes UUID functions. |
1748 |
+UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} ) |
1749 |
+BSD_LIBC=( elibc_{Free,Net,Open}BSD ) |
1750 |
+ |
1751 |
+nest_usedep() { |
1752 |
+ local front back |
1753 |
+ while [[ ${#} -gt 1 ]]; do |
1754 |
+ front+="${1}? ( " |
1755 |
+ back+=" )" |
1756 |
+ shift |
1757 |
+ done |
1758 |
+ echo "${front}${1}${back}" |
1759 |
+} |
1760 |
+ |
1761 |
+IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}" |
1762 |
+CDEPEND+=" |
1763 |
+uuid? ( |
1764 |
+ ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )} |
1765 |
+ $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid) |
1766 |
+)" |
1767 |
+ |
1768 |
+DEPEND="${CDEPEND} |
1769 |
+!!<sys-apps/sandbox-2.0 |
1770 |
+sys-devel/bison |
1771 |
+sys-devel/flex |
1772 |
+nls? ( sys-devel/gettext ) |
1773 |
+xml? ( virtual/pkgconfig ) |
1774 |
+" |
1775 |
+ |
1776 |
+RDEPEND="${CDEPEND} |
1777 |
+!dev-db/postgresql-docs:${SLOT} |
1778 |
+!dev-db/postgresql-base:${SLOT} |
1779 |
+!dev-db/postgresql-server:${SLOT} |
1780 |
+selinux? ( sec-policy/selinux-postgresql ) |
1781 |
+" |
1782 |
+ |
1783 |
+pkg_setup() { |
1784 |
+ use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup |
1785 |
+ |
1786 |
+ enewgroup postgres 70 |
1787 |
+ enewuser postgres 70 /bin/sh /var/lib/postgresql postgres |
1788 |
+ |
1789 |
+ use python && python-single-r1_pkg_setup |
1790 |
+} |
1791 |
+ |
1792 |
+src_prepare() { |
1793 |
+ # Work around PPC{,64} compilation bug where bool is already defined |
1794 |
+ sed '/#ifndef __cplusplus/a #undef bool' -i src/include/c.h || die |
1795 |
+ |
1796 |
+ # Set proper run directory |
1797 |
+ sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \ |
1798 |
+ -i src/include/pg_config_manual.h || die |
1799 |
+ |
1800 |
+ # Rely on $PATH being in the proper order so that the correct |
1801 |
+ # install program is used for modules utilizing PGXS in both |
1802 |
+ # hardened and non-hardened environments. (Bug #528786) |
1803 |
+ sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die |
1804 |
+ |
1805 |
+ use server || epatch "${FILESDIR}/${PN}-${SLOT}-no-server.patch" |
1806 |
+ |
1807 |
+ # Fix bug 486556 where the server would crash at start up because of |
1808 |
+ # an infinite loop caused by a self-referencing symlink. |
1809 |
+ epatch "${FILESDIR}/postgresql-9.2-9.4-tz-dir-overflow.patch" |
1810 |
+ |
1811 |
+ if use pam ; then |
1812 |
+ sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \ |
1813 |
+ -i src/backend/libpq/auth.c || \ |
1814 |
+ die 'PGSQL_PAM_SERVICE rename failed.' |
1815 |
+ fi |
1816 |
+ |
1817 |
+ epatch_user |
1818 |
+} |
1819 |
+ |
1820 |
+src_configure() { |
1821 |
+ case ${CHOST} in |
1822 |
+ *-darwin*|*-solaris*) |
1823 |
+ use nls && append-libs intl |
1824 |
+ ;; |
1825 |
+ esac |
1826 |
+ |
1827 |
+ export LDFLAGS_SL="${LDFLAGS}" |
1828 |
+ export LDFLAGS_EX="${LDFLAGS}" |
1829 |
+ |
1830 |
+ local PO="${EPREFIX%/}" |
1831 |
+ |
1832 |
+ local i uuid_config="" |
1833 |
+ if use uuid; then |
1834 |
+ for i in ${UTIL_LINUX_LIBC[@]}; do |
1835 |
+ use ${i} && uuid_config="--with-uuid=e2fs" |
1836 |
+ done |
1837 |
+ for i in ${BSD_LIBC[@]}; do |
1838 |
+ use ${i} && uuid_config="--with-uuid=bsd" |
1839 |
+ done |
1840 |
+ [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp" |
1841 |
+ fi |
1842 |
+ |
1843 |
+ econf \ |
1844 |
+ --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \ |
1845 |
+ --datadir="${PO}/usr/share/postgresql-${SLOT}" \ |
1846 |
+ --docdir="${PO}/usr/share/doc/${PF}" \ |
1847 |
+ --includedir="${PO}/usr/include/postgresql-${SLOT}" \ |
1848 |
+ --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \ |
1849 |
+ --sysconfdir="${PO}/etc/postgresql-${SLOT}" \ |
1850 |
+ --with-system-tzdata="${PO}/usr/share/zoneinfo" \ |
1851 |
+ $(use_enable !alpha spinlocks) \ |
1852 |
+ $(use_enable !pg_legacytimestamp integer-datetimes) \ |
1853 |
+ $(use_enable threads thread-safety) \ |
1854 |
+ $(use_with kerberos gssapi) \ |
1855 |
+ $(use_with ldap) \ |
1856 |
+ $(use_with pam) \ |
1857 |
+ $(use_with perl) \ |
1858 |
+ $(use_with python) \ |
1859 |
+ $(use_with readline) \ |
1860 |
+ $(use_with ssl openssl) \ |
1861 |
+ $(use_with tcl) \ |
1862 |
+ ${uuid_config} \ |
1863 |
+ $(use_with xml libxml) \ |
1864 |
+ $(use_with xml libxslt) \ |
1865 |
+ $(use_with zlib) \ |
1866 |
+ "$(use_enable nls nls "$(wanted_languages)")" |
1867 |
+} |
1868 |
+ |
1869 |
+src_compile() { |
1870 |
+ emake |
1871 |
+ emake -C contrib |
1872 |
+} |
1873 |
+ |
1874 |
+src_install() { |
1875 |
+ emake DESTDIR="${D}" install |
1876 |
+ emake DESTDIR="${D}" install -C contrib |
1877 |
+ |
1878 |
+ dodoc README HISTORY doc/{TODO,bug.template} |
1879 |
+ |
1880 |
+ # man pages are already built, but if we have the target make them, |
1881 |
+ # they'll be generated from source before being installed so we |
1882 |
+ # manually install man pages. |
1883 |
+ # We use ${SLOT} instead of doman for postgresql.eselect |
1884 |
+ insinto /usr/share/postgresql-${SLOT}/man/ |
1885 |
+ doins -r doc/src/sgml/man{1,3,7} |
1886 |
+ if ! use server; then |
1887 |
+ # Remove man pages for non-existent binaries |
1888 |
+ for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do |
1889 |
+ rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1" |
1890 |
+ done |
1891 |
+ fi |
1892 |
+ docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7} |
1893 |
+ |
1894 |
+ insinto /etc/postgresql-${SLOT} |
1895 |
+ newins src/bin/psql/psqlrc.sample psqlrc |
1896 |
+ |
1897 |
+ dodir /etc/eselect/postgresql/slots/${SLOT} |
1898 |
+ echo "postgres_ebuilds=\"\${postgres_ebuilds} ${PF}\"" > \ |
1899 |
+ "${ED}/etc/eselect/postgresql/slots/${SLOT}/base" |
1900 |
+ |
1901 |
+ use static-libs || find "${ED}" -name '*.a' -delete |
1902 |
+ |
1903 |
+ if use doc ; then |
1904 |
+ docinto html |
1905 |
+ dodoc doc/src/sgml/html/* |
1906 |
+ |
1907 |
+ docinto sgml |
1908 |
+ dodoc doc/src/sgml/*.{sgml,dsl} |
1909 |
+ fi |
1910 |
+ |
1911 |
+ if use server; then |
1912 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1913 |
+ "${FILESDIR}/${PN}.confd" | newconfd - ${PN}-${SLOT} |
1914 |
+ |
1915 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1916 |
+ "${FILESDIR}/${PN}.init-9.3" | newinitd - ${PN}-${SLOT} |
1917 |
+ |
1918 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1919 |
+ "${FILESDIR}/${PN}.service" | \ |
1920 |
+ systemd_newunit - ${PN}-${SLOT}.service |
1921 |
+ |
1922 |
+ newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir |
1923 |
+ |
1924 |
+ use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session |
1925 |
+ |
1926 |
+ if use prefix ; then |
1927 |
+ keepdir /run/postgresql |
1928 |
+ fperms 0775 /run/postgresql |
1929 |
+ fi |
1930 |
+ fi |
1931 |
+} |
1932 |
+ |
1933 |
+pkg_postinst() { |
1934 |
+ postgresql-config update |
1935 |
+ |
1936 |
+ if use alpha && use server ; then |
1937 |
+ ewarn "PostgreSQL 9.5+ no longer has native spinlock support on Alpha platforms." |
1938 |
+ ewarn "As a result, performance will be extremely degraded." |
1939 |
+ fi |
1940 |
+ |
1941 |
+ elog "If you need a global psqlrc-file, you can place it in:" |
1942 |
+ elog " ${EROOT%/}/etc/postgresql-${SLOT}/" |
1943 |
+ |
1944 |
+ if [[ -z ${REPLACING_VERSIONS} ]] ; then |
1945 |
+ elog |
1946 |
+ elog "It looks like this is your first time installing PostgreSQL. Run the" |
1947 |
+ elog "following command in all active shells to pick up changes to the default" |
1948 |
+ elog "environment:" |
1949 |
+ elog " source /etc/profile" |
1950 |
+ fi |
1951 |
+ |
1952 |
+ if use server ; then |
1953 |
+ elog |
1954 |
+ elog "Gentoo specific documentation:" |
1955 |
+ elog "https://wiki.gentoo.org/wiki/PostgreSQL" |
1956 |
+ elog |
1957 |
+ elog "Official documentation:" |
1958 |
+ elog "http://www.postgresql.org/docs/${SLOT}/static/index.html" |
1959 |
+ elog |
1960 |
+ elog "The default location of the Unix-domain socket is:" |
1961 |
+ elog " ${EROOT%/}/run/postgresql/" |
1962 |
+ elog |
1963 |
+ elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" |
1964 |
+ elog "so that it contains your preferred locale in:" |
1965 |
+ elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
1966 |
+ elog |
1967 |
+ elog "Then, execute the following command to setup the initial database" |
1968 |
+ elog "environment:" |
1969 |
+ elog " emerge --config =${CATEGORY}/${PF}" |
1970 |
+ fi |
1971 |
+} |
1972 |
+ |
1973 |
+pkg_prerm() { |
1974 |
+ if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then |
1975 |
+ ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?" |
1976 |
+ ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL" |
1977 |
+ |
1978 |
+ ebegin "Resuming removal in 10 seconds (Control-C to cancel)" |
1979 |
+ sleep 10 |
1980 |
+ eend 0 |
1981 |
+ fi |
1982 |
+} |
1983 |
+ |
1984 |
+pkg_postrm() { |
1985 |
+ postgresql-config update |
1986 |
+} |
1987 |
+ |
1988 |
+pkg_config() { |
1989 |
+ use server || die "USE flag 'server' not enabled. Nothing to configure." |
1990 |
+ |
1991 |
+ [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \ |
1992 |
+ && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
1993 |
+ [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/" |
1994 |
+ [[ -z "${DATA_DIR}" ]] \ |
1995 |
+ && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data" |
1996 |
+ |
1997 |
+ # environment.bz2 may not contain the same locale as the current system |
1998 |
+ # locale. Unset and source from the current system locale. |
1999 |
+ if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then |
2000 |
+ unset LANG |
2001 |
+ unset LC_CTYPE |
2002 |
+ unset LC_NUMERIC |
2003 |
+ unset LC_TIME |
2004 |
+ unset LC_COLLATE |
2005 |
+ unset LC_MONETARY |
2006 |
+ unset LC_MESSAGES |
2007 |
+ unset LC_ALL |
2008 |
+ source "${EROOT%/}/etc/env.d/02locale" |
2009 |
+ [ -n "${LANG}" ] && export LANG |
2010 |
+ [ -n "${LC_CTYPE}" ] && export LC_CTYPE |
2011 |
+ [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC |
2012 |
+ [ -n "${LC_TIME}" ] && export LC_TIME |
2013 |
+ [ -n "${LC_COLLATE}" ] && export LC_COLLATE |
2014 |
+ [ -n "${LC_MONETARY}" ] && export LC_MONETARY |
2015 |
+ [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES |
2016 |
+ [ -n "${LC_ALL}" ] && export LC_ALL |
2017 |
+ fi |
2018 |
+ |
2019 |
+ einfo "You can modify the paths and options passed to initdb by editing:" |
2020 |
+ einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
2021 |
+ einfo |
2022 |
+ einfo "Information on options that can be passed to initdb are found at:" |
2023 |
+ einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html" |
2024 |
+ einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html" |
2025 |
+ einfo |
2026 |
+ einfo "PG_INITDB_OPTS is currently set to:" |
2027 |
+ if [[ -z "${PG_INITDB_OPTS}" ]] ; then |
2028 |
+ einfo " (none)" |
2029 |
+ else |
2030 |
+ einfo " ${PG_INITDB_OPTS}" |
2031 |
+ fi |
2032 |
+ einfo |
2033 |
+ einfo "Configuration files will be installed to:" |
2034 |
+ einfo " ${PGDATA}" |
2035 |
+ einfo |
2036 |
+ einfo "The database cluster will be created in:" |
2037 |
+ einfo " ${DATA_DIR}" |
2038 |
+ einfo |
2039 |
+ while [ "$correct" != "true" ] ; do |
2040 |
+ einfo "Are you ready to continue? (y/n)" |
2041 |
+ read answer |
2042 |
+ if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then |
2043 |
+ correct="true" |
2044 |
+ elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then |
2045 |
+ die "Aborting initialization." |
2046 |
+ else |
2047 |
+ echo "Answer not recognized" |
2048 |
+ fi |
2049 |
+ done |
2050 |
+ |
2051 |
+ if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then |
2052 |
+ eerror "The given directory, '${DATA_DIR}', is not empty." |
2053 |
+ eerror "Modify DATA_DIR to point to an empty directory." |
2054 |
+ die "${DATA_DIR} is not empty." |
2055 |
+ fi |
2056 |
+ |
2057 |
+ einfo "Creating the data directory ..." |
2058 |
+ if [[ ${EUID} == 0 ]] ; then |
2059 |
+ mkdir -p "${DATA_DIR}" |
2060 |
+ chown -Rf postgres:postgres "${DATA_DIR}" |
2061 |
+ chmod 0700 "${DATA_DIR}" |
2062 |
+ fi |
2063 |
+ |
2064 |
+ einfo "Initializing the database ..." |
2065 |
+ |
2066 |
+ if [[ ${EUID} == 0 ]] ; then |
2067 |
+ su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}" |
2068 |
+ else |
2069 |
+ "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS} |
2070 |
+ fi |
2071 |
+ |
2072 |
+ if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then |
2073 |
+ mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}" |
2074 |
+ ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}" |
2075 |
+ fi |
2076 |
+ |
2077 |
+ cat <<- EOF >> "${PGDATA%/}"/postgresql.conf |
2078 |
+ # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522 |
2079 |
+ # On the off-chance that you might need to work with UTF-8 encoded |
2080 |
+ # characters in PL/Perl |
2081 |
+ plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";' |
2082 |
+ EOF |
2083 |
+ |
2084 |
+ einfo "The autovacuum function, which was in contrib, has been moved to the main" |
2085 |
+ einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled" |
2086 |
+ einfo "by default. You can disable it in the cluster's:" |
2087 |
+ einfo " ${PGDATA%/}/postgresql.conf" |
2088 |
+ einfo |
2089 |
+ einfo "The PostgreSQL server, by default, will log events to:" |
2090 |
+ einfo " ${DATA_DIR%/}/postmaster.log" |
2091 |
+ einfo |
2092 |
+ if use prefix ; then |
2093 |
+ einfo "The location of the configuration files have moved to:" |
2094 |
+ einfo " ${PGDATA}" |
2095 |
+ einfo "To start the server:" |
2096 |
+ einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'" |
2097 |
+ einfo "To stop:" |
2098 |
+ einfo " pg_ctl stop -D ${DATA_DIR}" |
2099 |
+ einfo |
2100 |
+ einfo "Or move the configuration files back:" |
2101 |
+ einfo "mv ${PGDATA}*.conf ${DATA_DIR}" |
2102 |
+ else |
2103 |
+ einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL" |
2104 |
+ einfo "instead of 'pg_ctl'." |
2105 |
+ fi |
2106 |
+} |
2107 |
+ |
2108 |
+src_test() { |
2109 |
+ if use server && [[ ${UID} -ne 0 ]] ; then |
2110 |
+ emake check |
2111 |
+ |
2112 |
+ einfo "If you think other tests besides the regression tests are necessary, please" |
2113 |
+ einfo "submit a bug including a patch for this ebuild to enable them." |
2114 |
+ else |
2115 |
+ use server || \ |
2116 |
+ ewarn 'Tests cannot be run without the "server" use flag enabled.' |
2117 |
+ [[ ${UID} -eq 0 ]] || \ |
2118 |
+ ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.' |
2119 |
+ |
2120 |
+ ewarn 'Skipping.' |
2121 |
+ fi |
2122 |
+} |
2123 |
|
2124 |
diff --git a/dev-db/postgresql/postgresql-9.6.1.ebuild b/dev-db/postgresql/postgresql-9.6.1.ebuild |
2125 |
new file mode 100644 |
2126 |
index 00000000..4a76627 |
2127 |
--- /dev/null |
2128 |
+++ b/dev-db/postgresql/postgresql-9.6.1.ebuild |
2129 |
@@ -0,0 +1,434 @@ |
2130 |
+# Copyright 1999-2016 Gentoo Foundation |
2131 |
+# Distributed under the terms of the GNU General Public License v2 |
2132 |
+# $Id$ |
2133 |
+ |
2134 |
+EAPI="5" |
2135 |
+ |
2136 |
+PYTHON_COMPAT=( python{2_7,3_4,3_5} ) |
2137 |
+ |
2138 |
+inherit eutils flag-o-matic linux-info multilib pam prefix python-single-r1 \ |
2139 |
+ systemd user versionator |
2140 |
+ |
2141 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris" |
2142 |
+ |
2143 |
+SLOT="$(get_version_component_range 1-2)" |
2144 |
+ |
2145 |
+MY_PV=${PV/_/} |
2146 |
+S="${WORKDIR}/${PN}-${MY_PV}" |
2147 |
+ |
2148 |
+SRC_URI="mirror://postgresql/source/v${MY_PV}/postgresql-${MY_PV}.tar.bz2" |
2149 |
+ |
2150 |
+LICENSE="POSTGRESQL GPL-2" |
2151 |
+DESCRIPTION="PostgreSQL RDBMS" |
2152 |
+HOMEPAGE="http://www.postgresql.org/" |
2153 |
+ |
2154 |
+LINGUAS="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr |
2155 |
+ zh_CN zh_TW" |
2156 |
+IUSE="doc kerberos kernel_linux ldap libressl nls pam perl -pg_legacytimestamp python |
2157 |
+ +readline selinux +server ssl static-libs tcl threads uuid xml zlib" |
2158 |
+ |
2159 |
+for lingua in ${LINGUAS}; do |
2160 |
+ IUSE+=" linguas_${lingua}" |
2161 |
+done |
2162 |
+ |
2163 |
+wanted_languages() { |
2164 |
+ local enable_langs |
2165 |
+ |
2166 |
+ for lingua in ${LINGUAS} ; do |
2167 |
+ use linguas_${lingua} && enable_langs+="${lingua} " |
2168 |
+ done |
2169 |
+ |
2170 |
+ echo -n ${enable_langs} |
2171 |
+} |
2172 |
+ |
2173 |
+CDEPEND=" |
2174 |
+>=app-eselect/eselect-postgresql-1.2.0 |
2175 |
+sys-apps/less |
2176 |
+virtual/libintl |
2177 |
+kerberos? ( virtual/krb5 ) |
2178 |
+ldap? ( net-nds/openldap ) |
2179 |
+pam? ( virtual/pam ) |
2180 |
+perl? ( >=dev-lang/perl-5.8:= ) |
2181 |
+python? ( ${PYTHON_DEPS} ) |
2182 |
+readline? ( sys-libs/readline:0= ) |
2183 |
+ssl? ( |
2184 |
+ !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= ) |
2185 |
+ libressl? ( dev-libs/libressl:= ) |
2186 |
+) |
2187 |
+tcl? ( >=dev-lang/tcl-8:0= ) |
2188 |
+xml? ( dev-libs/libxml2 dev-libs/libxslt ) |
2189 |
+zlib? ( sys-libs/zlib ) |
2190 |
+" |
2191 |
+ |
2192 |
+# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no |
2193 |
+# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems, |
2194 |
+# the libc includes UUID functions. |
2195 |
+UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} ) |
2196 |
+BSD_LIBC=( elibc_{Free,Net,Open}BSD ) |
2197 |
+ |
2198 |
+nest_usedep() { |
2199 |
+ local front back |
2200 |
+ while [[ ${#} -gt 1 ]]; do |
2201 |
+ front+="${1}? ( " |
2202 |
+ back+=" )" |
2203 |
+ shift |
2204 |
+ done |
2205 |
+ echo "${front}${1}${back}" |
2206 |
+} |
2207 |
+ |
2208 |
+IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}" |
2209 |
+CDEPEND+=" |
2210 |
+uuid? ( |
2211 |
+ ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )} |
2212 |
+ $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid) |
2213 |
+)" |
2214 |
+ |
2215 |
+DEPEND="${CDEPEND} |
2216 |
+!!<sys-apps/sandbox-2.0 |
2217 |
+sys-devel/bison |
2218 |
+sys-devel/flex |
2219 |
+nls? ( sys-devel/gettext ) |
2220 |
+xml? ( virtual/pkgconfig ) |
2221 |
+" |
2222 |
+ |
2223 |
+RDEPEND="${CDEPEND} |
2224 |
+!dev-db/postgresql-docs:${SLOT} |
2225 |
+!dev-db/postgresql-base:${SLOT} |
2226 |
+!dev-db/postgresql-server:${SLOT} |
2227 |
+selinux? ( sec-policy/selinux-postgresql ) |
2228 |
+" |
2229 |
+ |
2230 |
+pkg_setup() { |
2231 |
+ use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup |
2232 |
+ |
2233 |
+ enewgroup postgres 70 |
2234 |
+ enewuser postgres 70 /bin/sh /var/lib/postgresql postgres |
2235 |
+ |
2236 |
+ use python && python-single-r1_pkg_setup |
2237 |
+} |
2238 |
+ |
2239 |
+src_prepare() { |
2240 |
+ # Work around PPC{,64} compilation bug where bool is already defined |
2241 |
+ sed '/#ifndef __cplusplus/a #undef bool' -i src/include/c.h || die |
2242 |
+ |
2243 |
+ # Set proper run directory |
2244 |
+ sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \ |
2245 |
+ -i src/include/pg_config_manual.h || die |
2246 |
+ |
2247 |
+ # Rely on $PATH being in the proper order so that the correct |
2248 |
+ # install program is used for modules utilizing PGXS in both |
2249 |
+ # hardened and non-hardened environments. (Bug #528786) |
2250 |
+ sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die |
2251 |
+ |
2252 |
+ use server || epatch "${FILESDIR}/${PN}-${SLOT}-no-server.patch" |
2253 |
+ |
2254 |
+ # Fix bug 486556 where the server would crash at start up because of |
2255 |
+ # an infinite loop caused by a self-referencing symlink. |
2256 |
+ epatch "${FILESDIR}/postgresql-9.2-9.4-tz-dir-overflow.patch" |
2257 |
+ |
2258 |
+ if use pam ; then |
2259 |
+ sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \ |
2260 |
+ -i src/backend/libpq/auth.c || \ |
2261 |
+ die 'PGSQL_PAM_SERVICE rename failed.' |
2262 |
+ fi |
2263 |
+ |
2264 |
+ epatch_user |
2265 |
+} |
2266 |
+ |
2267 |
+src_configure() { |
2268 |
+ case ${CHOST} in |
2269 |
+ *-darwin*|*-solaris*) |
2270 |
+ use nls && append-libs intl |
2271 |
+ ;; |
2272 |
+ esac |
2273 |
+ |
2274 |
+ export LDFLAGS_SL="${LDFLAGS}" |
2275 |
+ export LDFLAGS_EX="${LDFLAGS}" |
2276 |
+ |
2277 |
+ local PO="${EPREFIX%/}" |
2278 |
+ |
2279 |
+ local i uuid_config="" |
2280 |
+ if use uuid; then |
2281 |
+ for i in ${UTIL_LINUX_LIBC[@]}; do |
2282 |
+ use ${i} && uuid_config="--with-uuid=e2fs" |
2283 |
+ done |
2284 |
+ for i in ${BSD_LIBC[@]}; do |
2285 |
+ use ${i} && uuid_config="--with-uuid=bsd" |
2286 |
+ done |
2287 |
+ [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp" |
2288 |
+ fi |
2289 |
+ |
2290 |
+ econf \ |
2291 |
+ --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \ |
2292 |
+ --datadir="${PO}/usr/share/postgresql-${SLOT}" \ |
2293 |
+ --docdir="${PO}/usr/share/doc/${PF}" \ |
2294 |
+ --includedir="${PO}/usr/include/postgresql-${SLOT}" \ |
2295 |
+ --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \ |
2296 |
+ --sysconfdir="${PO}/etc/postgresql-${SLOT}" \ |
2297 |
+ --with-system-tzdata="${PO}/usr/share/zoneinfo" \ |
2298 |
+ $(use_enable !pg_legacytimestamp integer-datetimes) \ |
2299 |
+ $(use_enable threads thread-safety) \ |
2300 |
+ $(use_with kerberos gssapi) \ |
2301 |
+ $(use_with ldap) \ |
2302 |
+ $(use_with pam) \ |
2303 |
+ $(use_with perl) \ |
2304 |
+ $(use_with python) \ |
2305 |
+ $(use_with readline) \ |
2306 |
+ $(use_with ssl openssl) \ |
2307 |
+ $(use_with tcl) \ |
2308 |
+ ${uuid_config} \ |
2309 |
+ $(use_with xml libxml) \ |
2310 |
+ $(use_with xml libxslt) \ |
2311 |
+ $(use_with zlib) \ |
2312 |
+ "$(use_enable nls nls "$(wanted_languages)")" |
2313 |
+} |
2314 |
+ |
2315 |
+src_compile() { |
2316 |
+ emake |
2317 |
+ emake -C contrib |
2318 |
+} |
2319 |
+ |
2320 |
+src_install() { |
2321 |
+ emake DESTDIR="${D}" install |
2322 |
+ emake DESTDIR="${D}" install -C contrib |
2323 |
+ |
2324 |
+ dodoc README HISTORY doc/{TODO,bug.template} |
2325 |
+ |
2326 |
+ # man pages are already built, but if we have the target make them, |
2327 |
+ # they'll be generated from source before being installed so we |
2328 |
+ # manually install man pages. |
2329 |
+ # We use ${SLOT} instead of doman for postgresql.eselect |
2330 |
+ insinto /usr/share/postgresql-${SLOT}/man/ |
2331 |
+ doins -r doc/src/sgml/man{1,3,7} |
2332 |
+ if ! use server; then |
2333 |
+ # Remove man pages for non-existent binaries |
2334 |
+ for m in {initdb,pg_{controldata,ctl,resetxlog},post{gres,master}}; do |
2335 |
+ rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1" |
2336 |
+ done |
2337 |
+ fi |
2338 |
+ docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7} |
2339 |
+ |
2340 |
+ insinto /etc/postgresql-${SLOT} |
2341 |
+ newins src/bin/psql/psqlrc.sample psqlrc |
2342 |
+ |
2343 |
+ dodir /etc/eselect/postgresql/slots/${SLOT} |
2344 |
+ echo "postgres_ebuilds=\"\${postgres_ebuilds} ${PF}\"" > \ |
2345 |
+ "${ED}/etc/eselect/postgresql/slots/${SLOT}/base" |
2346 |
+ |
2347 |
+ use static-libs || find "${ED}" -name '*.a' -delete |
2348 |
+ |
2349 |
+ if use doc ; then |
2350 |
+ docinto html |
2351 |
+ dodoc doc/src/sgml/html/* |
2352 |
+ |
2353 |
+ docinto sgml |
2354 |
+ dodoc doc/src/sgml/*.{sgml,dsl} |
2355 |
+ fi |
2356 |
+ |
2357 |
+ if use server; then |
2358 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
2359 |
+ "${FILESDIR}/${PN}.confd" | newconfd - ${PN}-${SLOT} |
2360 |
+ |
2361 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
2362 |
+ "${FILESDIR}/${PN}.init-9.3" | newinitd - ${PN}-${SLOT} |
2363 |
+ |
2364 |
+ sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
2365 |
+ "${FILESDIR}/${PN}.service" | \ |
2366 |
+ systemd_newunit - ${PN}-${SLOT}.service |
2367 |
+ |
2368 |
+ newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir |
2369 |
+ |
2370 |
+ use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session |
2371 |
+ |
2372 |
+ if use prefix ; then |
2373 |
+ keepdir /run/postgresql |
2374 |
+ fperms 0775 /run/postgresql |
2375 |
+ fi |
2376 |
+ fi |
2377 |
+} |
2378 |
+ |
2379 |
+pkg_postinst() { |
2380 |
+ postgresql-config update |
2381 |
+ |
2382 |
+ elog "If you need a global psqlrc-file, you can place it in:" |
2383 |
+ elog " ${EROOT%/}/etc/postgresql-${SLOT}/" |
2384 |
+ |
2385 |
+ if [[ -z ${REPLACING_VERSIONS} ]] ; then |
2386 |
+ elog |
2387 |
+ elog "It looks like this is your first time installing PostgreSQL. Run the" |
2388 |
+ elog "following command in all active shells to pick up changes to the default" |
2389 |
+ elog "environment:" |
2390 |
+ elog " source /etc/profile" |
2391 |
+ fi |
2392 |
+ |
2393 |
+ if use server ; then |
2394 |
+ elog |
2395 |
+ elog "Gentoo specific documentation:" |
2396 |
+ elog "https://wiki.gentoo.org/wiki/PostgreSQL" |
2397 |
+ elog |
2398 |
+ elog "Official documentation:" |
2399 |
+ elog "http://www.postgresql.org/docs/${SLOT}/static/index.html" |
2400 |
+ elog |
2401 |
+ elog "The default location of the Unix-domain socket is:" |
2402 |
+ elog " ${EROOT%/}/run/postgresql/" |
2403 |
+ elog |
2404 |
+ elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" |
2405 |
+ elog "so that it contains your preferred locale in:" |
2406 |
+ elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
2407 |
+ elog |
2408 |
+ elog "Then, execute the following command to setup the initial database" |
2409 |
+ elog "environment:" |
2410 |
+ elog " emerge --config =${CATEGORY}/${PF}" |
2411 |
+ fi |
2412 |
+} |
2413 |
+ |
2414 |
+pkg_prerm() { |
2415 |
+ if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then |
2416 |
+ ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?" |
2417 |
+ ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL" |
2418 |
+ |
2419 |
+ ebegin "Resuming removal in 10 seconds (Control-C to cancel)" |
2420 |
+ sleep 10 |
2421 |
+ eend 0 |
2422 |
+ fi |
2423 |
+} |
2424 |
+ |
2425 |
+pkg_postrm() { |
2426 |
+ postgresql-config update |
2427 |
+} |
2428 |
+ |
2429 |
+pkg_config() { |
2430 |
+ use server || die "USE flag 'server' not enabled. Nothing to configure." |
2431 |
+ |
2432 |
+ [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \ |
2433 |
+ && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
2434 |
+ [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/" |
2435 |
+ [[ -z "${DATA_DIR}" ]] \ |
2436 |
+ && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data" |
2437 |
+ |
2438 |
+ # environment.bz2 may not contain the same locale as the current system |
2439 |
+ # locale. Unset and source from the current system locale. |
2440 |
+ if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then |
2441 |
+ unset LANG |
2442 |
+ unset LC_CTYPE |
2443 |
+ unset LC_NUMERIC |
2444 |
+ unset LC_TIME |
2445 |
+ unset LC_COLLATE |
2446 |
+ unset LC_MONETARY |
2447 |
+ unset LC_MESSAGES |
2448 |
+ unset LC_ALL |
2449 |
+ source "${EROOT%/}/etc/env.d/02locale" |
2450 |
+ [ -n "${LANG}" ] && export LANG |
2451 |
+ [ -n "${LC_CTYPE}" ] && export LC_CTYPE |
2452 |
+ [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC |
2453 |
+ [ -n "${LC_TIME}" ] && export LC_TIME |
2454 |
+ [ -n "${LC_COLLATE}" ] && export LC_COLLATE |
2455 |
+ [ -n "${LC_MONETARY}" ] && export LC_MONETARY |
2456 |
+ [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES |
2457 |
+ [ -n "${LC_ALL}" ] && export LC_ALL |
2458 |
+ fi |
2459 |
+ |
2460 |
+ einfo "You can modify the paths and options passed to initdb by editing:" |
2461 |
+ einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
2462 |
+ einfo |
2463 |
+ einfo "Information on options that can be passed to initdb are found at:" |
2464 |
+ einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html" |
2465 |
+ einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html" |
2466 |
+ einfo |
2467 |
+ einfo "PG_INITDB_OPTS is currently set to:" |
2468 |
+ if [[ -z "${PG_INITDB_OPTS}" ]] ; then |
2469 |
+ einfo " (none)" |
2470 |
+ else |
2471 |
+ einfo " ${PG_INITDB_OPTS}" |
2472 |
+ fi |
2473 |
+ einfo |
2474 |
+ einfo "Configuration files will be installed to:" |
2475 |
+ einfo " ${PGDATA}" |
2476 |
+ einfo |
2477 |
+ einfo "The database cluster will be created in:" |
2478 |
+ einfo " ${DATA_DIR}" |
2479 |
+ einfo |
2480 |
+ while [ "$correct" != "true" ] ; do |
2481 |
+ einfo "Are you ready to continue? (y/n)" |
2482 |
+ read answer |
2483 |
+ if [[ $answer =~ ^[Yy]([Ee][Ss])?$ ]] ; then |
2484 |
+ correct="true" |
2485 |
+ elif [[ $answer =~ ^[Nn]([Oo])?$ ]] ; then |
2486 |
+ die "Aborting initialization." |
2487 |
+ else |
2488 |
+ echo "Answer not recognized" |
2489 |
+ fi |
2490 |
+ done |
2491 |
+ |
2492 |
+ if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then |
2493 |
+ eerror "The given directory, '${DATA_DIR}', is not empty." |
2494 |
+ eerror "Modify DATA_DIR to point to an empty directory." |
2495 |
+ die "${DATA_DIR} is not empty." |
2496 |
+ fi |
2497 |
+ |
2498 |
+ einfo "Creating the data directory ..." |
2499 |
+ if [[ ${EUID} == 0 ]] ; then |
2500 |
+ mkdir -p "${DATA_DIR}" |
2501 |
+ chown -Rf postgres:postgres "${DATA_DIR}" |
2502 |
+ chmod 0700 "${DATA_DIR}" |
2503 |
+ fi |
2504 |
+ |
2505 |
+ einfo "Initializing the database ..." |
2506 |
+ |
2507 |
+ if [[ ${EUID} == 0 ]] ; then |
2508 |
+ su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}" |
2509 |
+ else |
2510 |
+ "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS} |
2511 |
+ fi |
2512 |
+ |
2513 |
+ if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then |
2514 |
+ mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}" |
2515 |
+ ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}" |
2516 |
+ fi |
2517 |
+ |
2518 |
+ cat <<- EOF >> "${PGDATA%/}"/postgresql.conf |
2519 |
+ # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522 |
2520 |
+ # On the off-chance that you might need to work with UTF-8 encoded |
2521 |
+ # characters in PL/Perl |
2522 |
+ plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";' |
2523 |
+ EOF |
2524 |
+ |
2525 |
+ einfo "The autovacuum function, which was in contrib, has been moved to the main" |
2526 |
+ einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled" |
2527 |
+ einfo "by default. You can disable it in the cluster's:" |
2528 |
+ einfo " ${PGDATA%/}/postgresql.conf" |
2529 |
+ einfo |
2530 |
+ einfo "The PostgreSQL server, by default, will log events to:" |
2531 |
+ einfo " ${DATA_DIR%/}/postmaster.log" |
2532 |
+ einfo |
2533 |
+ if use prefix ; then |
2534 |
+ einfo "The location of the configuration files have moved to:" |
2535 |
+ einfo " ${PGDATA}" |
2536 |
+ einfo "To start the server:" |
2537 |
+ einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'" |
2538 |
+ einfo "To stop:" |
2539 |
+ einfo " pg_ctl stop -D ${DATA_DIR}" |
2540 |
+ einfo |
2541 |
+ einfo "Or move the configuration files back:" |
2542 |
+ einfo "mv ${PGDATA}*.conf ${DATA_DIR}" |
2543 |
+ else |
2544 |
+ einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL" |
2545 |
+ einfo "instead of 'pg_ctl'." |
2546 |
+ fi |
2547 |
+} |
2548 |
+ |
2549 |
+src_test() { |
2550 |
+ if use server && [[ ${UID} -ne 0 ]] ; then |
2551 |
+ emake check |
2552 |
+ |
2553 |
+ einfo "If you think other tests besides the regression tests are necessary, please" |
2554 |
+ einfo "submit a bug including a patch for this ebuild to enable them." |
2555 |
+ else |
2556 |
+ use server || \ |
2557 |
+ ewarn 'Tests cannot be run without the "server" use flag enabled.' |
2558 |
+ [[ ${UID} -eq 0 ]] || \ |
2559 |
+ ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.' |
2560 |
+ |
2561 |
+ ewarn 'Skipping.' |
2562 |
+ fi |
2563 |
+} |