app-admin/metalog: Bump EAPI 6, Gentoo-Bug 618572
[gentoo.git] / app-admin / metalog / metalog-3-r1.ebuild
1 # Copyright 1999-2014 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI="3"
5 inherit eutils systemd
6
7 DESCRIPTION="A highly configurable replacement for syslogd/klogd"
8 HOMEPAGE="http://metalog.sourceforge.net/"
9 SRC_URI="mirror://sourceforge/${PN}/${P}.tar.xz"
10
11 LICENSE="GPL-2"
12 SLOT="0"
13 KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~sparc-fbsd ~x86-fbsd"
14 IUSE="unicode"
15
16 RDEPEND=">=dev-libs/libpcre-3.4"
17 DEPEND="${RDEPEND}
18         virtual/pkgconfig
19         app-arch/xz-utils"
20
21 src_prepare() {
22         epatch "${FILESDIR}"/${PN}-0.9-metalog-conf.patch
23 }
24
25 src_configure() {
26         econf $(use_with unicode)
27 }
28
29 src_install() {
30         emake DESTDIR="${D}" install || die "make install failed"
31         dodoc AUTHORS ChangeLog README NEWS metalog.conf
32
33         into /
34         dosbin "${FILESDIR}"/consolelog.sh || die
35
36         newinitd "${FILESDIR}"/metalog.initd metalog
37         newconfd "${FILESDIR}"/metalog.confd metalog
38         systemd_newunit "${FILESDIR}/${PN}.service-r1" "${PN}.service"
39 }
40
41 pkg_preinst() {
42         if [[ -d "${ROOT}"/etc/metalog ]] && [[ ! -e "${ROOT}"/etc/metalog.conf ]] ; then
43                 mv -f "${ROOT}"/etc/metalog/metalog.conf "${ROOT}"/etc/metalog.conf
44                 rmdir "${ROOT}"/etc/metalog
45                 export MOVED_METALOG_CONF=true
46         else
47                 export MOVED_METALOG_CONF=false
48         fi
49 }
50
51 pkg_postinst() {
52         if ${MOVED_METALOG_CONF} ; then
53                 ewarn "The default metalog.conf file has been moved"
54                 ewarn "from /etc/metalog/metalog.conf to just"
55                 ewarn "/etc/metalog.conf.  If you had a standard"
56                 ewarn "setup, the file has been moved for you."
57         fi
58 }