summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Yao <ryao@gentoo.org>2013-05-29 00:39:51 +0000
committerRichard Yao <ryao@gentoo.org>2013-05-29 00:39:51 +0000
commit7a918e364d7bd7000664ead86ef8565313e5e12f (patch)
tree166c110b2642b248f043b205dbd67155b4cb063c /sys-fs/zfs
parentIncorporate suggestions from gentoo-dev ML, thanks mgorny (diff)
downloadgentoo-2-7a918e364d7bd7000664ead86ef8565313e5e12f.tar.gz
gentoo-2-7a918e364d7bd7000664ead86ef8565313e5e12f.tar.bz2
gentoo-2-7a918e364d7bd7000664ead86ef8565313e5e12f.zip
Introduce bash-completion USE flag, fix test-suite and dracut USE flags, correct description for rootfs USE flag and improve zfs OpenRC script for systems with a ZFS rootfs.
(Portage version: 2.2.0_alpha177/cvs/Linux x86_64, signed Manifest commit with key 0xBEE84C64)
Diffstat (limited to 'sys-fs/zfs')
-rw-r--r--sys-fs/zfs/ChangeLog11
-rw-r--r--sys-fs/zfs/files/zfs-0.6.1-gentoo-openrc-dependencies.patch57
-rw-r--r--sys-fs/zfs/metadata.xml2
-rw-r--r--sys-fs/zfs/zfs-0.6.1-r1.ebuild130
4 files changed, 198 insertions, 2 deletions
diff --git a/sys-fs/zfs/ChangeLog b/sys-fs/zfs/ChangeLog
index 5d2fa64a558d..e3e7d7f1e452 100644
--- a/sys-fs/zfs/ChangeLog
+++ b/sys-fs/zfs/ChangeLog
@@ -1,6 +1,15 @@
# ChangeLog for sys-fs/zfs
# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-fs/zfs/ChangeLog,v 1.63 2013/03/28 22:19:57 ryao Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-fs/zfs/ChangeLog,v 1.64 2013/05/29 00:39:51 ryao Exp $
+
+*zfs-0.6.1-r1 (29 May 2013)
+
+ 29 May 2013; Richard Yao <ryao@gentoo.org>
+ +files/zfs-0.6.1-gentoo-openrc-dependencies.patch, +zfs-0.6.1-r1.ebuild,
+ metadata.xml:
+ Introduce bash-completion USE flag, fix test-suite and dracut USE flags,
+ correct description for rootfs USE flag and improve zfs OpenRC script for
+ systems with a ZFS rootfs.
*zfs-0.6.1 (28 Mar 2013)
diff --git a/sys-fs/zfs/files/zfs-0.6.1-gentoo-openrc-dependencies.patch b/sys-fs/zfs/files/zfs-0.6.1-gentoo-openrc-dependencies.patch
new file mode 100644
index 000000000000..e794b183eb33
--- /dev/null
+++ b/sys-fs/zfs/files/zfs-0.6.1-gentoo-openrc-dependencies.patch
@@ -0,0 +1,57 @@
+commit 75c2fb953c99bba008f1ef72ee71136002749f51
+Author: Richard Yao <ryao@cs.stonybrook.edu>
+Date: Tue May 28 20:08:15 2013 -0400
+
+ Improve OpenRC init script
+
+ The current zfs OpenRC script's dependencies cause OpenRC to attempt to
+ unmount ZFS filesystems at shutdown while things were still using them,
+ which would fail. This is a cosmetic issue, but it should still be
+ addressed. It probably does not affect systems where the rootfs is a
+ legacy filesystem, but any system with the rootfs on ZFS needs to run
+ the ZFS init script after the system is ready to shutdown filesystems.
+
+ OpenRC's shutdown process occurs in the reverse order of the startup
+ process. Therefore running the ZFS shutdown procedure after filesystems
+ are ready to be unmounted requires running the startup procedure before
+ fstab. This patch changes the dependencies of the script to expliclty
+ run before fstab at boot when the rootfs is ZFS and to run after fstab
+ at boot whenever the rootfs is not ZFS. This should cover most use
+ cases.
+
+ The only cases not covered well by this are systems with legacy
+ root filesystems where people want to configure fstab to mount a non-ZFS
+ filesystem off a zvol and possibly also systems whose pools are stored
+ on network block devices. The former requires that the ZFS script run
+ before fstab, which could cause ZFS datasets to mount too early and
+ appear under the fstab mount points. The latter requires that the ZFS
+ script run after networking starts, which precludes the ability to store
+ any system information on ZFS. An additional OpenRC script could be
+ written to handle non-root pools on network block devices, but that will
+ depend on user demand and developer time.
+
+ Signed-off-by: Richard Yao <ryao@cs.stonybrook.edu>
+
+diff --git a/etc/init.d/zfs.gentoo.in b/etc/init.d/zfs.gentoo.in
+index 5b8671e..0034e02 100644
+--- a/etc/init.d/zfs.gentoo.in
++++ b/etc/init.d/zfs.gentoo.in
+@@ -10,9 +10,16 @@ fi
+
+ depend()
+ {
++ # Try to allow people to mix and match fstab with ZFS in a way that makes sense.
++ if [ "$(mountinfo -s /)" = 'zfs' ]
++ then
++ before localmount
++ else
++ after localmount
++ fi
++
+ # bootmisc will log to /var which may be a different zfs than root.
+- before net bootmisc
+- after udev localmount
++ before bootmisc logger
+ keyword -lxc -openvz -prefix -vserver
+ }
+
diff --git a/sys-fs/zfs/metadata.xml b/sys-fs/zfs/metadata.xml
index 4b0c992ad1fd..767507ca9900 100644
--- a/sys-fs/zfs/metadata.xml
+++ b/sys-fs/zfs/metadata.xml
@@ -7,7 +7,7 @@
</maintainer>
<use>
<flag name="kernel-builtin">Disable dependency on sys-fs/zfs-kmod under the assumption that ZFS is part of the kernel source tree</flag>
- <flag name="rootfs">Install zfs-shutdown script to support exporting a pool containing rootfs</flag>
+ <flag name="rootfs">Enable dependencies required for booting off a pool containing a rootfs</flag>
<flag name="test-suite">Install regression test suite</flag>
</use>
</pkgmetadata>
diff --git a/sys-fs/zfs/zfs-0.6.1-r1.ebuild b/sys-fs/zfs/zfs-0.6.1-r1.ebuild
new file mode 100644
index 000000000000..ce837dc77d3a
--- /dev/null
+++ b/sys-fs/zfs/zfs-0.6.1-r1.ebuild
@@ -0,0 +1,130 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-fs/zfs/zfs-0.6.1-r1.ebuild,v 1.1 2013/05/29 00:39:51 ryao Exp $
+
+EAPI="4"
+
+AT_M4DIR="config"
+AUTOTOOLS_AUTORECONF="1"
+AUTOTOOLS_IN_SOURCE_BUILD="1"
+
+if [ ${PV} == "9999" ] ; then
+ inherit git-2 linux-mod
+ EGIT_REPO_URI="git://github.com/zfsonlinux/${PN}.git"
+else
+ inherit eutils versionator
+ MY_PV=$(replace_version_separator 3 '-')
+ SRC_URI="https://github.com/zfsonlinux/${PN}/archive/${PN}-${MY_PV}.tar.gz"
+ S="${WORKDIR}/${PN}-${PN}-${MY_PV}"
+ KEYWORDS="~amd64"
+fi
+
+inherit bash-completion-r1 flag-o-matic toolchain-funcs autotools-utils udev
+
+DESCRIPTION="Userland utilities for ZFS Linux kernel module"
+HOMEPAGE="http://zfsonlinux.org/"
+
+LICENSE="BSD-2 CDDL MIT"
+SLOT="0"
+IUSE="bash-completion custom-cflags kernel-builtin +rootfs test-suite static-libs"
+RESTRICT="test"
+
+COMMON_DEPEND="
+ sys-apps/util-linux[static-libs?]
+ sys-libs/zlib[static-libs(+)?]
+ virtual/awk
+"
+DEPEND="${COMMON_DEPEND}
+ virtual/pkgconfig
+"
+
+RDEPEND="${COMMON_DEPEND}
+ !=sys-apps/grep-2.13*
+ !kernel-builtin? ( =sys-fs/zfs-kmod-${PV}* )
+ !sys-fs/zfs-fuse
+ !prefix? ( virtual/udev )
+ test-suite? (
+ sys-apps/util-linux
+ sys-devel/bc
+ sys-block/parted
+ sys-fs/lsscsi
+ sys-fs/mdadm
+ sys-process/procps
+ virtual/modutils
+ )
+ rootfs? (
+ app-arch/cpio
+ app-misc/pax-utils
+ !<sys-boot/grub-2.00-r2:2
+ )
+"
+
+pkg_setup() {
+ :
+}
+
+src_prepare() {
+ if [ ${PV} != "9999" ]
+ then
+ # Fix OpenRC dependencies
+ epatch "${FILESDIR}/${P}-gentoo-openrc-dependencies.patch"
+ fi
+
+ # Update paths
+ sed -e "s|/sbin/lsmod|/bin/lsmod|" \
+ -e "s|/usr/bin/scsi-rescan|/usr/sbin/rescan-scsi-bus|" \
+ -e "s|/sbin/parted|/usr/sbin/parted|" \
+ -i scripts/common.sh.in
+
+ autotools-utils_src_prepare
+}
+
+src_configure() {
+ use custom-cflags || strip-flags
+ local myeconfargs=(
+ --bindir="${EPREFIX}/bin"
+ --sbindir="${EPREFIX}/sbin"
+ --with-config=user
+ --with-linux="${KV_DIR}"
+ --with-linux-obj="${KV_OUT_DIR}"
+ --with-udevdir="$(udev_get_udevdir)"
+ )
+ autotools-utils_src_configure
+}
+
+src_install() {
+ autotools-utils_src_install
+ gen_usr_ldscript -a uutil nvpair zpool zfs
+ rm -rf "${ED}usr/lib/dracut"
+ use test-suite || rm -rf "${ED}usr/share/zfs"
+
+ use bash-completion && newbashcomp "${FILESDIR}/bash-completion" zfs
+
+}
+
+pkg_postinst() {
+
+ if ! use kernel-builtin && [ ${PV} = "9999" ]
+ then
+ einfo "Adding ${P} to the module database to ensure that the"
+ einfo "kernel modules and userland utilities stay in sync."
+ update_moduledb
+ fi
+
+ [ -e "${EROOT}/etc/runlevels/boot/zfs" ] \
+ || ewarn 'You should add zfs to the boot runlevel.'
+
+ if [ -e "${EROOT}/etc/runlevels/shutdown/zfs-shutdown" ]
+ then
+ einfo "The zfs-shutdown script is obsolete. Removing it from runlevel."
+ rm "${EROOT}/etc/runlevels/shutdown/zfs-shutdown"
+ fi
+
+}
+
+pkg_postrm() {
+ if ! use kernel-builtin && [ ${PV} = "9999" ]
+ then
+ remove_moduledb
+ fi
+}