summaryrefslogtreecommitdiff
path: root/sys-fs/zfs-utils/zfs-utils-2.2.7.ebuild
blob: 2ef8e142feeb794b696ebf87151579a7e437a5be (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit autotools bash-completion-r1 flag-o-matic pam toolchain-funcs udev usr-ldscript

MY_PN="zfs"
MY_P="${MY_PN}-${PV}"

DESCRIPTION="Userland utilities for ZFS Linux kernel module"
HOMEPAGE="https://zfsonlinux.org/"

SRC_URI="https://github.com/openzfs/${PN}/releases/download/${MY_P}/${MY_P}.tar.gz"
KEYWORDS="~amd64"
S="${WORKDIR}/${MY_P}"

LICENSE="BSD-2 CDDL MIT"
SLOT="0"
IUSE="debug nls pam test-suite unwind"

DEPEND="
	net-libs/libtirpc:=
	sys-apps/util-linux
	sys-libs/zlib
	virtual/libudev:=
	dev-libs/openssl:=
	pam? ( sys-libs/pam )
	unwind? ( sys-libs/libunwind:= )
"

BDEPEND="app-alternatives/awk
	virtual/pkgconfig
	nls? ( sys-devel/gettext )
"

RDEPEND="${DEPEND}
	app-alternatives/awk
	virtual/udev
	sys-fs/udev-init-scripts
	test-suite? (
		sys-apps/kmod[tools]
		sys-apps/util-linux
		sys-devel/bc
		sys-block/parted
		sys-fs/lsscsi
		sys-fs/mdadm
		sys-process/procps
	)
"

RESTRICT="test"

PATCHES=(
	"${FILESDIR}"/2.1.5-dracut-zfs-missing.patch
	"${FILESDIR}"/2.2.2-no-USER_NS.patch
)

src_prepare() {
	default

	# Run unconditionally (bug #792627)
	eautoreconf

	# Tries to use /etc/conf.d which we reserve for OpenRC
	sed -i -e '/EnvironmentFile/d' etc/systemd/system/zfs*.in || die

	# prevent errors showing up on zfs-mount stop, #647688
	# openrc will unmount all filesystems anyway.
	sed -i "/^ZFS_UNMOUNT=/ s/yes/no/" "etc/default/zfs.in" || die
}

src_configure() {
	local myconf=(
		--bindir="${EPREFIX}/bin"
		--enable-shared
		--disable-systemd
		--enable-sysvinit
		--localstatedir="${EPREFIX}/var"
		--sbindir="${EPREFIX}/sbin"
		--with-config=user
		--with-dracutdir="${EPREFIX}/usr/lib/dracut"
		--with-udevdir="$(get_udevdir)"
		--with-pamconfigsdir="${EPREFIX}/unwanted_files"
		--with-pammoduledir="$(getpam_mod_dir)"
		--with-vendor=redcore
		$(use_enable debug)
		$(use_enable nls)
		$(use_enable pam)
		$(use_with unwind libunwind)
		--disable-pyzfs
		--disable-static
	)

	econf "${myconf[@]}"
}

src_install() {
	default

	gen_usr_ldscript -a nvpair uutil zfsbootenv zfs zfs_core zpool
	dobashcomp contrib/bash_completion.d/zfs
	bashcomp_alias zfs zpool
	dodir etc/conf.d
	insinto etc/conf.d
	doins "${S}"/etc/default/zfs
	use pam && { rm -rv "${ED}/unwanted_files" || die ; }
	use test-suite || { rm -r "${ED}/usr/share/zfs" || die ; }

	# strip executable bit from conf.d file
	fperms 0644 /etc/conf.d/zfs
}