1 |
commit: 4fa4501da1e923eaac0bb9af33e5ea979f539263 |
2 |
Author: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Jul 29 10:31:28 2019 +0000 |
4 |
Commit: Aaron W. Swenson <titanofold <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Jul 29 10:31:45 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4fa4501d |
7 |
|
8 |
dev-db/postgresql: Cleanup insecure |
9 |
|
10 |
Bug: https://bugs.gentoo.org/688420 |
11 |
Package-Manager: Portage-2.3.66, Repoman-2.3.11 |
12 |
Signed-off-by: Aaron W. Swenson <titanofold <AT> gentoo.org> |
13 |
|
14 |
dev-db/postgresql/Manifest | 2 - |
15 |
dev-db/postgresql/postgresql-10.8-r1.ebuild | 466 --------------------------- |
16 |
dev-db/postgresql/postgresql-10.8.ebuild | 460 --------------------------- |
17 |
dev-db/postgresql/postgresql-11.3-r1.ebuild | 468 ---------------------------- |
18 |
dev-db/postgresql/postgresql-11.3.ebuild | 460 --------------------------- |
19 |
5 files changed, 1856 deletions(-) |
20 |
|
21 |
diff --git a/dev-db/postgresql/Manifest b/dev-db/postgresql/Manifest |
22 |
index 64e71ab19b5..64ef37a7451 100644 |
23 |
--- a/dev-db/postgresql/Manifest |
24 |
+++ b/dev-db/postgresql/Manifest |
25 |
@@ -1,6 +1,4 @@ |
26 |
-DIST postgresql-10.8.tar.bz2 18958913 BLAKE2B d2e1664a53c5b2f24b412f497769ffd33e2f48977fa0f4503cb588497b61955a97497c87950ae60d498d75c7385fc63dd832b518174614f695d8882628a4ebb8 SHA512 c9cd0298f553e13e32d4315e17e9e61c1fd011391c5203282d9040f26fd08c85f749e6f2cea3bcc42d1ca153a1272bcd773196ef3bf2bdfb74cd12c5f523b7ca |
27 |
DIST postgresql-10.9.tar.bz2 18981395 BLAKE2B ef2ac003b393ea7cbf24c45fac6b3dc69df2a8694a9e891d5a68f7310d63fb816649d16a7351d03b63a4eb2256703efcab616a0146324478335267c39f3b9829 SHA512 4e2f30a0fd262f2e3ce5fc836425be635326600cd6cd4e117c57f59ea7ab2e9ea463a8d357fe7adb8c0dd0094e43d08efc2a137f8f9975715a5908e35920f98e |
28 |
-DIST postgresql-11.3.tar.bz2 19718775 BLAKE2B f56686bff4e70c2b6333554a620a5c2d5c226654a1d61de43b4493c44a14e2bcd9c102dba420994878d328af52d933885e4948cd002f14b693aef1416697a0ea SHA512 03269bb88f44f3a81d5e3a8ca2fe59f63f784436840f08870b2e539755629cbde8ac288e0bb4472ee93294a88b37b814ddff48444254c1a3f7a10b4bb64f7133 |
29 |
DIST postgresql-11.4.tar.bz2 19759635 BLAKE2B a3f35df40d31dce52073eeacf4e16bc7ccb487dc0a6e15b84d087f04fd130b66b1168ece3edc63927c377ca1044b54ccb3db5fb9b4a5c86a5b0e179a6678c73c SHA512 159fb84134e05ddc58e40a879ca52ed4d58ced7bcd1e7310d59bda84f9055339a31a92cfaab2c063a88685f7417b9a828534394bf9a2477fc33d1fb6cd26186b |
30 |
DIST postgresql-12beta2.tar.bz2 20605047 BLAKE2B 133c453b180c800bf7e8dc15d26453db6e2b86011a1dd175157d46e5dec26199e42ac37f494b9a154352d144c93c4e8dc8410469d52ca31c1bdfef69a25190e2 SHA512 64b3ffd7e61ece5572ca72b3168618150214f89d21b113c6f630687372f6f7212bdfa086fa5b22e466a529a0e929c76d34e5b3ed5c04c94299589822fbff4935 |
31 |
DIST postgresql-9.4.22.tar.bz2 16848787 BLAKE2B 5c2aaef13ef0cf33c421e6839877a8e4e1fc5dbe41d9cabefddd369925869f92f6c6b8a124b5778f9b25359103f0a7ada1eddcaf4bac498709f563928f25e7e3 SHA512 f11623a89b2320616fd53eda52da544bdfcb63bff08cb78fccde134ef628eee7ee90b3de6952f4e08c10297d356624faabf0e5b181b0105f51797796cd04efef |
32 |
|
33 |
diff --git a/dev-db/postgresql/postgresql-10.8-r1.ebuild b/dev-db/postgresql/postgresql-10.8-r1.ebuild |
34 |
deleted file mode 100644 |
35 |
index 88115ec2c2a..00000000000 |
36 |
--- a/dev-db/postgresql/postgresql-10.8-r1.ebuild |
37 |
+++ /dev/null |
38 |
@@ -1,466 +0,0 @@ |
39 |
-# Copyright 1999-2019 Gentoo Authors |
40 |
-# Distributed under the terms of the GNU General Public License v2 |
41 |
- |
42 |
-EAPI=7 |
43 |
- |
44 |
-PYTHON_COMPAT=( python2_7 python3_{5,6,7} ) |
45 |
- |
46 |
-PLOCALES="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr zh_CN |
47 |
- zh_TW" |
48 |
- |
49 |
-inherit flag-o-matic l10n linux-info multilib pam prefix python-single-r1 \ |
50 |
- systemd user |
51 |
- |
52 |
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris" |
53 |
- |
54 |
-SLOT=$(ver_cut 1) |
55 |
- |
56 |
-MY_PV=${PV/_/} |
57 |
-S="${WORKDIR}/${PN}-${MY_PV}" |
58 |
- |
59 |
-SRC_URI="mirror://postgresql/source/v${MY_PV}/postgresql-${MY_PV}.tar.bz2" |
60 |
- |
61 |
-LICENSE="POSTGRESQL GPL-2" |
62 |
-DESCRIPTION="PostgreSQL RDBMS" |
63 |
-HOMEPAGE="https://www.postgresql.org/" |
64 |
- |
65 |
-IUSE="debug doc icu kerberos kernel_linux ldap libressl nls pam perl |
66 |
- python +readline selinux +server systemd ssl static-libs tcl |
67 |
- threads uuid xml zlib" |
68 |
- |
69 |
-REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" |
70 |
- |
71 |
-CDEPEND=" |
72 |
->=app-eselect/eselect-postgresql-2.0 |
73 |
-sys-apps/less |
74 |
-virtual/libintl |
75 |
-icu? ( dev-libs/icu:= ) |
76 |
-kerberos? ( virtual/krb5 ) |
77 |
-ldap? ( net-nds/openldap ) |
78 |
-pam? ( virtual/pam ) |
79 |
-perl? ( >=dev-lang/perl-5.8:= ) |
80 |
-python? ( ${PYTHON_DEPS} ) |
81 |
-readline? ( sys-libs/readline:0= ) |
82 |
-server? ( systemd? ( sys-apps/systemd ) ) |
83 |
-ssl? ( |
84 |
- !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= ) |
85 |
- libressl? ( dev-libs/libressl:= ) |
86 |
-) |
87 |
-tcl? ( >=dev-lang/tcl-8:0= ) |
88 |
-xml? ( dev-libs/libxml2 dev-libs/libxslt ) |
89 |
-zlib? ( sys-libs/zlib ) |
90 |
-" |
91 |
- |
92 |
-# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no |
93 |
-# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems, |
94 |
-# the libc includes UUID functions. |
95 |
-UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} ) |
96 |
-BSD_LIBC=( elibc_{Free,Net,Open}BSD ) |
97 |
- |
98 |
-nest_usedep() { |
99 |
- local front back |
100 |
- while [[ ${#} -gt 1 ]]; do |
101 |
- front+="${1}? ( " |
102 |
- back+=" )" |
103 |
- shift |
104 |
- done |
105 |
- echo "${front}${1}${back}" |
106 |
-} |
107 |
- |
108 |
-IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}" |
109 |
-CDEPEND+=" |
110 |
-uuid? ( |
111 |
- ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )} |
112 |
- $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid) |
113 |
-)" |
114 |
- |
115 |
-DEPEND="${CDEPEND} |
116 |
-!!<sys-apps/sandbox-2.0 |
117 |
-sys-devel/bison |
118 |
-sys-devel/flex |
119 |
-nls? ( sys-devel/gettext ) |
120 |
-xml? ( virtual/pkgconfig ) |
121 |
-" |
122 |
- |
123 |
-RDEPEND="${CDEPEND} |
124 |
-!dev-db/postgresql-docs:${SLOT} |
125 |
-!dev-db/postgresql-base:${SLOT} |
126 |
-!dev-db/postgresql-server:${SLOT} |
127 |
-selinux? ( sec-policy/selinux-postgresql ) |
128 |
-" |
129 |
- |
130 |
-pkg_setup() { |
131 |
- use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup |
132 |
- |
133 |
- enewgroup postgres 70 |
134 |
- enewuser postgres 70 /bin/sh /var/lib/postgresql postgres |
135 |
- |
136 |
- use python && python-single-r1_pkg_setup |
137 |
-} |
138 |
- |
139 |
-src_prepare() { |
140 |
- # Work around PPC{,64} compilation bug where bool is already defined |
141 |
- sed '/#ifndef __cplusplus/a #undef bool' -i src/include/c.h || die |
142 |
- |
143 |
- # Set proper run directory |
144 |
- sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \ |
145 |
- -i src/include/pg_config_manual.h || die |
146 |
- |
147 |
- # Rely on $PATH being in the proper order so that the correct |
148 |
- # install program is used for modules utilizing PGXS in both |
149 |
- # hardened and non-hardened environments. (Bug #528786) |
150 |
- sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die |
151 |
- |
152 |
- use server || eapply "${FILESDIR}/${PN}-10.2-no-server.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 |
- eapply_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 |
- local i uuid_config="" |
176 |
- if use uuid; then |
177 |
- for i in ${UTIL_LINUX_LIBC[@]}; do |
178 |
- use ${i} && uuid_config="--with-uuid=e2fs" |
179 |
- done |
180 |
- for i in ${BSD_LIBC[@]}; do |
181 |
- use ${i} && uuid_config="--with-uuid=bsd" |
182 |
- done |
183 |
- [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp" |
184 |
- fi |
185 |
- |
186 |
- econf \ |
187 |
- --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \ |
188 |
- --datadir="${PO}/usr/share/postgresql-${SLOT}" \ |
189 |
- --docdir="${PO}/usr/share/doc/${PF}" \ |
190 |
- --includedir="${PO}/usr/include/postgresql-${SLOT}" \ |
191 |
- --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \ |
192 |
- --sysconfdir="${PO}/etc/postgresql-${SLOT}" \ |
193 |
- --with-system-tzdata="${PO}/usr/share/zoneinfo" \ |
194 |
- $(use_enable !alpha spinlocks) \ |
195 |
- $(use_enable debug) \ |
196 |
- $(use_enable threads thread-safety) \ |
197 |
- $(use_with icu) \ |
198 |
- $(use_with kerberos gssapi) \ |
199 |
- $(use_with ldap) \ |
200 |
- $(use_with pam) \ |
201 |
- $(use_with perl) \ |
202 |
- $(use_with python) \ |
203 |
- $(use_with readline) \ |
204 |
- $(use_with ssl openssl) \ |
205 |
- $(usex server "$(use_with systemd)" '--without-systemd') \ |
206 |
- $(use_with tcl) \ |
207 |
- ${uuid_config} \ |
208 |
- $(use_with xml libxml) \ |
209 |
- $(use_with xml libxslt) \ |
210 |
- $(use_with zlib) \ |
211 |
- $(use_enable nls nls "'$(l10n_get_locales)'") |
212 |
-} |
213 |
- |
214 |
-src_compile() { |
215 |
- emake |
216 |
- emake -C contrib |
217 |
-} |
218 |
- |
219 |
-src_install() { |
220 |
- emake DESTDIR="${D}" install |
221 |
- emake DESTDIR="${D}" install -C contrib |
222 |
- |
223 |
- dodoc README HISTORY doc/{TODO,bug.template} |
224 |
- |
225 |
- # man pages are already built, but if we have the target make them, |
226 |
- # they'll be generated from source before being installed so we |
227 |
- # manually install man pages. |
228 |
- # We use ${SLOT} instead of doman for postgresql.eselect |
229 |
- insinto /usr/share/postgresql-${SLOT}/man/ |
230 |
- doins -r doc/src/sgml/man{1,3,7} |
231 |
- if ! use server; then |
232 |
- # Remove man pages for non-existent binaries |
233 |
- serverman=( |
234 |
- initdb |
235 |
- pg_{archivecleanup,controldata,ctl,resetwal,rewind,standby} |
236 |
- pg_{test_{fsync,timing},upgrade,waldump} |
237 |
- post{gres,master} |
238 |
- ) |
239 |
- for m in ${serverman[@]} ; do |
240 |
- rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1" |
241 |
- done |
242 |
- fi |
243 |
- docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7} |
244 |
- |
245 |
- # Create slot specific man pages |
246 |
- local bn f mansec slotted_name |
247 |
- for mansec in 1 3 7 ; do |
248 |
- local rel_manpath="../../postgresql-${SLOT}/man/man${mansec}" |
249 |
- |
250 |
- mkdir -p "${ED}"/usr/share/man/man${mansec} || die "making man dir" |
251 |
- pushd "${ED}"/usr/share/man/man${mansec} > /dev/null || die "pushd failed" |
252 |
- |
253 |
- for f in "${ED}/usr/share/postgresql-${SLOT}/man/man${mansec}"/* ; do |
254 |
- bn=$(basename "${f}") |
255 |
- slotted_name=${bn%.${mansec}}${SLOT}.${mansec} |
256 |
- case ${bn} in |
257 |
- TABLE.7|WITH.7) |
258 |
- echo ".so ${rel_manpath}/SELECT.7" > ${slotted_name} |
259 |
- ;; |
260 |
- *) |
261 |
- echo ".so ${rel_manpath}/${bn}" > ${slotted_name} |
262 |
- ;; |
263 |
- esac |
264 |
- done |
265 |
- |
266 |
- popd > /dev/null |
267 |
- done |
268 |
- |
269 |
- insinto /etc/postgresql-${SLOT} |
270 |
- newins src/bin/psql/psqlrc.sample psqlrc |
271 |
- |
272 |
- # Don't delete libpg{port,common}.a (Bug #571046). They're always |
273 |
- # needed by extensions utilizing PGXS. |
274 |
- use static-libs || \ |
275 |
- find "${ED}" -name '*.a' ! -name libpgport.a ! -name libpgcommon.a \ |
276 |
- -delete |
277 |
- |
278 |
- # Make slot specific links to programs |
279 |
- local f bn |
280 |
- for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \ |
281 |
- -mindepth 1 -maxdepth 1) |
282 |
- do |
283 |
- bn=$(basename "${f}") |
284 |
- dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \ |
285 |
- "/usr/bin/${bn}${SLOT/.}" |
286 |
- done |
287 |
- |
288 |
- if use doc ; then |
289 |
- docinto html |
290 |
- dodoc doc/src/sgml/html/* |
291 |
- fi |
292 |
- |
293 |
- if use server; then |
294 |
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
295 |
- "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT} |
296 |
- |
297 |
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
298 |
- "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT} |
299 |
- |
300 |
- if use systemd; then |
301 |
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
302 |
- "${FILESDIR}/${PN}.service-9.6-r1" | \ |
303 |
- systemd_newunit - ${PN}-${SLOT}.service |
304 |
- newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir |
305 |
- systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf |
306 |
- fi |
307 |
- |
308 |
- use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session |
309 |
- |
310 |
- if use prefix ; then |
311 |
- keepdir /run/postgresql |
312 |
- fperms 1775 /run/postgresql |
313 |
- fi |
314 |
- fi |
315 |
-} |
316 |
- |
317 |
-pkg_postinst() { |
318 |
- use server && use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf |
319 |
- postgresql-config update |
320 |
- |
321 |
- elog "If you need a global psqlrc-file, you can place it in:" |
322 |
- elog " ${EROOT%/}/etc/postgresql-${SLOT}/" |
323 |
- |
324 |
- if use server ; then |
325 |
- elog |
326 |
- elog "Gentoo specific documentation:" |
327 |
- elog "https://wiki.gentoo.org/wiki/PostgreSQL" |
328 |
- elog |
329 |
- elog "Official documentation:" |
330 |
- elog "https://www.postgresql.org/docs/${SLOT}/static/index.html" |
331 |
- elog |
332 |
- elog "The default location of the Unix-domain socket is:" |
333 |
- elog " ${EROOT%/}/run/postgresql/" |
334 |
- elog |
335 |
- elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" |
336 |
- elog "so that it contains your preferred locale in:" |
337 |
- elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
338 |
- elog |
339 |
- elog "Then, execute the following command to setup the initial database" |
340 |
- elog "environment:" |
341 |
- elog " emerge --config =${CATEGORY}/${PF}" |
342 |
- |
343 |
- if [[ -n ${REPLACING_VERSIONS} ]] ; then |
344 |
- ewarn "If your system is using 'pg_stat_statements' and you are running a" |
345 |
- ewarn "version of PostgreSQL ${SLOT}, we advise that you execute" |
346 |
- ewarn "the following command after upgrading:" |
347 |
- ewarn |
348 |
- ewarn "ALTER EXTENSION pg_stat_statements UPDATE;" |
349 |
- fi |
350 |
- fi |
351 |
-} |
352 |
- |
353 |
-pkg_prerm() { |
354 |
- if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then |
355 |
- ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?" |
356 |
- ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL" |
357 |
- |
358 |
- ebegin "Resuming removal in 10 seconds (Control-C to cancel)" |
359 |
- sleep 10 |
360 |
- eend 0 |
361 |
- fi |
362 |
-} |
363 |
- |
364 |
-pkg_postrm() { |
365 |
- postgresql-config update |
366 |
-} |
367 |
- |
368 |
-pkg_config() { |
369 |
- use server || die "USE flag 'server' not enabled. Nothing to configure." |
370 |
- |
371 |
- [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \ |
372 |
- && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
373 |
- [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/" |
374 |
- [[ -z "${DATA_DIR}" ]] \ |
375 |
- && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data" |
376 |
- |
377 |
- # environment.bz2 may not contain the same locale as the current system |
378 |
- # locale. Unset and source from the current system locale. |
379 |
- if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then |
380 |
- unset LANG |
381 |
- unset LC_CTYPE |
382 |
- unset LC_NUMERIC |
383 |
- unset LC_TIME |
384 |
- unset LC_COLLATE |
385 |
- unset LC_MONETARY |
386 |
- unset LC_MESSAGES |
387 |
- unset LC_ALL |
388 |
- source "${EROOT%/}/etc/env.d/02locale" |
389 |
- [ -n "${LANG}" ] && export LANG |
390 |
- [ -n "${LC_CTYPE}" ] && export LC_CTYPE |
391 |
- [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC |
392 |
- [ -n "${LC_TIME}" ] && export LC_TIME |
393 |
- [ -n "${LC_COLLATE}" ] && export LC_COLLATE |
394 |
- [ -n "${LC_MONETARY}" ] && export LC_MONETARY |
395 |
- [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES |
396 |
- [ -n "${LC_ALL}" ] && export LC_ALL |
397 |
- fi |
398 |
- |
399 |
- einfo "You can modify the paths and options passed to initdb by editing:" |
400 |
- einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
401 |
- einfo |
402 |
- einfo "Information on options that can be passed to initdb are found at:" |
403 |
- einfo " https://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html" |
404 |
- einfo " https://www.postgresql.org/docs/${SLOT}/static/app-initdb.html" |
405 |
- einfo |
406 |
- einfo "PG_INITDB_OPTS is currently set to:" |
407 |
- if [[ -z "${PG_INITDB_OPTS}" ]] ; then |
408 |
- einfo " (none)" |
409 |
- else |
410 |
- einfo " ${PG_INITDB_OPTS}" |
411 |
- fi |
412 |
- einfo |
413 |
- einfo "Configuration files will be installed to:" |
414 |
- einfo " ${PGDATA}" |
415 |
- einfo |
416 |
- einfo "The database cluster will be created in:" |
417 |
- einfo " ${DATA_DIR}" |
418 |
- einfo |
419 |
- |
420 |
- ebegin "Continuing initialization in 5 seconds (Control-C to cancel)" |
421 |
- sleep 5 |
422 |
- eend 0 |
423 |
- |
424 |
- if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then |
425 |
- eerror "The given directory, '${DATA_DIR}', is not empty." |
426 |
- eerror "Modify DATA_DIR to point to an empty directory." |
427 |
- die "${DATA_DIR} is not empty." |
428 |
- fi |
429 |
- |
430 |
- einfo "Creating the data directory ..." |
431 |
- if [[ ${EUID} == 0 ]] ; then |
432 |
- mkdir -p "${DATA_DIR}" |
433 |
- chown -Rf postgres:postgres "${DATA_DIR}" |
434 |
- chmod 0700 "${DATA_DIR}" |
435 |
- fi |
436 |
- |
437 |
- einfo "Initializing the database ..." |
438 |
- |
439 |
- if [[ ${EUID} == 0 ]] ; then |
440 |
- su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}" |
441 |
- else |
442 |
- "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS} |
443 |
- fi |
444 |
- |
445 |
- if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then |
446 |
- mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}" |
447 |
- ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}" |
448 |
- fi |
449 |
- |
450 |
- # unix_socket_directory has no effect in postgresql.conf as it's |
451 |
- # overridden in the initscript |
452 |
- sed '/^#unix_socket_directories/,+1d' -i "${PGDATA%/}"/postgresql.conf |
453 |
- |
454 |
- cat <<- EOF >> "${PGDATA%/}"/postgresql.conf |
455 |
- # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522 |
456 |
- # On the off-chance that you might need to work with UTF-8 encoded |
457 |
- # characters in PL/Perl |
458 |
- plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";' |
459 |
- EOF |
460 |
- |
461 |
- einfo "The autovacuum function, which was in contrib, has been moved to the main" |
462 |
- einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled" |
463 |
- einfo "by default. You can disable it in the cluster's:" |
464 |
- einfo " ${PGDATA%/}/postgresql.conf" |
465 |
- einfo |
466 |
- if ! use systemd; then |
467 |
- einfo "The PostgreSQL server, by default, will log events to:" |
468 |
- einfo " ${DATA_DIR%/}/postmaster.log" |
469 |
- einfo |
470 |
- fi |
471 |
- if use prefix ; then |
472 |
- einfo "The location of the configuration files have moved to:" |
473 |
- einfo " ${PGDATA}" |
474 |
- einfo "To start the server:" |
475 |
- einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'" |
476 |
- einfo "To stop:" |
477 |
- einfo " pg_ctl stop -D ${DATA_DIR}" |
478 |
- einfo |
479 |
- einfo "Or move the configuration files back:" |
480 |
- einfo "mv ${PGDATA}*.conf ${DATA_DIR}" |
481 |
- elif use systemd; then |
482 |
- einfo "You should use the 'postgresql-${SLOT}.service' unit to run PostgreSQL" |
483 |
- einfo "instead of 'pg_ctl'." |
484 |
- else |
485 |
- einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL" |
486 |
- einfo "instead of 'pg_ctl'." |
487 |
- fi |
488 |
-} |
489 |
- |
490 |
-src_test() { |
491 |
- if use server && [[ ${UID} -ne 0 ]] ; then |
492 |
- emake check |
493 |
- |
494 |
- einfo "If you think other tests besides the regression tests are necessary, please" |
495 |
- einfo "submit a bug including a patch for this ebuild to enable them." |
496 |
- else |
497 |
- use server || \ |
498 |
- ewarn 'Tests cannot be run without the "server" use flag enabled.' |
499 |
- [[ ${UID} -eq 0 ]] || \ |
500 |
- ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.' |
501 |
- |
502 |
- ewarn 'Skipping.' |
503 |
- fi |
504 |
-} |
505 |
|
506 |
diff --git a/dev-db/postgresql/postgresql-10.8.ebuild b/dev-db/postgresql/postgresql-10.8.ebuild |
507 |
deleted file mode 100644 |
508 |
index 339ca64ec76..00000000000 |
509 |
--- a/dev-db/postgresql/postgresql-10.8.ebuild |
510 |
+++ /dev/null |
511 |
@@ -1,460 +0,0 @@ |
512 |
-# Copyright 1999-2019 Gentoo Authors |
513 |
-# Distributed under the terms of the GNU General Public License v2 |
514 |
- |
515 |
-EAPI="6" |
516 |
- |
517 |
-PYTHON_COMPAT=( python2_7 python3_{5,6} ) |
518 |
- |
519 |
-PLOCALES="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr zh_CN |
520 |
- zh_TW" |
521 |
- |
522 |
-inherit flag-o-matic l10n linux-info multilib pam prefix python-single-r1 \ |
523 |
- systemd user versionator |
524 |
- |
525 |
-KEYWORDS="alpha amd64 arm ~arm64 hppa ia64 ~mips ppc ppc64 ~s390 ~sh sparc x86 ~amd64-fbsd ~x86-fbsd ~ppc-macos ~x86-solaris" |
526 |
- |
527 |
-SLOT=$(get_major_version) |
528 |
- |
529 |
-MY_PV=${PV/_/} |
530 |
-S="${WORKDIR}/${PN}-${MY_PV}" |
531 |
- |
532 |
-SRC_URI="mirror://postgresql/source/v${MY_PV}/postgresql-${MY_PV}.tar.bz2" |
533 |
- |
534 |
-LICENSE="POSTGRESQL GPL-2" |
535 |
-DESCRIPTION="PostgreSQL RDBMS" |
536 |
-HOMEPAGE="https://www.postgresql.org/" |
537 |
- |
538 |
-IUSE="doc kerberos kernel_linux ldap libressl nls pam perl python +readline |
539 |
- selinux +server systemd ssl static-libs tcl threads uuid xml zlib" |
540 |
- |
541 |
-REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" |
542 |
- |
543 |
-CDEPEND=" |
544 |
->=app-eselect/eselect-postgresql-2.0 |
545 |
-sys-apps/less |
546 |
-virtual/libintl |
547 |
-kerberos? ( virtual/krb5 ) |
548 |
-ldap? ( net-nds/openldap ) |
549 |
-pam? ( virtual/pam ) |
550 |
-perl? ( >=dev-lang/perl-5.8:= ) |
551 |
-python? ( ${PYTHON_DEPS} ) |
552 |
-readline? ( sys-libs/readline:0= ) |
553 |
-server? ( systemd? ( sys-apps/systemd ) ) |
554 |
-ssl? ( |
555 |
- !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= ) |
556 |
- libressl? ( dev-libs/libressl:= ) |
557 |
-) |
558 |
-tcl? ( >=dev-lang/tcl-8:0= ) |
559 |
-xml? ( dev-libs/libxml2 dev-libs/libxslt ) |
560 |
-zlib? ( sys-libs/zlib ) |
561 |
-" |
562 |
- |
563 |
-# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no |
564 |
-# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems, |
565 |
-# the libc includes UUID functions. |
566 |
-UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} ) |
567 |
-BSD_LIBC=( elibc_{Free,Net,Open}BSD ) |
568 |
- |
569 |
-nest_usedep() { |
570 |
- local front back |
571 |
- while [[ ${#} -gt 1 ]]; do |
572 |
- front+="${1}? ( " |
573 |
- back+=" )" |
574 |
- shift |
575 |
- done |
576 |
- echo "${front}${1}${back}" |
577 |
-} |
578 |
- |
579 |
-IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}" |
580 |
-CDEPEND+=" |
581 |
-uuid? ( |
582 |
- ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )} |
583 |
- $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid) |
584 |
-)" |
585 |
- |
586 |
-DEPEND="${CDEPEND} |
587 |
-!!<sys-apps/sandbox-2.0 |
588 |
-sys-devel/bison |
589 |
-sys-devel/flex |
590 |
-nls? ( sys-devel/gettext ) |
591 |
-xml? ( virtual/pkgconfig ) |
592 |
-" |
593 |
- |
594 |
-RDEPEND="${CDEPEND} |
595 |
-!dev-db/postgresql-docs:${SLOT} |
596 |
-!dev-db/postgresql-base:${SLOT} |
597 |
-!dev-db/postgresql-server:${SLOT} |
598 |
-selinux? ( sec-policy/selinux-postgresql ) |
599 |
-" |
600 |
- |
601 |
-pkg_setup() { |
602 |
- use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup |
603 |
- |
604 |
- enewgroup postgres 70 |
605 |
- enewuser postgres 70 /bin/sh /var/lib/postgresql postgres |
606 |
- |
607 |
- use python && python-single-r1_pkg_setup |
608 |
-} |
609 |
- |
610 |
-src_prepare() { |
611 |
- # Work around PPC{,64} compilation bug where bool is already defined |
612 |
- sed '/#ifndef __cplusplus/a #undef bool' -i src/include/c.h || die |
613 |
- |
614 |
- # Set proper run directory |
615 |
- sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \ |
616 |
- -i src/include/pg_config_manual.h || die |
617 |
- |
618 |
- # Rely on $PATH being in the proper order so that the correct |
619 |
- # install program is used for modules utilizing PGXS in both |
620 |
- # hardened and non-hardened environments. (Bug #528786) |
621 |
- sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die |
622 |
- |
623 |
- use server || eapply "${FILESDIR}/${PN}-10.2-no-server.patch" |
624 |
- |
625 |
- if use pam ; then |
626 |
- sed -e "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \ |
627 |
- -i src/backend/libpq/auth.c || \ |
628 |
- die 'PGSQL_PAM_SERVICE rename failed.' |
629 |
- fi |
630 |
- |
631 |
- eapply_user |
632 |
-} |
633 |
- |
634 |
-src_configure() { |
635 |
- case ${CHOST} in |
636 |
- *-darwin*|*-solaris*) |
637 |
- use nls && append-libs intl |
638 |
- ;; |
639 |
- esac |
640 |
- |
641 |
- export LDFLAGS_SL="${LDFLAGS}" |
642 |
- export LDFLAGS_EX="${LDFLAGS}" |
643 |
- |
644 |
- local PO="${EPREFIX%/}" |
645 |
- |
646 |
- local i uuid_config="" |
647 |
- if use uuid; then |
648 |
- for i in ${UTIL_LINUX_LIBC[@]}; do |
649 |
- use ${i} && uuid_config="--with-uuid=e2fs" |
650 |
- done |
651 |
- for i in ${BSD_LIBC[@]}; do |
652 |
- use ${i} && uuid_config="--with-uuid=bsd" |
653 |
- done |
654 |
- [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp" |
655 |
- fi |
656 |
- |
657 |
- econf \ |
658 |
- --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \ |
659 |
- --datadir="${PO}/usr/share/postgresql-${SLOT}" \ |
660 |
- --docdir="${PO}/usr/share/doc/${PF}" \ |
661 |
- --includedir="${PO}/usr/include/postgresql-${SLOT}" \ |
662 |
- --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \ |
663 |
- --sysconfdir="${PO}/etc/postgresql-${SLOT}" \ |
664 |
- --with-system-tzdata="${PO}/usr/share/zoneinfo" \ |
665 |
- $(use_enable !alpha spinlocks) \ |
666 |
- $(use_enable threads thread-safety) \ |
667 |
- $(use_with kerberos gssapi) \ |
668 |
- $(use_with ldap) \ |
669 |
- $(use_with pam) \ |
670 |
- $(use_with perl) \ |
671 |
- $(use_with python) \ |
672 |
- $(use_with readline) \ |
673 |
- $(use_with ssl openssl) \ |
674 |
- $(usex server "$(use_with systemd)" '--without-systemd') \ |
675 |
- $(use_with tcl) \ |
676 |
- ${uuid_config} \ |
677 |
- $(use_with xml libxml) \ |
678 |
- $(use_with xml libxslt) \ |
679 |
- $(use_with zlib) \ |
680 |
- $(use_enable nls nls "'$(l10n_get_locales)'") |
681 |
-} |
682 |
- |
683 |
-src_compile() { |
684 |
- emake |
685 |
- emake -C contrib |
686 |
-} |
687 |
- |
688 |
-src_install() { |
689 |
- emake DESTDIR="${D}" install |
690 |
- emake DESTDIR="${D}" install -C contrib |
691 |
- |
692 |
- dodoc README HISTORY doc/{TODO,bug.template} |
693 |
- |
694 |
- # man pages are already built, but if we have the target make them, |
695 |
- # they'll be generated from source before being installed so we |
696 |
- # manually install man pages. |
697 |
- # We use ${SLOT} instead of doman for postgresql.eselect |
698 |
- insinto /usr/share/postgresql-${SLOT}/man/ |
699 |
- doins -r doc/src/sgml/man{1,3,7} |
700 |
- if ! use server; then |
701 |
- # Remove man pages for non-existent binaries |
702 |
- serverman=( |
703 |
- initdb |
704 |
- pg_{archivecleanup,controldata,ctl,resetwal,rewind,standby} |
705 |
- pg_{test_{fsync,timing},upgrade,waldump} |
706 |
- post{gres,master} |
707 |
- ) |
708 |
- for m in ${serverman[@]} ; do |
709 |
- rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1" |
710 |
- done |
711 |
- fi |
712 |
- docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7} |
713 |
- |
714 |
- # Create slot specific man pages |
715 |
- local bn f mansec slotted_name |
716 |
- for mansec in 1 3 7 ; do |
717 |
- local rel_manpath="../../postgresql-${SLOT}/man/man${mansec}" |
718 |
- |
719 |
- mkdir -p "${ED}"/usr/share/man/man${mansec} || die "making man dir" |
720 |
- pushd "${ED}"/usr/share/man/man${mansec} > /dev/null || die "pushd failed" |
721 |
- |
722 |
- for f in "${ED}/usr/share/postgresql-${SLOT}/man/man${mansec}"/* ; do |
723 |
- bn=$(basename "${f}") |
724 |
- slotted_name=${bn%.${mansec}}${SLOT}.${mansec} |
725 |
- case ${bn} in |
726 |
- TABLE.7|WITH.7) |
727 |
- echo ".so ${rel_manpath}/SELECT.7" > ${slotted_name} |
728 |
- ;; |
729 |
- *) |
730 |
- echo ".so ${rel_manpath}/${bn}" > ${slotted_name} |
731 |
- ;; |
732 |
- esac |
733 |
- done |
734 |
- |
735 |
- popd > /dev/null |
736 |
- done |
737 |
- |
738 |
- insinto /etc/postgresql-${SLOT} |
739 |
- newins src/bin/psql/psqlrc.sample psqlrc |
740 |
- |
741 |
- use static-libs || find "${ED}" -name '*.a' -delete |
742 |
- |
743 |
- local f bn |
744 |
- for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \ |
745 |
- -mindepth 1 -maxdepth 1) |
746 |
- do |
747 |
- bn=$(basename "${f}") |
748 |
- # Temporarily tack on tmp to workaround a file collision |
749 |
- # issue. This is only necessary for 9.7 and earlier. 10 never |
750 |
- # had this issue. |
751 |
- dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \ |
752 |
- "/usr/bin/${bn}${SLOT/.}" |
753 |
- done |
754 |
- |
755 |
- if use doc ; then |
756 |
- docinto html |
757 |
- dodoc doc/src/sgml/html/* |
758 |
- fi |
759 |
- |
760 |
- if use server; then |
761 |
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
762 |
- "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT} |
763 |
- |
764 |
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
765 |
- "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT} |
766 |
- |
767 |
- if use systemd; then |
768 |
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
769 |
- "${FILESDIR}/${PN}.service-9.6-r1" | \ |
770 |
- systemd_newunit - ${PN}-${SLOT}.service |
771 |
- newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir |
772 |
- systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf |
773 |
- fi |
774 |
- |
775 |
- use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session |
776 |
- |
777 |
- if use prefix ; then |
778 |
- keepdir /run/postgresql |
779 |
- fperms 1775 /run/postgresql |
780 |
- fi |
781 |
- fi |
782 |
-} |
783 |
- |
784 |
-pkg_postinst() { |
785 |
- use server && use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf |
786 |
- postgresql-config update |
787 |
- |
788 |
- elog "If you need a global psqlrc-file, you can place it in:" |
789 |
- elog " ${EROOT%/}/etc/postgresql-${SLOT}/" |
790 |
- |
791 |
- if use server ; then |
792 |
- elog |
793 |
- elog "Gentoo specific documentation:" |
794 |
- elog "https://wiki.gentoo.org/wiki/PostgreSQL" |
795 |
- elog |
796 |
- elog "Official documentation:" |
797 |
- elog "https://www.postgresql.org/docs/${SLOT}/static/index.html" |
798 |
- elog |
799 |
- elog "The default location of the Unix-domain socket is:" |
800 |
- elog " ${EROOT%/}/run/postgresql/" |
801 |
- elog |
802 |
- elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" |
803 |
- elog "so that it contains your preferred locale in:" |
804 |
- elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
805 |
- elog |
806 |
- elog "Then, execute the following command to setup the initial database" |
807 |
- elog "environment:" |
808 |
- elog " emerge --config =${CATEGORY}/${PF}" |
809 |
- |
810 |
- if [[ -n ${REPLACING_VERSIONS} ]] ; then |
811 |
- ewarn "If your system is using 'pg_stat_statements' and you are running a" |
812 |
- ewarn "version of PostgreSQL ${SLOT}, we advise that you execute" |
813 |
- ewarn "the following command after upgrading:" |
814 |
- ewarn |
815 |
- ewarn "ALTER EXTENSION pg_stat_statements UPDATE;" |
816 |
- fi |
817 |
- fi |
818 |
-} |
819 |
- |
820 |
-pkg_prerm() { |
821 |
- if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then |
822 |
- ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?" |
823 |
- ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL" |
824 |
- |
825 |
- ebegin "Resuming removal in 10 seconds (Control-C to cancel)" |
826 |
- sleep 10 |
827 |
- eend 0 |
828 |
- fi |
829 |
-} |
830 |
- |
831 |
-pkg_postrm() { |
832 |
- postgresql-config update |
833 |
-} |
834 |
- |
835 |
-pkg_config() { |
836 |
- use server || die "USE flag 'server' not enabled. Nothing to configure." |
837 |
- |
838 |
- [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \ |
839 |
- && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
840 |
- [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/" |
841 |
- [[ -z "${DATA_DIR}" ]] \ |
842 |
- && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data" |
843 |
- |
844 |
- # environment.bz2 may not contain the same locale as the current system |
845 |
- # locale. Unset and source from the current system locale. |
846 |
- if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then |
847 |
- unset LANG |
848 |
- unset LC_CTYPE |
849 |
- unset LC_NUMERIC |
850 |
- unset LC_TIME |
851 |
- unset LC_COLLATE |
852 |
- unset LC_MONETARY |
853 |
- unset LC_MESSAGES |
854 |
- unset LC_ALL |
855 |
- source "${EROOT%/}/etc/env.d/02locale" |
856 |
- [ -n "${LANG}" ] && export LANG |
857 |
- [ -n "${LC_CTYPE}" ] && export LC_CTYPE |
858 |
- [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC |
859 |
- [ -n "${LC_TIME}" ] && export LC_TIME |
860 |
- [ -n "${LC_COLLATE}" ] && export LC_COLLATE |
861 |
- [ -n "${LC_MONETARY}" ] && export LC_MONETARY |
862 |
- [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES |
863 |
- [ -n "${LC_ALL}" ] && export LC_ALL |
864 |
- fi |
865 |
- |
866 |
- einfo "You can modify the paths and options passed to initdb by editing:" |
867 |
- einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
868 |
- einfo |
869 |
- einfo "Information on options that can be passed to initdb are found at:" |
870 |
- einfo " https://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html" |
871 |
- einfo " https://www.postgresql.org/docs/${SLOT}/static/app-initdb.html" |
872 |
- einfo |
873 |
- einfo "PG_INITDB_OPTS is currently set to:" |
874 |
- if [[ -z "${PG_INITDB_OPTS}" ]] ; then |
875 |
- einfo " (none)" |
876 |
- else |
877 |
- einfo " ${PG_INITDB_OPTS}" |
878 |
- fi |
879 |
- einfo |
880 |
- einfo "Configuration files will be installed to:" |
881 |
- einfo " ${PGDATA}" |
882 |
- einfo |
883 |
- einfo "The database cluster will be created in:" |
884 |
- einfo " ${DATA_DIR}" |
885 |
- einfo |
886 |
- |
887 |
- ebegin "Continuing initialization in 5 seconds (Control-C to cancel)" |
888 |
- sleep 5 |
889 |
- eend 0 |
890 |
- |
891 |
- if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then |
892 |
- eerror "The given directory, '${DATA_DIR}', is not empty." |
893 |
- eerror "Modify DATA_DIR to point to an empty directory." |
894 |
- die "${DATA_DIR} is not empty." |
895 |
- fi |
896 |
- |
897 |
- einfo "Creating the data directory ..." |
898 |
- if [[ ${EUID} == 0 ]] ; then |
899 |
- mkdir -p "${DATA_DIR}" |
900 |
- chown -Rf postgres:postgres "${DATA_DIR}" |
901 |
- chmod 0700 "${DATA_DIR}" |
902 |
- fi |
903 |
- |
904 |
- einfo "Initializing the database ..." |
905 |
- |
906 |
- if [[ ${EUID} == 0 ]] ; then |
907 |
- su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}" |
908 |
- else |
909 |
- "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS} |
910 |
- fi |
911 |
- |
912 |
- if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then |
913 |
- mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}" |
914 |
- ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}" |
915 |
- fi |
916 |
- |
917 |
- # unix_socket_directory has no effect in postgresql.conf as it's |
918 |
- # overridden in the initscript |
919 |
- sed '/^#unix_socket_directories/,+1d' -i "${PGDATA%/}"/postgresql.conf |
920 |
- |
921 |
- cat <<- EOF >> "${PGDATA%/}"/postgresql.conf |
922 |
- # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522 |
923 |
- # On the off-chance that you might need to work with UTF-8 encoded |
924 |
- # characters in PL/Perl |
925 |
- plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";' |
926 |
- EOF |
927 |
- |
928 |
- einfo "The autovacuum function, which was in contrib, has been moved to the main" |
929 |
- einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled" |
930 |
- einfo "by default. You can disable it in the cluster's:" |
931 |
- einfo " ${PGDATA%/}/postgresql.conf" |
932 |
- einfo |
933 |
- if ! use systemd; then |
934 |
- einfo "The PostgreSQL server, by default, will log events to:" |
935 |
- einfo " ${DATA_DIR%/}/postmaster.log" |
936 |
- einfo |
937 |
- fi |
938 |
- if use prefix ; then |
939 |
- einfo "The location of the configuration files have moved to:" |
940 |
- einfo " ${PGDATA}" |
941 |
- einfo "To start the server:" |
942 |
- einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'" |
943 |
- einfo "To stop:" |
944 |
- einfo " pg_ctl stop -D ${DATA_DIR}" |
945 |
- einfo |
946 |
- einfo "Or move the configuration files back:" |
947 |
- einfo "mv ${PGDATA}*.conf ${DATA_DIR}" |
948 |
- elif use systemd; then |
949 |
- einfo "You should use the 'postgresql-${SLOT}.service' unit to run PostgreSQL" |
950 |
- einfo "instead of 'pg_ctl'." |
951 |
- else |
952 |
- einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL" |
953 |
- einfo "instead of 'pg_ctl'." |
954 |
- fi |
955 |
-} |
956 |
- |
957 |
-src_test() { |
958 |
- if use server && [[ ${UID} -ne 0 ]] ; then |
959 |
- emake check |
960 |
- |
961 |
- einfo "If you think other tests besides the regression tests are necessary, please" |
962 |
- einfo "submit a bug including a patch for this ebuild to enable them." |
963 |
- else |
964 |
- use server || \ |
965 |
- ewarn 'Tests cannot be run without the "server" use flag enabled.' |
966 |
- [[ ${UID} -eq 0 ]] || \ |
967 |
- ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.' |
968 |
- |
969 |
- ewarn 'Skipping.' |
970 |
- fi |
971 |
-} |
972 |
|
973 |
diff --git a/dev-db/postgresql/postgresql-11.3-r1.ebuild b/dev-db/postgresql/postgresql-11.3-r1.ebuild |
974 |
deleted file mode 100644 |
975 |
index b55fe07666c..00000000000 |
976 |
--- a/dev-db/postgresql/postgresql-11.3-r1.ebuild |
977 |
+++ /dev/null |
978 |
@@ -1,468 +0,0 @@ |
979 |
-# Copyright 1999-2019 Gentoo Authors |
980 |
-# Distributed under the terms of the GNU General Public License v2 |
981 |
- |
982 |
-EAPI=7 |
983 |
- |
984 |
-PYTHON_COMPAT=( python2_7 python3_{5,6,7} ) |
985 |
- |
986 |
-PLOCALES="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr zh_CN |
987 |
- zh_TW" |
988 |
- |
989 |
-inherit flag-o-matic l10n linux-info multilib pam prefix python-single-r1 \ |
990 |
- systemd user |
991 |
- |
992 |
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" |
993 |
- |
994 |
-SLOT=$(ver_cut 1) |
995 |
- |
996 |
-MY_PV=${PV/_/} |
997 |
-S="${WORKDIR}/${PN}-${MY_PV}" |
998 |
- |
999 |
-SRC_URI="mirror://postgresql/source/v${MY_PV}/postgresql-${MY_PV}.tar.bz2" |
1000 |
- |
1001 |
-LICENSE="POSTGRESQL GPL-2" |
1002 |
-DESCRIPTION="PostgreSQL RDBMS" |
1003 |
-HOMEPAGE="http://www.postgresql.org/" |
1004 |
- |
1005 |
-IUSE="debug doc icu kerberos kernel_linux ldap libressl llvm nls pam |
1006 |
- perl python +readline selinux +server systemd ssl static-libs tcl |
1007 |
- threads uuid xml zlib" |
1008 |
- |
1009 |
-REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" |
1010 |
- |
1011 |
-CDEPEND=" |
1012 |
->=app-eselect/eselect-postgresql-2.0 |
1013 |
-sys-apps/less |
1014 |
-virtual/libintl |
1015 |
-icu? ( dev-libs/icu:= ) |
1016 |
-kerberos? ( virtual/krb5 ) |
1017 |
-ldap? ( net-nds/openldap ) |
1018 |
-llvm? ( |
1019 |
- sys-devel/llvm:= |
1020 |
- sys-devel/clang:= |
1021 |
-) |
1022 |
-pam? ( virtual/pam ) |
1023 |
-perl? ( >=dev-lang/perl-5.8:= ) |
1024 |
-python? ( ${PYTHON_DEPS} ) |
1025 |
-readline? ( sys-libs/readline:0= ) |
1026 |
-server? ( systemd? ( sys-apps/systemd ) ) |
1027 |
-ssl? ( |
1028 |
- !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= ) |
1029 |
- libressl? ( dev-libs/libressl:= ) |
1030 |
-) |
1031 |
-tcl? ( >=dev-lang/tcl-8:0= ) |
1032 |
-xml? ( dev-libs/libxml2 dev-libs/libxslt ) |
1033 |
-zlib? ( sys-libs/zlib ) |
1034 |
-" |
1035 |
- |
1036 |
-# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no |
1037 |
-# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems, |
1038 |
-# the libc includes UUID functions. |
1039 |
-UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} ) |
1040 |
-BSD_LIBC=( elibc_{Free,Net,Open}BSD ) |
1041 |
- |
1042 |
-nest_usedep() { |
1043 |
- local front back |
1044 |
- while [[ ${#} -gt 1 ]]; do |
1045 |
- front+="${1}? ( " |
1046 |
- back+=" )" |
1047 |
- shift |
1048 |
- done |
1049 |
- echo "${front}${1}${back}" |
1050 |
-} |
1051 |
- |
1052 |
-IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}" |
1053 |
-CDEPEND+=" |
1054 |
-uuid? ( |
1055 |
- ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )} |
1056 |
- $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid) |
1057 |
-)" |
1058 |
- |
1059 |
-DEPEND="${CDEPEND} |
1060 |
-!!<sys-apps/sandbox-2.0 |
1061 |
-sys-devel/bison |
1062 |
-sys-devel/flex |
1063 |
-nls? ( sys-devel/gettext ) |
1064 |
-xml? ( virtual/pkgconfig ) |
1065 |
-" |
1066 |
- |
1067 |
-RDEPEND="${CDEPEND} |
1068 |
-!dev-db/postgresql-docs:${SLOT} |
1069 |
-!dev-db/postgresql-base:${SLOT} |
1070 |
-!dev-db/postgresql-server:${SLOT} |
1071 |
-selinux? ( sec-policy/selinux-postgresql ) |
1072 |
-" |
1073 |
- |
1074 |
-pkg_setup() { |
1075 |
- use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup |
1076 |
- |
1077 |
- enewgroup postgres 70 |
1078 |
- enewuser postgres 70 /bin/sh /var/lib/postgresql postgres |
1079 |
- |
1080 |
- use python && python-single-r1_pkg_setup |
1081 |
-} |
1082 |
- |
1083 |
-src_prepare() { |
1084 |
- # Set proper run directory |
1085 |
- sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \ |
1086 |
- -i src/include/pg_config_manual.h || die |
1087 |
- |
1088 |
- # Rely on $PATH being in the proper order so that the correct |
1089 |
- # install program is used for modules utilizing PGXS in both |
1090 |
- # hardened and non-hardened environments. (Bug #528786) |
1091 |
- sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die |
1092 |
- |
1093 |
- use server || eapply "${FILESDIR}/${PN}-11_beta1-no-server.patch" |
1094 |
- |
1095 |
- if use pam ; then |
1096 |
- sed "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \ |
1097 |
- -i src/backend/libpq/auth.c || \ |
1098 |
- die 'PGSQL_PAM_SERVICE rename failed.' |
1099 |
- fi |
1100 |
- |
1101 |
- eapply_user |
1102 |
-} |
1103 |
- |
1104 |
-src_configure() { |
1105 |
- case ${CHOST} in |
1106 |
- *-darwin*|*-solaris*) |
1107 |
- use nls && append-libs intl |
1108 |
- ;; |
1109 |
- esac |
1110 |
- |
1111 |
- export LDFLAGS_SL="${LDFLAGS}" |
1112 |
- export LDFLAGS_EX="${LDFLAGS}" |
1113 |
- |
1114 |
- local PO="${EPREFIX%/}" |
1115 |
- |
1116 |
- local i uuid_config="" |
1117 |
- if use uuid; then |
1118 |
- for i in ${UTIL_LINUX_LIBC[@]}; do |
1119 |
- use ${i} && uuid_config="--with-uuid=e2fs" |
1120 |
- done |
1121 |
- for i in ${BSD_LIBC[@]}; do |
1122 |
- use ${i} && uuid_config="--with-uuid=bsd" |
1123 |
- done |
1124 |
- [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp" |
1125 |
- fi |
1126 |
- |
1127 |
- econf \ |
1128 |
- --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \ |
1129 |
- --datadir="${PO}/usr/share/postgresql-${SLOT}" \ |
1130 |
- --docdir="${PO}/usr/share/doc/${PF}" \ |
1131 |
- --includedir="${PO}/usr/include/postgresql-${SLOT}" \ |
1132 |
- --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \ |
1133 |
- --sysconfdir="${PO}/etc/postgresql-${SLOT}" \ |
1134 |
- --with-system-tzdata="${PO}/usr/share/zoneinfo" \ |
1135 |
- $(use_enable !alpha spinlocks) \ |
1136 |
- $(use_enable debug) \ |
1137 |
- $(use_enable threads thread-safety) \ |
1138 |
- $(use_with icu) \ |
1139 |
- $(use_with kerberos gssapi) \ |
1140 |
- $(use_with ldap) \ |
1141 |
- $(use_with llvm) \ |
1142 |
- $(use_with pam) \ |
1143 |
- $(use_with perl) \ |
1144 |
- $(use_with python) \ |
1145 |
- $(use_with readline) \ |
1146 |
- $(use_with ssl openssl) \ |
1147 |
- $(usex server "$(use_with systemd)" '--without-systemd') \ |
1148 |
- $(use_with tcl) \ |
1149 |
- ${uuid_config} \ |
1150 |
- $(use_with xml libxml) \ |
1151 |
- $(use_with xml libxslt) \ |
1152 |
- $(use_with zlib) \ |
1153 |
- $(use_enable nls nls "'$(l10n_get_locales)'") |
1154 |
-} |
1155 |
- |
1156 |
-src_compile() { |
1157 |
- emake |
1158 |
- emake -C contrib |
1159 |
-} |
1160 |
- |
1161 |
-src_install() { |
1162 |
- emake DESTDIR="${D}" install |
1163 |
- emake DESTDIR="${D}" install -C contrib |
1164 |
- |
1165 |
- dodoc README HISTORY doc/{TODO,bug.template} |
1166 |
- |
1167 |
- # man pages are already built, but if we have the target make them, |
1168 |
- # they'll be generated from source before being installed so we |
1169 |
- # manually install man pages. |
1170 |
- # We use ${SLOT} instead of doman for postgresql.eselect |
1171 |
- insinto /usr/share/postgresql-${SLOT}/man/ |
1172 |
- doins -r doc/src/sgml/man{1,3,7} |
1173 |
- if ! use server; then |
1174 |
- # Remove man pages for non-existent binaries |
1175 |
- serverman=( |
1176 |
- initdb |
1177 |
- pg_{archivecleanup,controldata,ctl,resetwal,rewind,standby} |
1178 |
- pg_{test_{fsync,timing},upgrade,waldump} |
1179 |
- post{gres,master} |
1180 |
- ) |
1181 |
- for m in ${serverman[@]} ; do |
1182 |
- rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1" |
1183 |
- done |
1184 |
- fi |
1185 |
- docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7} |
1186 |
- |
1187 |
- # Create slot specific man pages |
1188 |
- local bn f mansec slotted_name |
1189 |
- for mansec in 1 3 7 ; do |
1190 |
- local rel_manpath="../../postgresql-${SLOT}/man/man${mansec}" |
1191 |
- |
1192 |
- mkdir -p "${ED}"/usr/share/man/man${mansec} || die "making man dir" |
1193 |
- pushd "${ED}"/usr/share/man/man${mansec} > /dev/null || die "pushd failed" |
1194 |
- |
1195 |
- for f in "${ED}/usr/share/postgresql-${SLOT}/man/man${mansec}"/* ; do |
1196 |
- bn=$(basename "${f}") |
1197 |
- slotted_name=${bn%.${mansec}}${SLOT}.${mansec} |
1198 |
- case ${bn} in |
1199 |
- TABLE.7|WITH.7) |
1200 |
- echo ".so ${rel_manpath}/SELECT.7" > ${slotted_name} |
1201 |
- ;; |
1202 |
- *) |
1203 |
- echo ".so ${rel_manpath}/${bn}" > ${slotted_name} |
1204 |
- ;; |
1205 |
- esac |
1206 |
- done |
1207 |
- |
1208 |
- popd > /dev/null |
1209 |
- done |
1210 |
- |
1211 |
- insinto /etc/postgresql-${SLOT} |
1212 |
- newins src/bin/psql/psqlrc.sample psqlrc |
1213 |
- |
1214 |
- # Don't delete libpg{port,common}.a (Bug #571046). They're always |
1215 |
- # needed by extensions utilizing PGXS. |
1216 |
- use static-libs || \ |
1217 |
- find "${ED}" -name '*.a' ! -name libpgport.a ! -name libpgcommon.a \ |
1218 |
- -delete |
1219 |
- |
1220 |
- # Make slot specific links to programs |
1221 |
- local f bn |
1222 |
- for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \ |
1223 |
- -mindepth 1 -maxdepth 1) |
1224 |
- do |
1225 |
- bn=$(basename "${f}") |
1226 |
- dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \ |
1227 |
- "/usr/bin/${bn}${SLOT/.}" |
1228 |
- done |
1229 |
- |
1230 |
- if use doc ; then |
1231 |
- docinto html |
1232 |
- dodoc doc/src/sgml/html/* |
1233 |
- fi |
1234 |
- |
1235 |
- if use server; then |
1236 |
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1237 |
- "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT} |
1238 |
- |
1239 |
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1240 |
- "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT} |
1241 |
- |
1242 |
- if use systemd; then |
1243 |
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1244 |
- "${FILESDIR}/${PN}.service-9.6-r1" | \ |
1245 |
- systemd_newunit - ${PN}-${SLOT}.service |
1246 |
- newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir |
1247 |
- systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf |
1248 |
- fi |
1249 |
- |
1250 |
- use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session |
1251 |
- |
1252 |
- if use prefix ; then |
1253 |
- keepdir /run/postgresql |
1254 |
- fperms 1775 /run/postgresql |
1255 |
- fi |
1256 |
- fi |
1257 |
-} |
1258 |
- |
1259 |
-pkg_postinst() { |
1260 |
- use server && use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf |
1261 |
- postgresql-config update |
1262 |
- |
1263 |
- elog "If you need a global psqlrc-file, you can place it in:" |
1264 |
- elog " ${EROOT%/}/etc/postgresql-${SLOT}/" |
1265 |
- |
1266 |
- if use server ; then |
1267 |
- elog |
1268 |
- elog "Gentoo specific documentation:" |
1269 |
- elog "https://wiki.gentoo.org/wiki/PostgreSQL" |
1270 |
- elog |
1271 |
- elog "Official documentation:" |
1272 |
- elog "http://www.postgresql.org/docs/${SLOT}/static/index.html" |
1273 |
- elog |
1274 |
- elog "The default location of the Unix-domain socket is:" |
1275 |
- elog " ${EROOT%/}/run/postgresql/" |
1276 |
- elog |
1277 |
- elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" |
1278 |
- elog "so that it contains your preferred locale in:" |
1279 |
- elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
1280 |
- elog |
1281 |
- elog "Then, execute the following command to setup the initial database" |
1282 |
- elog "environment:" |
1283 |
- elog " emerge --config =${CATEGORY}/${PF}" |
1284 |
- |
1285 |
- if [[ -n ${REPLACING_VERSIONS} ]] ; then |
1286 |
- ewarn "If your system is using 'pg_stat_statements' and you are running a" |
1287 |
- ewarn "version of PostgreSQL ${SLOT}, we advise that you execute" |
1288 |
- ewarn "the following command after upgrading:" |
1289 |
- ewarn |
1290 |
- ewarn "ALTER EXTENSION pg_stat_statements UPDATE;" |
1291 |
- fi |
1292 |
- fi |
1293 |
-} |
1294 |
- |
1295 |
-pkg_prerm() { |
1296 |
- if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then |
1297 |
- ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?" |
1298 |
- ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL" |
1299 |
- |
1300 |
- ebegin "Resuming removal in 10 seconds (Control-C to cancel)" |
1301 |
- sleep 10 |
1302 |
- eend 0 |
1303 |
- fi |
1304 |
-} |
1305 |
- |
1306 |
-pkg_postrm() { |
1307 |
- postgresql-config update |
1308 |
-} |
1309 |
- |
1310 |
-pkg_config() { |
1311 |
- use server || die "USE flag 'server' not enabled. Nothing to configure." |
1312 |
- |
1313 |
- [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \ |
1314 |
- && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
1315 |
- [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/" |
1316 |
- [[ -z "${DATA_DIR}" ]] \ |
1317 |
- && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data" |
1318 |
- |
1319 |
- # environment.bz2 may not contain the same locale as the current system |
1320 |
- # locale. Unset and source from the current system locale. |
1321 |
- if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then |
1322 |
- unset LANG |
1323 |
- unset LC_CTYPE |
1324 |
- unset LC_NUMERIC |
1325 |
- unset LC_TIME |
1326 |
- unset LC_COLLATE |
1327 |
- unset LC_MONETARY |
1328 |
- unset LC_MESSAGES |
1329 |
- unset LC_ALL |
1330 |
- source "${EROOT%/}/etc/env.d/02locale" |
1331 |
- [ -n "${LANG}" ] && export LANG |
1332 |
- [ -n "${LC_CTYPE}" ] && export LC_CTYPE |
1333 |
- [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC |
1334 |
- [ -n "${LC_TIME}" ] && export LC_TIME |
1335 |
- [ -n "${LC_COLLATE}" ] && export LC_COLLATE |
1336 |
- [ -n "${LC_MONETARY}" ] && export LC_MONETARY |
1337 |
- [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES |
1338 |
- [ -n "${LC_ALL}" ] && export LC_ALL |
1339 |
- fi |
1340 |
- |
1341 |
- einfo "You can modify the paths and options passed to initdb by editing:" |
1342 |
- einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
1343 |
- einfo |
1344 |
- einfo "Information on options that can be passed to initdb are found at:" |
1345 |
- einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html" |
1346 |
- einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html" |
1347 |
- einfo |
1348 |
- einfo "PG_INITDB_OPTS is currently set to:" |
1349 |
- if [[ -z "${PG_INITDB_OPTS}" ]] ; then |
1350 |
- einfo " (none)" |
1351 |
- else |
1352 |
- einfo " ${PG_INITDB_OPTS}" |
1353 |
- fi |
1354 |
- einfo |
1355 |
- einfo "Configuration files will be installed to:" |
1356 |
- einfo " ${PGDATA}" |
1357 |
- einfo |
1358 |
- einfo "The database cluster will be created in:" |
1359 |
- einfo " ${DATA_DIR}" |
1360 |
- einfo |
1361 |
- |
1362 |
- ebegin "Continuing initialization in 5 seconds (Control-C to cancel)" |
1363 |
- sleep 5 |
1364 |
- eend 0 |
1365 |
- |
1366 |
- if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then |
1367 |
- eerror "The given directory, '${DATA_DIR}', is not empty." |
1368 |
- eerror "Modify DATA_DIR to point to an empty directory." |
1369 |
- die "${DATA_DIR} is not empty." |
1370 |
- fi |
1371 |
- |
1372 |
- einfo "Creating the data directory ..." |
1373 |
- if [[ ${EUID} == 0 ]] ; then |
1374 |
- mkdir -p "$(dirname ${DATA_DIR%/})" || die "Couldn't parent dirs" |
1375 |
- mkdir -m 0700 "${DATA_DIR%/}" || die "Couldn't make DATA_DIR" |
1376 |
- chown -h postgres:postgres "${DATA_DIR%/}" || die "Couldn't chown" |
1377 |
- fi |
1378 |
- |
1379 |
- einfo "Initializing the database ..." |
1380 |
- |
1381 |
- if [[ ${EUID} == 0 ]] ; then |
1382 |
- su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}" |
1383 |
- else |
1384 |
- "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS} |
1385 |
- fi |
1386 |
- |
1387 |
- if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then |
1388 |
- mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}" |
1389 |
- ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}" |
1390 |
- fi |
1391 |
- |
1392 |
- # unix_socket_directory has no effect in postgresql.conf as it's |
1393 |
- # overridden in the initscript |
1394 |
- sed '/^#unix_socket_directories/,+1d' -i "${PGDATA%/}"/postgresql.conf |
1395 |
- |
1396 |
- cat <<- EOF >> "${PGDATA%/}"/postgresql.conf |
1397 |
- # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522 |
1398 |
- # On the off-chance that you might need to work with UTF-8 encoded |
1399 |
- # characters in PL/Perl |
1400 |
- plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";' |
1401 |
- EOF |
1402 |
- |
1403 |
- einfo "The autovacuum function, which was in contrib, has been moved to the main" |
1404 |
- einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled" |
1405 |
- einfo "by default. You can disable it in the cluster's:" |
1406 |
- einfo " ${PGDATA%/}/postgresql.conf" |
1407 |
- einfo |
1408 |
- if ! use systemd; then |
1409 |
- einfo "The PostgreSQL server, by default, will log events to:" |
1410 |
- einfo " ${DATA_DIR%/}/postmaster.log" |
1411 |
- einfo |
1412 |
- fi |
1413 |
- if use prefix ; then |
1414 |
- einfo "The location of the configuration files have moved to:" |
1415 |
- einfo " ${PGDATA}" |
1416 |
- einfo "To start the server:" |
1417 |
- einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'" |
1418 |
- einfo "To stop:" |
1419 |
- einfo " pg_ctl stop -D ${DATA_DIR}" |
1420 |
- einfo |
1421 |
- einfo "Or move the configuration files back:" |
1422 |
- einfo "mv ${PGDATA}*.conf ${DATA_DIR}" |
1423 |
- elif use systemd; then |
1424 |
- einfo "You should use the 'postgresql-${SLOT}.service' unit to run PostgreSQL" |
1425 |
- einfo "instead of 'pg_ctl'." |
1426 |
- else |
1427 |
- einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL" |
1428 |
- einfo "instead of 'pg_ctl'." |
1429 |
- fi |
1430 |
-} |
1431 |
- |
1432 |
-src_test() { |
1433 |
- if use server && [[ ${UID} -ne 0 ]] ; then |
1434 |
- emake check |
1435 |
- |
1436 |
- einfo "If you think other tests besides the regression tests are necessary, please" |
1437 |
- einfo "submit a bug including a patch for this ebuild to enable them." |
1438 |
- else |
1439 |
- use server || \ |
1440 |
- ewarn 'Tests cannot be run without the "server" use flag enabled.' |
1441 |
- [[ ${UID} -eq 0 ]] || \ |
1442 |
- ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.' |
1443 |
- |
1444 |
- ewarn 'Skipping.' |
1445 |
- fi |
1446 |
-} |
1447 |
|
1448 |
diff --git a/dev-db/postgresql/postgresql-11.3.ebuild b/dev-db/postgresql/postgresql-11.3.ebuild |
1449 |
deleted file mode 100644 |
1450 |
index f783365d3a6..00000000000 |
1451 |
--- a/dev-db/postgresql/postgresql-11.3.ebuild |
1452 |
+++ /dev/null |
1453 |
@@ -1,460 +0,0 @@ |
1454 |
-# Copyright 1999-2019 Gentoo Authors |
1455 |
-# Distributed under the terms of the GNU General Public License v2 |
1456 |
- |
1457 |
-EAPI="6" |
1458 |
- |
1459 |
-PYTHON_COMPAT=( python2_7 python3_{5,6} ) |
1460 |
- |
1461 |
-PLOCALES="af cs de en es fa fr hr hu it ko nb pl pt_BR ro ru sk sl sv tr zh_CN |
1462 |
- zh_TW" |
1463 |
- |
1464 |
-inherit flag-o-matic l10n linux-info multilib pam prefix python-single-r1 \ |
1465 |
- systemd user versionator |
1466 |
- |
1467 |
-KEYWORDS="alpha amd64 arm arm64 hppa ia64 ~mips ppc ppc64 ~s390 ~sh sparc x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" |
1468 |
- |
1469 |
-SLOT=$(get_major_version) |
1470 |
- |
1471 |
-MY_PV=${PV/_/} |
1472 |
-S="${WORKDIR}/${PN}-${MY_PV}" |
1473 |
- |
1474 |
-SRC_URI="mirror://postgresql/source/v${MY_PV}/postgresql-${MY_PV}.tar.bz2" |
1475 |
- |
1476 |
-LICENSE="POSTGRESQL GPL-2" |
1477 |
-DESCRIPTION="PostgreSQL RDBMS" |
1478 |
-HOMEPAGE="http://www.postgresql.org/" |
1479 |
- |
1480 |
-IUSE="doc kerberos kernel_linux ldap libressl llvm nls pam perl python +readline |
1481 |
- selinux +server systemd ssl static-libs tcl threads uuid xml zlib" |
1482 |
- |
1483 |
-REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" |
1484 |
- |
1485 |
-CDEPEND=" |
1486 |
->=app-eselect/eselect-postgresql-2.0 |
1487 |
-sys-apps/less |
1488 |
-virtual/libintl |
1489 |
-kerberos? ( virtual/krb5 ) |
1490 |
-ldap? ( net-nds/openldap ) |
1491 |
-llvm? ( sys-devel/llvm:= |
1492 |
- sys-devel/clang:= ) |
1493 |
-pam? ( virtual/pam ) |
1494 |
-perl? ( >=dev-lang/perl-5.8:= ) |
1495 |
-python? ( ${PYTHON_DEPS} ) |
1496 |
-readline? ( sys-libs/readline:0= ) |
1497 |
-server? ( systemd? ( sys-apps/systemd ) ) |
1498 |
-ssl? ( |
1499 |
- !libressl? ( >=dev-libs/openssl-0.9.6-r1:0= ) |
1500 |
- libressl? ( dev-libs/libressl:= ) |
1501 |
-) |
1502 |
-tcl? ( >=dev-lang/tcl-8:0= ) |
1503 |
-xml? ( dev-libs/libxml2 dev-libs/libxslt ) |
1504 |
-zlib? ( sys-libs/zlib ) |
1505 |
-" |
1506 |
- |
1507 |
-# uuid flags -- depend on sys-apps/util-linux for Linux libcs, or if no |
1508 |
-# supported libc in use depend on dev-libs/ossp-uuid. For BSD systems, |
1509 |
-# the libc includes UUID functions. |
1510 |
-UTIL_LINUX_LIBC=( elibc_{glibc,uclibc,musl} ) |
1511 |
-BSD_LIBC=( elibc_{Free,Net,Open}BSD ) |
1512 |
- |
1513 |
-nest_usedep() { |
1514 |
- local front back |
1515 |
- while [[ ${#} -gt 1 ]]; do |
1516 |
- front+="${1}? ( " |
1517 |
- back+=" )" |
1518 |
- shift |
1519 |
- done |
1520 |
- echo "${front}${1}${back}" |
1521 |
-} |
1522 |
- |
1523 |
-IUSE+=" ${UTIL_LINUX_LIBC[@]} ${BSD_LIBC[@]}" |
1524 |
-CDEPEND+=" |
1525 |
-uuid? ( |
1526 |
- ${UTIL_LINUX_LIBC[@]/%/? ( sys-apps/util-linux )} |
1527 |
- $(nest_usedep ${UTIL_LINUX_LIBC[@]/#/!} ${BSD_LIBC[@]/#/!} dev-libs/ossp-uuid) |
1528 |
-)" |
1529 |
- |
1530 |
-DEPEND="${CDEPEND} |
1531 |
-!!<sys-apps/sandbox-2.0 |
1532 |
-sys-devel/bison |
1533 |
-sys-devel/flex |
1534 |
-nls? ( sys-devel/gettext ) |
1535 |
-xml? ( virtual/pkgconfig ) |
1536 |
-" |
1537 |
- |
1538 |
-RDEPEND="${CDEPEND} |
1539 |
-!dev-db/postgresql-docs:${SLOT} |
1540 |
-!dev-db/postgresql-base:${SLOT} |
1541 |
-!dev-db/postgresql-server:${SLOT} |
1542 |
-selinux? ( sec-policy/selinux-postgresql ) |
1543 |
-" |
1544 |
- |
1545 |
-pkg_setup() { |
1546 |
- use server && CONFIG_CHECK="~SYSVIPC" linux-info_pkg_setup |
1547 |
- |
1548 |
- enewgroup postgres 70 |
1549 |
- enewuser postgres 70 /bin/sh /var/lib/postgresql postgres |
1550 |
- |
1551 |
- use python && python-single-r1_pkg_setup |
1552 |
-} |
1553 |
- |
1554 |
-src_prepare() { |
1555 |
- # Set proper run directory |
1556 |
- sed "s|\(PGSOCKET_DIR\s\+\)\"/tmp\"|\1\"${EPREFIX}/run/postgresql\"|" \ |
1557 |
- -i src/include/pg_config_manual.h || die |
1558 |
- |
1559 |
- # Rely on $PATH being in the proper order so that the correct |
1560 |
- # install program is used for modules utilizing PGXS in both |
1561 |
- # hardened and non-hardened environments. (Bug #528786) |
1562 |
- sed 's/@install_bin@/install -c/' -i src/Makefile.global.in || die |
1563 |
- |
1564 |
- use server || eapply "${FILESDIR}/${PN}-11_beta1-no-server.patch" |
1565 |
- |
1566 |
- if use pam ; then |
1567 |
- sed "s/\(#define PGSQL_PAM_SERVICE \"postgresql\)/\1-${SLOT}/" \ |
1568 |
- -i src/backend/libpq/auth.c || \ |
1569 |
- die 'PGSQL_PAM_SERVICE rename failed.' |
1570 |
- fi |
1571 |
- |
1572 |
- eapply_user |
1573 |
-} |
1574 |
- |
1575 |
-src_configure() { |
1576 |
- case ${CHOST} in |
1577 |
- *-darwin*|*-solaris*) |
1578 |
- use nls && append-libs intl |
1579 |
- ;; |
1580 |
- esac |
1581 |
- |
1582 |
- export LDFLAGS_SL="${LDFLAGS}" |
1583 |
- export LDFLAGS_EX="${LDFLAGS}" |
1584 |
- |
1585 |
- local PO="${EPREFIX%/}" |
1586 |
- |
1587 |
- local i uuid_config="" |
1588 |
- if use uuid; then |
1589 |
- for i in ${UTIL_LINUX_LIBC[@]}; do |
1590 |
- use ${i} && uuid_config="--with-uuid=e2fs" |
1591 |
- done |
1592 |
- for i in ${BSD_LIBC[@]}; do |
1593 |
- use ${i} && uuid_config="--with-uuid=bsd" |
1594 |
- done |
1595 |
- [[ -z $uuid_config ]] && uuid_config="--with-uuid=ossp" |
1596 |
- fi |
1597 |
- |
1598 |
- econf \ |
1599 |
- --prefix="${PO}/usr/$(get_libdir)/postgresql-${SLOT}" \ |
1600 |
- --datadir="${PO}/usr/share/postgresql-${SLOT}" \ |
1601 |
- --docdir="${PO}/usr/share/doc/${PF}" \ |
1602 |
- --includedir="${PO}/usr/include/postgresql-${SLOT}" \ |
1603 |
- --mandir="${PO}/usr/share/postgresql-${SLOT}/man" \ |
1604 |
- --sysconfdir="${PO}/etc/postgresql-${SLOT}" \ |
1605 |
- --with-system-tzdata="${PO}/usr/share/zoneinfo" \ |
1606 |
- $(use_enable !alpha spinlocks) \ |
1607 |
- $(use_enable threads thread-safety) \ |
1608 |
- $(use_with kerberos gssapi) \ |
1609 |
- $(use_with ldap) \ |
1610 |
- $(use_with llvm) \ |
1611 |
- $(use_with pam) \ |
1612 |
- $(use_with perl) \ |
1613 |
- $(use_with python) \ |
1614 |
- $(use_with readline) \ |
1615 |
- $(use_with ssl openssl) \ |
1616 |
- $(usex server "$(use_with systemd)" '--without-systemd') \ |
1617 |
- $(use_with tcl) \ |
1618 |
- ${uuid_config} \ |
1619 |
- $(use_with xml libxml) \ |
1620 |
- $(use_with xml libxslt) \ |
1621 |
- $(use_with zlib) \ |
1622 |
- $(use_enable nls nls "'$(l10n_get_locales)'") |
1623 |
-} |
1624 |
- |
1625 |
-src_compile() { |
1626 |
- emake |
1627 |
- emake -C contrib |
1628 |
-} |
1629 |
- |
1630 |
-src_install() { |
1631 |
- emake DESTDIR="${D}" install |
1632 |
- emake DESTDIR="${D}" install -C contrib |
1633 |
- |
1634 |
- dodoc README HISTORY doc/{TODO,bug.template} |
1635 |
- |
1636 |
- # man pages are already built, but if we have the target make them, |
1637 |
- # they'll be generated from source before being installed so we |
1638 |
- # manually install man pages. |
1639 |
- # We use ${SLOT} instead of doman for postgresql.eselect |
1640 |
- insinto /usr/share/postgresql-${SLOT}/man/ |
1641 |
- doins -r doc/src/sgml/man{1,3,7} |
1642 |
- if ! use server; then |
1643 |
- # Remove man pages for non-existent binaries |
1644 |
- serverman=( |
1645 |
- initdb |
1646 |
- pg_{archivecleanup,controldata,ctl,resetwal,rewind,standby} |
1647 |
- pg_{test_{fsync,timing},upgrade,waldump} |
1648 |
- post{gres,master} |
1649 |
- ) |
1650 |
- for m in ${serverman[@]} ; do |
1651 |
- rm "${ED}/usr/share/postgresql-${SLOT}/man/man1/${m}.1" |
1652 |
- done |
1653 |
- fi |
1654 |
- docompress /usr/share/postgresql-${SLOT}/man/man{1,3,7} |
1655 |
- |
1656 |
- # Create slot specific man pages |
1657 |
- local bn f mansec slotted_name |
1658 |
- for mansec in 1 3 7 ; do |
1659 |
- local rel_manpath="../../postgresql-${SLOT}/man/man${mansec}" |
1660 |
- |
1661 |
- mkdir -p "${ED}"/usr/share/man/man${mansec} || die "making man dir" |
1662 |
- pushd "${ED}"/usr/share/man/man${mansec} > /dev/null || die "pushd failed" |
1663 |
- |
1664 |
- for f in "${ED}/usr/share/postgresql-${SLOT}/man/man${mansec}"/* ; do |
1665 |
- bn=$(basename "${f}") |
1666 |
- slotted_name=${bn%.${mansec}}${SLOT}.${mansec} |
1667 |
- case ${bn} in |
1668 |
- TABLE.7|WITH.7) |
1669 |
- echo ".so ${rel_manpath}/SELECT.7" > ${slotted_name} |
1670 |
- ;; |
1671 |
- *) |
1672 |
- echo ".so ${rel_manpath}/${bn}" > ${slotted_name} |
1673 |
- ;; |
1674 |
- esac |
1675 |
- done |
1676 |
- |
1677 |
- popd > /dev/null |
1678 |
- done |
1679 |
- |
1680 |
- insinto /etc/postgresql-${SLOT} |
1681 |
- newins src/bin/psql/psqlrc.sample psqlrc |
1682 |
- |
1683 |
- use static-libs || find "${ED}" -name '*.a' -delete |
1684 |
- |
1685 |
- local f bn |
1686 |
- for f in $(find "${ED}/usr/$(get_libdir)/postgresql-${SLOT}/bin" \ |
1687 |
- -mindepth 1 -maxdepth 1) |
1688 |
- do |
1689 |
- bn=$(basename "${f}") |
1690 |
- # Temporarily tack on tmp to workaround a file collision |
1691 |
- # issue. This is only necessary for 9.7 and earlier. 10 never |
1692 |
- # had this issue. |
1693 |
- dosym "../$(get_libdir)/postgresql-${SLOT}/bin/${bn}" \ |
1694 |
- "/usr/bin/${bn}${SLOT/.}" |
1695 |
- done |
1696 |
- |
1697 |
- if use doc ; then |
1698 |
- docinto html |
1699 |
- dodoc doc/src/sgml/html/* |
1700 |
- fi |
1701 |
- |
1702 |
- if use server; then |
1703 |
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1704 |
- "${FILESDIR}/${PN}.confd-9.3" | newconfd - ${PN}-${SLOT} |
1705 |
- |
1706 |
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1707 |
- "${FILESDIR}/${PN}.init-9.3-r1" | newinitd - ${PN}-${SLOT} |
1708 |
- |
1709 |
- if use systemd; then |
1710 |
- sed -e "s|@SLOT@|${SLOT}|g" -e "s|@LIBDIR@|$(get_libdir)|g" \ |
1711 |
- "${FILESDIR}/${PN}.service-9.6-r1" | \ |
1712 |
- systemd_newunit - ${PN}-${SLOT}.service |
1713 |
- newbin "${FILESDIR}"/${PN}-check-db-dir ${PN}-${SLOT}-check-db-dir |
1714 |
- systemd_newtmpfilesd "${FILESDIR}"/${PN}.tmpfiles ${PN}-${SLOT}.conf |
1715 |
- fi |
1716 |
- |
1717 |
- use pam && pamd_mimic system-auth ${PN}-${SLOT} auth account session |
1718 |
- |
1719 |
- if use prefix ; then |
1720 |
- keepdir /run/postgresql |
1721 |
- fperms 1775 /run/postgresql |
1722 |
- fi |
1723 |
- fi |
1724 |
-} |
1725 |
- |
1726 |
-pkg_postinst() { |
1727 |
- use server && use systemd && systemd_tmpfiles_create ${PN}-${SLOT}.conf |
1728 |
- postgresql-config update |
1729 |
- |
1730 |
- elog "If you need a global psqlrc-file, you can place it in:" |
1731 |
- elog " ${EROOT%/}/etc/postgresql-${SLOT}/" |
1732 |
- |
1733 |
- if use server ; then |
1734 |
- elog |
1735 |
- elog "Gentoo specific documentation:" |
1736 |
- elog "https://wiki.gentoo.org/wiki/PostgreSQL" |
1737 |
- elog |
1738 |
- elog "Official documentation:" |
1739 |
- elog "http://www.postgresql.org/docs/${SLOT}/static/index.html" |
1740 |
- elog |
1741 |
- elog "The default location of the Unix-domain socket is:" |
1742 |
- elog " ${EROOT%/}/run/postgresql/" |
1743 |
- elog |
1744 |
- elog "Before initializing the database, you may want to edit PG_INITDB_OPTS" |
1745 |
- elog "so that it contains your preferred locale in:" |
1746 |
- elog " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
1747 |
- elog |
1748 |
- elog "Then, execute the following command to setup the initial database" |
1749 |
- elog "environment:" |
1750 |
- elog " emerge --config =${CATEGORY}/${PF}" |
1751 |
- |
1752 |
- if [[ -n ${REPLACING_VERSIONS} ]] ; then |
1753 |
- ewarn "If your system is using 'pg_stat_statements' and you are running a" |
1754 |
- ewarn "version of PostgreSQL ${SLOT}, we advise that you execute" |
1755 |
- ewarn "the following command after upgrading:" |
1756 |
- ewarn |
1757 |
- ewarn "ALTER EXTENSION pg_stat_statements UPDATE;" |
1758 |
- fi |
1759 |
- fi |
1760 |
-} |
1761 |
- |
1762 |
-pkg_prerm() { |
1763 |
- if use server && [[ -z ${REPLACED_BY_VERSION} ]] ; then |
1764 |
- ewarn "Have you dumped and/or migrated the ${SLOT} database cluster?" |
1765 |
- ewarn "\thttps://wiki.gentoo.org/wiki/PostgreSQL/QuickStart#Migrating_PostgreSQL" |
1766 |
- |
1767 |
- ebegin "Resuming removal in 10 seconds (Control-C to cancel)" |
1768 |
- sleep 10 |
1769 |
- eend 0 |
1770 |
- fi |
1771 |
-} |
1772 |
- |
1773 |
-pkg_postrm() { |
1774 |
- postgresql-config update |
1775 |
-} |
1776 |
- |
1777 |
-pkg_config() { |
1778 |
- use server || die "USE flag 'server' not enabled. Nothing to configure." |
1779 |
- |
1780 |
- [[ -f "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" ]] \ |
1781 |
- && source "${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
1782 |
- [[ -z "${PGDATA}" ]] && PGDATA="${EROOT%/}/etc/postgresql-${SLOT}/" |
1783 |
- [[ -z "${DATA_DIR}" ]] \ |
1784 |
- && DATA_DIR="${EROOT%/}/var/lib/postgresql/${SLOT}/data" |
1785 |
- |
1786 |
- # environment.bz2 may not contain the same locale as the current system |
1787 |
- # locale. Unset and source from the current system locale. |
1788 |
- if [ -f "${EROOT%/}/etc/env.d/02locale" ]; then |
1789 |
- unset LANG |
1790 |
- unset LC_CTYPE |
1791 |
- unset LC_NUMERIC |
1792 |
- unset LC_TIME |
1793 |
- unset LC_COLLATE |
1794 |
- unset LC_MONETARY |
1795 |
- unset LC_MESSAGES |
1796 |
- unset LC_ALL |
1797 |
- source "${EROOT%/}/etc/env.d/02locale" |
1798 |
- [ -n "${LANG}" ] && export LANG |
1799 |
- [ -n "${LC_CTYPE}" ] && export LC_CTYPE |
1800 |
- [ -n "${LC_NUMERIC}" ] && export LC_NUMERIC |
1801 |
- [ -n "${LC_TIME}" ] && export LC_TIME |
1802 |
- [ -n "${LC_COLLATE}" ] && export LC_COLLATE |
1803 |
- [ -n "${LC_MONETARY}" ] && export LC_MONETARY |
1804 |
- [ -n "${LC_MESSAGES}" ] && export LC_MESSAGES |
1805 |
- [ -n "${LC_ALL}" ] && export LC_ALL |
1806 |
- fi |
1807 |
- |
1808 |
- einfo "You can modify the paths and options passed to initdb by editing:" |
1809 |
- einfo " ${EROOT%/}/etc/conf.d/postgresql-${SLOT}" |
1810 |
- einfo |
1811 |
- einfo "Information on options that can be passed to initdb are found at:" |
1812 |
- einfo " http://www.postgresql.org/docs/${SLOT}/static/creating-cluster.html" |
1813 |
- einfo " http://www.postgresql.org/docs/${SLOT}/static/app-initdb.html" |
1814 |
- einfo |
1815 |
- einfo "PG_INITDB_OPTS is currently set to:" |
1816 |
- if [[ -z "${PG_INITDB_OPTS}" ]] ; then |
1817 |
- einfo " (none)" |
1818 |
- else |
1819 |
- einfo " ${PG_INITDB_OPTS}" |
1820 |
- fi |
1821 |
- einfo |
1822 |
- einfo "Configuration files will be installed to:" |
1823 |
- einfo " ${PGDATA}" |
1824 |
- einfo |
1825 |
- einfo "The database cluster will be created in:" |
1826 |
- einfo " ${DATA_DIR}" |
1827 |
- einfo |
1828 |
- |
1829 |
- ebegin "Continuing initialization in 5 seconds (Control-C to cancel)" |
1830 |
- sleep 5 |
1831 |
- eend 0 |
1832 |
- |
1833 |
- if [ -n "$(ls -A ${DATA_DIR} 2> /dev/null)" ] ; then |
1834 |
- eerror "The given directory, '${DATA_DIR}', is not empty." |
1835 |
- eerror "Modify DATA_DIR to point to an empty directory." |
1836 |
- die "${DATA_DIR} is not empty." |
1837 |
- fi |
1838 |
- |
1839 |
- einfo "Creating the data directory ..." |
1840 |
- if [[ ${EUID} == 0 ]] ; then |
1841 |
- mkdir -p "${DATA_DIR}" |
1842 |
- chown -Rf postgres:postgres "${DATA_DIR}" |
1843 |
- chmod 0700 "${DATA_DIR}" |
1844 |
- fi |
1845 |
- |
1846 |
- einfo "Initializing the database ..." |
1847 |
- |
1848 |
- if [[ ${EUID} == 0 ]] ; then |
1849 |
- su postgres -c "${EROOT%/}/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -D \"${DATA_DIR}\" ${PG_INITDB_OPTS}" |
1850 |
- else |
1851 |
- "${EROOT%/}"/usr/$(get_libdir)/postgresql-${SLOT}/bin/initdb -U postgres -D "${DATA_DIR}" ${PG_INITDB_OPTS} |
1852 |
- fi |
1853 |
- |
1854 |
- if [[ "${DATA_DIR%/}" != "${PGDATA%/}" ]] ; then |
1855 |
- mv "${DATA_DIR%/}"/{pg_{hba,ident},postgresql}.conf "${PGDATA}" |
1856 |
- ln -s "${PGDATA%/}"/{pg_{hba,ident},postgresql}.conf "${DATA_DIR%/}" |
1857 |
- fi |
1858 |
- |
1859 |
- # unix_socket_directory has no effect in postgresql.conf as it's |
1860 |
- # overridden in the initscript |
1861 |
- sed '/^#unix_socket_directories/,+1d' -i "${PGDATA%/}"/postgresql.conf |
1862 |
- |
1863 |
- cat <<- EOF >> "${PGDATA%/}"/postgresql.conf |
1864 |
- # This is here because of https://bugs.gentoo.org/show_bug.cgi?id=518522 |
1865 |
- # On the off-chance that you might need to work with UTF-8 encoded |
1866 |
- # characters in PL/Perl |
1867 |
- plperl.on_init = 'use utf8; use re; package utf8; require "utf8_heavy.pl";' |
1868 |
- EOF |
1869 |
- |
1870 |
- einfo "The autovacuum function, which was in contrib, has been moved to the main" |
1871 |
- einfo "PostgreSQL functions starting with 8.1, and starting with 8.4 is now enabled" |
1872 |
- einfo "by default. You can disable it in the cluster's:" |
1873 |
- einfo " ${PGDATA%/}/postgresql.conf" |
1874 |
- einfo |
1875 |
- if ! use systemd; then |
1876 |
- einfo "The PostgreSQL server, by default, will log events to:" |
1877 |
- einfo " ${DATA_DIR%/}/postmaster.log" |
1878 |
- einfo |
1879 |
- fi |
1880 |
- if use prefix ; then |
1881 |
- einfo "The location of the configuration files have moved to:" |
1882 |
- einfo " ${PGDATA}" |
1883 |
- einfo "To start the server:" |
1884 |
- einfo " pg_ctl start -D ${DATA_DIR} -o '-D ${PGDATA} --data-directory=${DATA_DIR}'" |
1885 |
- einfo "To stop:" |
1886 |
- einfo " pg_ctl stop -D ${DATA_DIR}" |
1887 |
- einfo |
1888 |
- einfo "Or move the configuration files back:" |
1889 |
- einfo "mv ${PGDATA}*.conf ${DATA_DIR}" |
1890 |
- elif use systemd; then |
1891 |
- einfo "You should use the 'postgresql-${SLOT}.service' unit to run PostgreSQL" |
1892 |
- einfo "instead of 'pg_ctl'." |
1893 |
- else |
1894 |
- einfo "You should use the '${EROOT%/}/etc/init.d/postgresql-${SLOT}' script to run PostgreSQL" |
1895 |
- einfo "instead of 'pg_ctl'." |
1896 |
- fi |
1897 |
-} |
1898 |
- |
1899 |
-src_test() { |
1900 |
- if use server && [[ ${UID} -ne 0 ]] ; then |
1901 |
- emake check |
1902 |
- |
1903 |
- einfo "If you think other tests besides the regression tests are necessary, please" |
1904 |
- einfo "submit a bug including a patch for this ebuild to enable them." |
1905 |
- else |
1906 |
- use server || \ |
1907 |
- ewarn 'Tests cannot be run without the "server" use flag enabled.' |
1908 |
- [[ ${UID} -eq 0 ]] || \ |
1909 |
- ewarn 'Tests cannot be run as root. Enable "userpriv" in FEATURES.' |
1910 |
- |
1911 |
- ewarn 'Skipping.' |
1912 |
- fi |
1913 |
-} |