1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=( python{2_7,3_3,3_4} )
11 AUTOTOOLS_AUTORECONF="1"
12 AUTOTOOLS_IN_SOURCE_BUILD="1"
14 if [ ${PV} == "9999" ] ; then
15 inherit git-2 linux-mod
16 EGIT_REPO_URI="git://github.com/zfsonlinux/${PN}.git"
18 inherit eutils versionator
19 SRC_URI="https://github.com/zfsonlinux/${PN}/archive/${P}.tar.gz"
20 S="${WORKDIR}/${PN}-${P}"
21 KEYWORDS="~amd64 ~arm ~ppc ~ppc64"
24 inherit bash-completion-r1 flag-o-matic toolchain-funcs autotools-utils udev systemd
26 DESCRIPTION="Userland utilities for ZFS Linux kernel module"
27 HOMEPAGE="http://zfsonlinux.org/"
29 LICENSE="BSD-2 CDDL bash-completion? ( MIT )"
31 IUSE="bash-completion custom-cflags debug kernel-builtin +rootfs test-suite static-libs"
35 sys-apps/util-linux[static-libs?]
36 sys-libs/zlib[static-libs(+)?]
39 DEPEND="${COMMON_DEPEND}
43 RDEPEND="${COMMON_DEPEND}
45 !kernel-builtin? ( =sys-fs/zfs-kmod-${PV}* )
47 !prefix? ( virtual/udev )
60 !<sys-boot/grub-2.00-r2:2
62 !>=sys-fs/udev-init-scripts-28
71 sed -e "s|/sbin/lsmod|/bin/lsmod|" \
72 -e "s|/usr/bin/scsi-rescan|/usr/sbin/rescan-scsi-bus|" \
73 -e "s|/sbin/parted|/usr/sbin/parted|" \
74 -i scripts/common.sh.in
76 autotools-utils_src_prepare
80 use custom-cflags || strip-flags
82 --bindir="${EPREFIX}/bin"
83 --sbindir="${EPREFIX}/sbin"
85 --with-linux="${KV_DIR}"
86 --with-linux-obj="${KV_OUT_DIR}"
87 --with-udevdir="$(get_udevdir)"
91 autotools-utils_src_configure
93 # prepare systemd unit and helper script
94 cat "${FILESDIR}/zfs.service.in" | \
95 sed -e "s:@sbindir@:${EPREFIX}/sbin:g" \
96 -e "s:@sysconfdir@:${EPREFIX}/etc:g" \
97 > "${T}/zfs.service" || die
98 cat "${FILESDIR}/zfs-init.sh.in" | \
99 sed -e "s:@sbindir@:${EPREFIX}/sbin:g" \
100 -e "s:@sysconfdir@:${EPREFIX}/etc:g" \
101 > "${T}/zfs-init.sh" || die
105 autotools-utils_src_install
106 gen_usr_ldscript -a uutil nvpair zpool zfs zfs_core
107 rm -rf "${ED}usr/lib/dracut"
108 use test-suite || rm -rf "${ED}usr/share/zfs"
110 use bash-completion && newbashcomp "${FILESDIR}/bash-completion-r1" zfs
113 doexe "${T}/zfs-init.sh"
114 systemd_dounit "${T}/zfs.service"
115 doinitd "${FILESDIR}/zed"
120 if ! use kernel-builtin && [ ${PV} = "9999" ]
122 einfo "Adding ${P} to the module database to ensure that the"
123 einfo "kernel modules and userland utilities stay in sync."
127 if [ -e "${EROOT}etc/runlevels/boot/zfs" ]
129 einfo 'The zfs boot script has been split into the zfs-import,'
130 einfo 'zfs-mount and zfs-share scripts, with zed being added in the'
131 einfo 'form of a fourth script.'
133 einfo 'You had the zfs script in your boot runlevel. For your'
134 einfo 'convenience, it has been automatically removed and the three'
135 einfo 'scripts that replace it have been configured to start.'
136 einfo 'The zfs-import and zfs-mount scripts have been added to the boot'
137 einfo 'runlevel while the zfs-share script is in the default runlevel.'
139 rm "${EROOT}etc/runlevels/boot/zfs"
140 ln -snf "${EROOT}etc/init.d/zfs-import" \
141 "${EROOT}etc/runlevels/boot/zfs-import"
142 ln -snf "${EROOT}etc/init.d/zfs-mount" \
143 "${EROOT}etc/runlevels/boot/zfs-mount"
144 ln -snf "${EROOT}etc/init.d/zfs-share" \
145 "${EROOT}etc/runlevels/default/zfs-share"
147 [ -e "${EROOT}etc/runlevels/boot/zfs-import" ] || \
148 einfo "You should add zfs-import to the boot runlevel."
149 [ -e "${EROOT}etc/runlevels/boot/zfs-mount" ] || \
150 einfo "You should add zfs-mount to the boot runlevel."
151 [ -e "${EROOT}etc/runlevels/default/zfs-share" ] || \
152 einfo "You should add zfs-share to the default runlevel."
155 [ -e "${EROOT}etc/runlevels/default/zfs-zed" ] || \
156 einfo "You should add zfs-zed to the default runlevel."
158 if [ -e "${EROOT}etc/runlevels/shutdown/zfs-shutdown" ]
160 einfo "The zfs-shutdown script is obsolete. Removing it from runlevel."
161 rm "${EROOT}etc/runlevels/shutdown/zfs-shutdown"
167 if ! use kernel-builtin && [ ${PV} = "9999" ]