Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 112359
Collapse All | Expand All

(-)postgresql-8.1.0.ebuild (-45 / +52 lines)
Lines 1-6 Link Here
1
# Copyright 1999-2005 Gentoo Foundation
1
# Copyright 1999-2005 Gentoo Foundation
2
# Distributed under the terms of the GNU General Public License v2
2
# Distributed under the terms of the GNU General Public License v2
3
# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql/postgresql-8.1.0.ebuild,v 1.3 2005/11/12 23:09:52 nakano Exp $
3
# $Header: /var/cvsroot/gentoo-x86/dev-db/postgresql/postgresql-8.1.0.ebuild,v 1.1 2005/11/08 13:53:10 nakano Exp $
4
4
5
inherit eutils gnuconfig flag-o-matic multilib toolchain-funcs
5
inherit eutils gnuconfig flag-o-matic multilib toolchain-funcs
6
6
Lines 14-20 Link Here
14
14
15
LICENSE="POSTGRESQL"
15
LICENSE="POSTGRESQL"
16
SLOT="0"
16
SLOT="0"
17
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
17
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-macos"
18
#IUSE="ssl nls python tcltk perl libg++ pam readline xml2 zlib doc selinux kerberos pg-intdatetime pg-hier"
18
#IUSE="ssl nls python tcltk perl libg++ pam readline xml2 zlib doc selinux kerberos pg-intdatetime pg-hier"
19
IUSE="ssl nls python tcltk perl libg++ pam readline xml2 zlib doc selinux kerberos pg-intdatetime"
19
IUSE="ssl nls python tcltk perl libg++ pam readline xml2 zlib doc selinux kerberos pg-intdatetime"
20
20
Lines 22-28 Link Here
22
	=dev-db/libpq-8.1*
22
	=dev-db/libpq-8.1*
23
	sys-devel/autoconf
23
	sys-devel/autoconf
24
	>=sys-libs/ncurses-5.2
24
	>=sys-libs/ncurses-5.2
25
	>=sys-devel/bison-1.875
25
	!ppc-macos? ( >=sys-devel/bison-1.875 )
26
	zlib? ( >=sys-libs/zlib-1.1.3 )
26
	zlib? ( >=sys-libs/zlib-1.1.3 )
27
	readline? ( >=sys-libs/readline-4.1 )
27
	readline? ( >=sys-libs/readline-4.1 )
28
	tcltk? ( >=dev-lang/tcl-8 >=dev-lang/tk-8.3.3-r1 )
28
	tcltk? ( >=dev-lang/tcl-8 >=dev-lang/tk-8.3.3-r1 )
Lines 58-67 Link Here
58
			exit 1
58
			exit 1
59
		fi
59
		fi
60
	fi
60
	fi
61
	enewgroup postgres 70 \
61
	enewgroup postgres 70
62
		|| die "problem adding group postgres"
63
	enewuser postgres 70 /bin/bash /var/lib/postgresql postgres \
62
	enewuser postgres 70 /bin/bash /var/lib/postgresql postgres \
64
		|| die "problem adding user postgres"
63
        || die "problem adding user postgres"
65
}
64
}
66
65
67
src_unpack() {
66
src_unpack() {
Lines 102-107 Link Here
102
		--with-docdir=/usr/share/doc/${PF} \
101
		--with-docdir=/usr/share/doc/${PF} \
103
		--libdir=/usr/$(get_libdir) \
102
		--libdir=/usr/$(get_libdir) \
104
		--enable-depend \
103
		--enable-depend \
104
		--with-gnu-ld \
105
		$myconf || die
105
		$myconf || die
106
106
107
	make LD="$(tc-getLD) $(get_abi_LDFLAGS)" || die
107
	make LD="$(tc-getLD) $(get_abi_LDFLAGS)" || die
Lines 151-164 Link Here
151
		dodoc TODO.detail/* || die
151
		dodoc TODO.detail/* || die
152
	fi
152
	fi
153
153
154
	rm ${D}/usr/include/postgres_ext.h
154
	cd ${S}
155
	cd ${S}
155
	exeinto /etc/init.d/
156
	newexe ${FILESDIR}/postgresql.init-${PV} postgresql || die
157
156
158
	insinto /etc/conf.d/
157
	if ! use ppc-macos; then
159
	newins ${FILESDIR}/postgresql.conf-${PV} postgresql || die
158
		exeinto /etc/init.d/
159
		newexe ${FILESDIR}/postgresql.init-${PV} postgresql || die
160
160
161
	rm ${D}/usr/include/postgres_ext.h
161
		insinto /etc/conf.d/
162
		newins ${FILESDIR}/postgresql.conf-${PV} postgresql || die
163
164
	fi
162
}
165
}
163
166
164
pkg_postinst() {
167
pkg_postinst() {
Lines 186-225 Link Here
186
		eerror "(database directory = ${PG_DIR})."
189
		eerror "(database directory = ${PG_DIR})."
187
		exit 1
190
		exit 1
188
	else
191
	else
189
		local SEM=`sysctl -n kernel.sem | cut -f-3`
192
		if use ppc-macos; then
190
		local SEMMNI=`sysctl -n kernel.sem | cut -f4`
193
			su postgres -c "/usr/bin/initdb --pgdata ${PG_DIR}/data"
191
		local SEMMNI_MIN=`expr \( ${MAX_CONNECTIONS} + 15 \) / 16`
194
		else
192
		local SHMMAX=`sysctl -n kernel.shmmax`
195
			local SEM=`sysctl -n kernel.sem | cut -f-3`
193
		local SHMMAX_MIN=`expr 250000 + 8200 \* 1000 + 14200 \* 100`
196
			local SEMMNI=`sysctl -n kernel.sem | cut -f4`
194
197
			local SEMMNI_MIN=`expr \( ${MAX_CONNECTIONS} + 15 \) / 16`
195
		if [ ${SEMMNI} -lt ${SEMMNI_MIN} ]; then
198
			local SHMMAX=`sysctl -n kernel.shmmax`
196
			eerror "The current value of SEMMNI is too low"
199
			local SHMMAX_MIN=`expr 250000 + 8200 \* 1000 + 14200 \* 100`
197
			eerror "for postgresql to run ${MAX_CONNECTIONS} connections"
200
	
198
			eerror "Temporary setting this value to ${SEMMNI_MIN} while creating the initial database."
201
			if [ ${SEMMNI} -lt ${SEMMNI_MIN} ]; then
199
			echo ${SEM} ${SEMMNI_MIN} > /proc/sys/kernel/sem
202
				eerror "The current value of SEMMNI is too low"
200
		fi
203
				eerror "for postgresql to run ${MAX_CONNECTIONS} connections"
201
		su postgres -c "/usr/bin/initdb --pgdata ${PG_DIR}/data"
204
				eerror "Temporary setting this value to ${SEMMNI_MIN} while creating the initial database."
202
205
				echo ${SEM} ${SEMMNI_MIN} > /proc/sys/kernel/sem
203
		if [ ! `sysctl -n kernel.sem | cut -f4` -eq ${SEMMNI} ] ; then
206
			fi
204
			echo ${SEM} ${SEMMNI} > /proc/sys/kernel/sem
207
			su postgres -c "/usr/bin/initdb --pgdata ${PG_DIR}/data"
205
			ewarn "Restoring the SEMMNI value to the previous value"
208
	
206
			ewarn "Please edit the last value of kernel.sem in /etc/sysctl.conf"
209
			if [ ! `sysctl -n kernel.sem | cut -f4` -eq ${SEMMNI} ] ; then
207
			ewarn "and set it to at least ${SEMMNI_MIN}"
210
				echo ${SEM} ${SEMMNI} > /proc/sys/kernel/sem
208
			ewarn ""
211
				ewarn "Restoring the SEMMNI value to the previous value"
209
			ewarn "  kernel.sem = ${SEM} ${SEMMNI_MIN}"
212
				ewarn "Please edit the last value of kernel.sem in /etc/sysctl.conf"
210
			ewarn ""
213
				ewarn "and set it to at least ${SEMMNI_MIN}"
211
		fi
214
				ewarn ""
212
215
				ewarn "  kernel.sem = ${SEM} ${SEMMNI_MIN}"
213
		if [ ${SHMMAX} -lt ${SHMMAX_MIN} ]; then
216
				ewarn ""
214
			eerror "The current value of SHMMAX is too low for postgresql to run."
217
			fi
215
			eerror "Please edit /etc/sysctl.conf and set this value to at least ${SHMMAX_MIN}."
218
	
216
			eerror ""
219
			if [ ${SHMMAX} -lt ${SHMMAX_MIN} ]; then
217
			eerror "  kernel.shmmax = ${SHMMAX_MIN}"
220
				eerror "The current value of SHMMAX is too low for postgresql to run."
218
			eerror ""
221
				eerror "Please edit /etc/sysctl.conf and set this value to at least ${SHMMAX_MIN}."
219
222
				eerror ""
223
				eerror "  kernel.shmmax = ${SHMMAX_MIN}"
224
				eerror ""
225
	
226
			fi
227
			einfo ""
228
			einfo "You can use /etc/init.d/postgresql script to run PostgreSQL instead of pg_ctl."
229
			einfo ""
220
		fi
230
		fi
221
		einfo ""
222
		einfo "You can use /etc/init.d/postgresql script to run PostgreSQL instead of pg_ctl."
223
		einfo ""
224
	fi
231
	fi
225
}
232
}

Return to bug 112359