summaryrefslogtreecommitdiff
blob: 1ad5e77b2569889d6a02eed6d504d83b14f8fc9d (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
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/kuroevtd/kuroevtd-1.1.3.ebuild,v 1.2 2006/01/21 21:53:29 nerdboy Exp $

DESCRIPTION="Monitors the Kurobox and LinkStation power and reset buttons."
HOMEPAGE="http://kuro.dsk.jp/"
SRC_URI="http://kuro.dsk.jp/data/bin/${PN}_${PV}.tgz"

RESTRICT="nomirror nostrip"
LICENSE="as-is"
SLOT="0"

KEYWORDS="ppc"
IUSE=""

DEPEND="sys-apps/sed"

S=${WORKDIR}/${PN}

src_unpack() {
	unpack ${A}
	sed -i -e 's:/etc/kuroevtd:\0.d:' \
		${S}/kuroevtd.c ${S}/README
}

src_compile() {
	make kuroevtd || die "Failed to compile kuroevtd."
}

src_install() {

	dodir /usr/sbin
	dosbin kuroevtd
	dodoc README

	dodir /etc/init.d
	newinitd "${FILESDIR}/kuroevtd.initd" kuroevtd

	dodir /etc/kuroevtd.d
	exeinto /etc/kuroevtd.d
	local button evt script
	for button in power reset ; do
		for evt in up down press ; do
			script="${FILESDIR}/kuroevtd.d/${button}${evt}"
			if [ -f "${script}" ] ; then
				doexe "${script}"
			else
				echo "#!/bin/sh" > "${button}${evt}"
				doexe "${button}${evt}"
			fi
		done
	done

	dodir /var/lib/kuroevtd
	keepdir /var/lib/kuroevtd
}

pkg_postinst() {
	if [ "${ROOT}" = "/" ] \
	&& [ ! -f /etc/runlevels/boot/kuroevtd ] ; then
		rc-update add kuroevtd boot
	fi
}

pkg_postrm() {
	if [ "${ROOT}" = "/" ] \
	&& [ ! -f /usr/sbin/kuroevtd ] ; then
		rc-update del kuroevtd boot
	fi
}