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