summaryrefslogtreecommitdiff
blob: 050169e69e0409bc1e0a35b454d2a1c32c5b990b (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
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-nds/ypserv/ypserv-2.19.ebuild,v 1.9 2009/06/20 19:07:32 vapier Exp $

DESCRIPTION="Network Information Service server"
HOMEPAGE="http://www.linux-nis.org/nis/"
SRC_URI="mirror://kernel/linux/utils/net/NIS/${P}.tar.bz2"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="amd64 ia64 ppc ppc64 sparc x86"
IUSE="slp"

DEPEND=">=sys-libs/gdbm-1.8.0
	 slp? ( net-libs/openslp )"
RDEPEND="${DEPEND}
	 || ( net-nds/rpcbind net-nds/portmap )"

src_unpack() {
	unpack ${A}
	cd "${S}"
	sed -i \
		-e '/^INSTALL_STRIP_PROGRAM/s:-s::' \
		configure || die
	sed -i \
		-e 's:INSTALL_STRIP_FLAG=-s::' \
		-e '/^INSTALL_PROGRAM/s:-s::' \
		Makefile.in */Makefile.in || die
}

src_compile() {
	econf $(use_enable slp)
	emake || die
}

src_install() {
	emake DESTDIR="${D}" install || die
	dodoc AUTHORS ChangeLog NEWS README THANKS TODO

	insinto /etc
	doins etc/ypserv.conf etc/netgroup etc/netmasks
	insinto /var/yp
	newins etc/securenets securenets.default

	newconfd "${FILESDIR}/ypserv.confd" ypserv
	newconfd "${FILESDIR}/rpc.yppasswdd.confd" rpc.yppasswdd
	newconfd "${FILESDIR}/rpc.ypxfrd.confd" rpc.ypxfrd

	newinitd "${FILESDIR}/ypserv" ypserv
	newinitd "${FILESDIR}/rpc.yppasswdd-r1" rpc.yppasswdd
	newinitd "${FILESDIR}/rpc.ypxfrd" rpc.ypxfrd

	# Save the old config into the new package as CONFIG_PROTECT
	# doesn't work for this package.
	if [ -f "${ROOT}/var/yp/Makefile" ]; then
		mv "${D}/var/yp/Makefile" "${D}/var/yp/Makefile.dist"
		cp "${ROOT}/var/yp/Makefile" "${D}/var/yp/Makefile"
		einfo "As you have a previous /var/yp/Makefile, I have added"
		einfo "this file into the new package and installed the new"
		einfo "file as /var/yp/Makefile.dist"
	fi
}

pkg_postinst() {
	einfo "To complete setup, you will need to edit /var/yp/securenets,"
	einfo "/etc/conf.d/ypserv, /etc/ypserv.conf, /etc/conf.d/rpc.yppasswdd"
	einfo "and possibly /var/yp/Makefile."

	einfo "To start the services at boot, you need to enable ypserv and optionally"
	einfo "the rpc.yppasswdd and/or rpc.ypxfrd services"
}