summaryrefslogtreecommitdiff
blob: 0c255c42d271e8a0beb4ff971b20e7f8d31f509b (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
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit prefix

if [[ ${PV} = 9999* ]]; then
	inherit git-r3
	EGIT_REPO_URI="https://github.com/openrc/${PN}"
else
	SRC_URI="https://github.com/openrc/${PN}/archive/${PV}.tar.gz ->
		${P}.tar.gz"
	KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x64-solaris"
fi

DESCRIPTION="A standalone utility to process systemd-style tmpfiles.d files"
HOMEPAGE="https://github.com/openrc/opentmpfiles"

LICENSE="BSD-2"
SLOT="0"
IUSE="selinux"

RDEPEND="
	!<sys-apps/openrc-0.23
	selinux? ( sec-policy/selinux-base-policy )"

src_prepare() {
	default
	hprefixify tmpfiles
}

src_install() {
	emake DESTDIR="${ED}" install
	einstalldocs

	cd openrc || die
	local f
	for f in opentmpfiles-dev opentmpfiles-setup; do
		newconfd ${f}.confd ${f}
		newinitd ${f}.initd ${f}
	done
}

pkg_postinst() {
	add_service() {
		local initd=$1
		local runlevel=$2

		elog "Auto-adding '${initd}' service to your ${runlevel} runlevel"
		mkdir -p "${EROOT}"/etc/runlevels/${runlevel}
		ln -snf /etc/init.d/${initd} "${EROOT}"/etc/runlevels/${runlevel}/${initd}
	}

	if [[ -z $REPLACING_VERSIONS ]]; then
		add_service opentmpfiles-dev sysinit
		add_service opentmpfiles-setup boot
	fi
}