summaryrefslogtreecommitdiff
blob: e70eece0722eaaad8965b3ba9624c2244966d234 (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
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-process/daemontools-scripts/daemontools-scripts-1.0.3.ebuild,v 1.2 2006/07/31 07:38:16 kaiowas Exp $

inherit eutils flag-o-matic toolchain-funcs

DESCRIPTION="gentoo specific daemontools wrapper scripts"
HOMEPAGE="http://dev.gentoo.org/~kaiowas/"
SRC_URI="mirror://gentoo/${P}.tar.bz2"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="alpha amd64 arm hppa ia64 mips ppc ppc64 sparc x86"
IUSE="static selinux withsamplescripts"

RDEPEND="selinux? ( sys-apps/policycoreutils )"
DEPEND=""

src_compile() {
	use static && append-ldflags -static

	make -C ${S}/src CC="$(tc-getCC)" LD="$(tc-getCC) ${LDFLAGS}" \
		CFLAGS="${CFLAGS}" || die
}

pkg_setup() {

	use withsamplescripts && ( echo "${CONFIG_PROTECT}" | grep '/var/service' >/dev/null || \
		if [ -d /var/service ]; then
			ewarn ""
			ewarn "PLEASE NOTE: You are currently using /var/service for"
			ewarn "some daemontools services."
			ewarn "In order to avoid damages to your system, please run"
			ewarn ""
			ewarn "echo 'CONFIG_PROTECT=\"/var/service\"' > /etc/env.d/51svcinit"
			ewarn "env-update"
			ewarn "source /etc/profile"
			ewarn ""
			epause 15
		fi
	)

}

src_install() {
	into /
	doenvd etc/env.d/50svcinit
	dosbin sbin/* || die
	dosbin src/svcinit || die

	# usage() script
	exeinto /lib/rcscripts/sh
	doexe lib/rcscripts/sh/* || die

	if use withsamplescripts ; then

		# fill up /var/service/*
		keepdir /var/service

		cd "${S}"/var/service

		services=`find ./ -type d`
		for service in ${services}; do
			dodir /var/service/${item}
		done

		files=`find ./ -type f`
		for file in ${files}; do
			path=`dirname ${file}`
			exeinto /var/service/${path}
			doexe ${file}
		done
	fi
}