kde-apps/ktp-auth-handler: arm64 stable
[gentoo.git] / sys-cluster / sanlock / sanlock-3.6.0.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 PYTHON_COMPAT=( python2_7 python3_{5,6} )
7 inherit linux-info python-r1 systemd user
8
9 DESCRIPTION="shared storage lock manager"
10 HOMEPAGE="https://pagure.io/sanlock"
11 SRC_URI="https://releases.pagure.org/${PN}/${P}.tar.gz"
12
13 LICENSE="LGPL-2+ GPL-2 GPL-2+"
14 SLOT="0"
15 KEYWORDS="alpha amd64 arm arm64 hppa ia64 ~mips ppc ppc64 s390 sh sparc x86"
16 IUSE="python"
17
18 REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
19
20 DEPEND="
21         dev-libs/libaio
22         sys-apps/util-linux
23         python? ( ${PYTHON_DEPS} )
24 "
25 RDEPEND="${DEPEND}"
26
27 pkg_setup() {
28         local warning="You need to have CONFIG_SOFT_WATCHDOG enabled in your kernel for wdmd"
29         if linux_config_exists; then
30                 if ! linux_chkconfig_present SOFT_WATCHDOG; then
31                         ewarn ""
32                         ewarn "$warning"
33                         ewarn ""
34                 fi
35         else
36                 ewarn ""
37                 ewarn "Could not be checked automatically: $warning"
38                 ewarn ""
39         fi
40 }
41
42 pkg_preinst() {
43         enewgroup sanlock
44         enewuser sanlock -1 -1 -1 sanlock,disk
45
46 }
47
48 src_compile() {
49         for d in wdmd src fence_sanlock reset; do
50                 cd $d; emake; cd ..
51         done
52         if use python; then
53                 cd python; python_foreach_impl emake; cd ..
54         fi
55 }
56
57 src_install() {
58         for d in wdmd src fence_sanlock reset; do
59                 cd $d; emake DESTDIR="${D}" LIBDIR="${EROOT}usr/$(get_libdir)" install; cd ..
60         done
61         if use python; then
62                 cd python; python_foreach_impl emake DESTDIR="${D}" install; cd ..
63         fi
64
65         # config
66         dodir /etc/wdmd.d
67         dodir /etc/sanlock
68         insinto /etc/sanlock
69         doins src/sanlock.conf
70
71         # init
72         newconfd init.d/sanlock.sysconfig sanlock
73         newconfd init.d/wdmd.sysconfig wdmd
74         newinitd "${FILESDIR}"/sanlock.initd sanlock
75         newinitd "${FILESDIR}"/wdmd.initd wdmd
76         #doinitd ${FILESDIR}/sanlk-resetd.initd
77         #doinitd ${FILESDIR}/fence_sanlockd.initd
78
79         # systemd
80         systemd_newunit init.d/sanlock.service.native sanlock.service
81         sed -i 's,^ExecStartPre=,#ExecStartPre=,' init.d/wdmd.service.native
82         systemd_newunit init.d/wdmd.service.native wdmd.service
83         systemd_dounit init.d/sanlk-resetd.service
84         #systemd_dounit ${FILESDIR}/fence_sanlockd.service
85 }