summaryrefslogtreecommitdiff
blob: 2dee270925ebfd840f2279e9b64082e0dc4f1c95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

inherit eutils einput versionator

IUSE="perl doc"

MY_PV=$(replace_version_separator 3 '-')
DESCRIPTION="A replication system for the PostgreSQL Database Management System"
HOMEPAGE="http://slony.info/"
SRC_URI="http://pgfoundry.org/frs/download.php/1015/${P}.tar.bz2"

LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64 ~ppc ~x86"

DEPEND="dev-db/postgresql
	perl? ( dev-perl/DBD-Pg )"

RDEPEND="dev-db/postgresql"

src_unpack() {
	unpack ${A}
}

src_compile() {
	cd ${WORKDIR}/${PN}-${MY_PV}
	local myconf=""

	myconf="${myconf} --with-pgincludedir=/usr/include/postgresql/pgsql"
	myconf="${myconf} --with-pgincludeserverdir=/usr/include/postgresql/server"
	myconf="${myconf} $(use_with perl perltools)"
	myconf="${myconf} $(use_with doc docs)"

	econf ${myconf} || die
	emake || die

	if use perl ; then
		cd ${S}/tools
		emake || die
	fi
	emake || die
	emake DESTDIR=${D} install || die
}

src_install() {
	if useq doc; then
		dodoc HISTORY-1.1 INSTALL README SAMPLE TODO UPGRADING doc/howto/*.txt
		dohtml doc/howto/*.html
	fi

	newinitd ${FILESDIR}/slony1.init slony1 || die
	newconfd ${FILESDIR}/slony1.conf slony1 || die
}

pkg_postinst() {
	einfo
	einfo "For important information regarding"
	einfo "upgrading slony1, please config this package:"
	einfo "# emerge --config 'dev-db/slony1'"
	einfo
}

pkg_config() {
	einput_add_init ${PN} "default"
	einfo
	einfo "In order to upgrade, you need to first stop"
	einfo "slon on this node"
	einfo
	if einput_confirm "Do you want to stop slony1 on this node?" "0"; then
		${ROOT}/etc/init.d/slony1 stop
	fi
	einfo
	einfo "Run the following for all nodes from a slonik script:"
	einfo "update functions (id = [whatever]);"
	einfo
	if einput_confirm "Do you want to restart slony1 on this node?" "0"; then
		${ROOT}/etc/init.d/slony1 restart
	fi
}