app-crypt/monkeysphere: version bump to 0.37
[portage-overlay.git] / app-crypt / ekeyd / ekeyd-1.1.5.ebuild
1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/app-crypt/ekeyd/ekeyd-1.1.4-r2.ebuild,v 1.5 2012/12/11 08:42:46 ssuominen Exp $
4
5 EAPI=4
6
7 inherit eutils multilib linux-info toolchain-funcs udev systemd
8
9 DESCRIPTION="Entropy Key userspace daemon"
10 HOMEPAGE="http://www.entropykey.co.uk/"
11 SRC_URI="http://archive.ubuntu.com/ubuntu/pool/universe/e/ekeyd/ekeyd_${PV}.orig.tar.gz"
12
13 LICENSE="MIT GPL-2" # GPL-2 (only) for init script
14 SLOT="0"
15 KEYWORDS="~amd64 ~x86"
16 IUSE="kernel_linux munin minimal"
17 REQUIRED_USE="minimal? ( !munin )"
18
19 EKEYD_RDEPEND="dev-lang/lua"
20 EKEYD_DEPEND="${EKEYD_RDEPEND}"
21 EKEYD_RDEPEND="${EKEYD_RDEPEND}
22         dev-lua/luasocket
23         kernel_linux? ( virtual/udev )
24         munin? ( net-analyzer/munin )"
25
26 RDEPEND="!minimal? ( ${EKEYD_RDEPEND} )
27         !app-crypt/ekey-egd-linux
28         sys-apps/openrc"
29 DEPEND="!minimal? ( ${EKEYD_DEPEND} )"
30
31 CONFIG_CHECK="~USB_ACM"
32
33 pkg_setup() {
34         if ! use minimal && use kernel_linux && ! use usb && linux_config_exists; then
35                 check_extra_config
36         fi
37 }
38
39 src_prepare() {
40         for i in `seq 1 6`; do
41                 epatch "${FILESDIR}/ekeyd-$i.patch";
42         done;
43 }
44
45 src_compile() {
46         local osname
47
48         # Override automatic detection: upstream provides this with uname,
49         # we don't like using uname.
50         case ${CHOST} in
51                 *-linux-*)
52                         osname=linux;;
53                 *-freebsd*)
54                         osname=freebsd;;
55                 *-kfrebsd-gnu)
56                         osname=gnukfreebsd;;
57                 *-openbsd*)
58                         osname=openbsd;;
59                 *)
60                         die "Unsupported operating system!"
61                         ;;
62         esac
63
64         # We don't slot LUA so we don't really need to have the variables
65         # set at all.
66         emake -C host \
67                 CC="$(tc-getCC)" \
68                 LUA_V= LUA_INC= \
69                 OSNAME=${osname} \
70                 OPT="${CFLAGS}" \
71                 BUILD_ULUSBD=no \
72                 $(use minimal && echo egd-linux)
73 }
74
75 src_install() {
76         exeinto /usr/libexec
77         newexe host/egd-linux   ekey-egd-linux
78         newman host/egd-linux.8 ekey-egd-linux.8
79
80         newconfd "${FILESDIR}"/ekey-egd-linux.conf.2 ekey-egd-linux
81         newinitd "${FILESDIR}"/ekey-egd-linux.init.2 ekey-egd-linux
82
83         dodoc doc/* AUTHORS ChangeLog THANKS
84
85         use minimal && return
86         # from here on, install everything that is not part of the minimal
87         # support.
88
89         emake -C host \
90                 DESTDIR="${D}" \
91                 MANZCMD=cat MANZEXT= \
92                 install-ekeyd
93
94         # We move the daemons around to avoid polluting the available
95         # commands.
96         dodir /usr/libexec
97         mv "${D}"/usr/sbin/ekey*d "${D}"/usr/libexec
98         
99         systemd_dounit "${FILESDIR}/ekeyd.service"
100
101         newinitd "${FILESDIR}"/${PN}.init.2 ${PN}
102
103         if use kernel_linux; then
104                 local rules="${FILESDIR}/90-ekeyd.rules"
105                 udev_newrules ${rules} 90-${PN}.rules
106         fi
107
108         if use munin; then
109                 exeinto /usr/libexec/munin/plugins
110                 doexe munin/ekeyd_stat_
111
112                 insinto /etc/munin/plugin-conf.d
113                 newins munin/plugin-conf.d_ekeyd ekeyd
114         fi
115 }
116
117 pkg_postinst() {
118         elog "${CATEGORY}/${PN} now install also the EGD client service ekey-egd-linux."
119         elog "To use this service, you need enable EGDTCPSocket for the ekeyd service"
120         elog "managing the key(s)."
121         elog ""
122         elog "The daemon will send more entropy to the kernel once the available pool"
123         elog "falls below the value set in the kernel.random.write_wakeup_threshold"
124         elog "sysctl entry."
125         elog ""
126         ewarn "Since version 1.1.4-r1, ekey-egd-linux will *not* set the watermark for"
127         ewarn "you, instead you'll have to configure the sysctl in /etc/sysctl.conf"
128
129         use minimal && return
130         # from here on, document everything that is not part of the minimal
131         # support.
132
133         elog ""
134         elog "To make use of your EntropyKey, make sure to execute ekey-rekey"
135         elog "the first time, and then start the ekeyd service."
136         elog ""
137         elog "By default ekeyd will feed the entropy directly to the kernel's pool;"
138         elog "if your system has jumps in load average, you might prefer using the"
139         elog "EGD compatibility mode, by enabling EGDTCPSocket for ekeyd and then"
140         elog "starting the ekey-egd-linux service."
141         elog ""
142         elog "The same applies if you intend to provide entropy for multiple hosts"
143         elog "over the network. If you want to have the ekey-egd-linux service on"
144         elog "other hosts, you can enable the 'minimal' USE flag."
145         elog ""
146         elog "The service supports multiplexing if you wish to use multiple"
147         elog "keys, just symlink /etc/init.d/ekeyd → /etc/init.d/ekeyd.identifier"
148         elog "and it'll be looking for /etc/entropykey/identifier.conf"
149         elog ""
150
151                 if use kernel_linux; then
152                         elog "Some versions of Linux have a faulty CDC ACM driver that stops"
153                         elog "EntropyKey from working properly; please check the compatibility"
154                         elog "table at http://www.entropykey.co.uk/download/"
155                 else
156                         elog "Make sure your operating system supports the CDC ACM driver"
157                         elog "or otherwise you won't be able to use the EntropyKey."
158                 fi
159                 elog ""
160                 elog "If you're unsure about the working state of the CDC ACM driver"
161                 elog "enable the usb USE flag and use the userland USB daemon"
162 }