summaryrefslogtreecommitdiff
blob: 8347767ca5340b23e2c112ad56741fe519aa35c9 (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
60
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit flag-o-matic systemd toolchain-funcs tmpfiles readme.gentoo-r1

DESCRIPTION="Provides a caching directory on an already mounted filesystem"
HOMEPAGE="https://people.redhat.com/~dhowells/fscache/"
SRC_URI="https://people.redhat.com/~dhowells/fscache/${P}.tar.bz2"

SLOT="0"
LICENSE="GPL-2+"
KEYWORDS="amd64 ~riscv x86"
IUSE="doc selinux"

RDEPEND="selinux? ( sec-policy/selinux-cachefilesd )"

PATCHES=(
	"${FILESDIR}"/${PN}-0.10.9-makefile.patch
)

src_prepare() {
	default
	if ! use selinux; then
		sed -e '/^secctx/s:^:#:g' -i cachefilesd.conf || die
	fi

	tc-export CC
	append-flags -fpie
}

src_install() {
	default

	readme.gentoo_create_doc

	if use selinux; then
		dodoc -r selinux
		docompress -x /usr/share/doc/${PF}/selinux
	fi

	dodoc howto.txt

	newconfd "${FILESDIR}"/${PN}.conf ${PN}
	newinitd "${FILESDIR}"/${PN}-3.init ${PN}

	sed -i 's@ExecStart=/usr@ExecStart=@' ${PN}.service || die "failed to fix path"
	systemd_dounit ${PN}.service
	newtmpfiles "${FILESDIR}"/${PN}-tmpfiles.d ${PN}.conf
}

pkg_postinst() {
	tmpfiles_process ${PN}.conf

	if [[ ! -d /var/cache/fscache ]]; then
		FORCE_PRINT_ELOG=1
	fi
	readme.gentoo_print_elog
}