summaryrefslogtreecommitdiff
path: root/sys-fs
diff options
context:
space:
mode:
authorMike Gilbert <floppym@gentoo.org>2012-04-22 06:07:32 +0000
committerMike Gilbert <floppym@gentoo.org>2012-04-22 06:07:32 +0000
commit4ea91c642a0e0afcff9dfbbe3af0436ed76a6cda (patch)
tree4b8376cc55f4f7ccdcffa832fbc2198abe7f1892 /sys-fs
parent[dev-util/catalyst] Bump catalyst to the 2.0.8 revision. (diff)
downloadhistorical-4ea91c642a0e0afcff9dfbbe3af0436ed76a6cda.tar.gz
historical-4ea91c642a0e0afcff9dfbbe3af0436ed76a6cda.tar.bz2
historical-4ea91c642a0e0afcff9dfbbe3af0436ed76a6cda.zip
Add zfs-shutdown init script and linuxrc helper script; Introduce rootfs USE flag; Fix issue with sys-libs/zlib[static-libs] on Gentoo stable. Patch by Richard Yao.
Package-Manager: portage-2.2.0_alpha100/cvs/Linux x86_64
Diffstat (limited to 'sys-fs')
-rw-r--r--sys-fs/zfs/ChangeLog8
-rw-r--r--sys-fs/zfs/Manifest14
-rw-r--r--sys-fs/zfs/files/linuxrc18
-rw-r--r--sys-fs/zfs/files/zfs-shutdown57
-rw-r--r--sys-fs/zfs/metadata.xml1
-rw-r--r--sys-fs/zfs/zfs-9999.ebuild38
6 files changed, 121 insertions, 15 deletions
diff --git a/sys-fs/zfs/ChangeLog b/sys-fs/zfs/ChangeLog
index 57eb0a422960..05a898763dfe 100644
--- a/sys-fs/zfs/ChangeLog
+++ b/sys-fs/zfs/ChangeLog
@@ -1,6 +1,12 @@
# ChangeLog for sys-fs/zfs
# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-fs/zfs/ChangeLog,v 1.18 2012/04/21 17:54:52 floppym Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-fs/zfs/ChangeLog,v 1.19 2012/04/22 06:07:32 floppym Exp $
+
+ 22 Apr 2012; Mike Gilbert <floppym@gentoo.org> +files/linuxrc,
+ +files/zfs-shutdown, metadata.xml, zfs-9999.ebuild:
+ Add zfs-shutdown init script and linuxrc helper script; Introduce rootfs USE
+ flag; Fix issue with sys-libs/zlib[static-libs] on Gentoo stable. Patch by
+ Richard Yao.
21 Apr 2012; Mike Gilbert <floppym@gentoo.org> zfs-9999.ebuild:
Set AUTOTOOLS_AUTORECONF before inherit to generate proper dependencies.
diff --git a/sys-fs/zfs/Manifest b/sys-fs/zfs/Manifest
index 3e15d728dee8..453868837024 100644
--- a/sys-fs/zfs/Manifest
+++ b/sys-fs/zfs/Manifest
@@ -1,13 +1,15 @@
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
-EBUILD zfs-9999.ebuild 2248 RMD160 a9afd2b65d19a541297a677046c6d43ae89d3a1a SHA1 792726cb2cd342a5c2cee241872c8a7f7245f470 SHA256 58efed71592655be20b2c4d7875ef5c9644b778bd61f9a66fec4e887327000c8
-MISC ChangeLog 2669 RMD160 9963acacd6d27d7c09e2adcab7ca9fbfb4055f0b SHA1 e6acd60df9807513a98796a656194547835e350c SHA256 a5a7654a1674a29ffd0f57c5f5886e5aa9cc53a53255b7d06e591962c44bbf5a
-MISC metadata.xml 503 RMD160 0f641957a0be2d29856054f869954096b9c23bf8 SHA1 9b49561ee779e790583979a0d91e6a85240b7090 SHA256 8ef221ee2c2aaa8a80bc9cb53a2d9208e44e4e4af0e1585d51728272b658dcd3
+AUX linuxrc 225 RMD160 5d5471867fe8b6b93ae6391c04f23ed27dcfccbf SHA1 6e68b01e66543ad7e1f182596de6fc0aeeab2744 SHA256 69c5f407ae20a5e3000dc6389f8c75ee97e11c353489a00cb619134b103bf538
+AUX zfs-shutdown 1252 RMD160 449ba23e29486255bd04d54dfe11b77d414ba6d4 SHA1 108d271dfbe86df47f50a3219c5cf839efe4ce92 SHA256 cba63ddf086044c7e041c296ea86f68a1579ac830b8bea56b9f74b4204f96553
+EBUILD zfs-9999.ebuild 2677 RMD160 729694c9520fc75a8f263b475961866b3eda1123 SHA1 82e75b85977ff55e8cff1ed2697aba5bd6f0da98 SHA256 619722b67553cdb917697927792e6b80ab8bdc53d51d4090a6e18d11dce605d0
+MISC ChangeLog 2960 RMD160 6e49564090c578fa613be9de54755e2c7d11cbf7 SHA1 3b3c66ddbebf833e605f33e94feb4990089388b1 SHA256 37a938593f4398748c15bb78303123a5560401f507a8bfe1c7a49053c7b519a1
+MISC metadata.xml 606 RMD160 e294a556b977ddc91a0de9b668b916f2c933d1fe SHA1 11da8e90da546f6a6e0c8a9290412f2ea47f75b8 SHA256 8a90149ccbe99cf0551bb0a34e424a7cefe90409f83a44f932eb2fec21a7c24c
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (GNU/Linux)
-iF4EAREIAAYFAk+S9HIACgkQC77qH+pIQ6QjpAD/d5E2JFBrE6hGItchCBajFLG7
-dd/uMlrt1/R4g7P6mjYA/01/AIhU0EP53ZhcRLoN9eAdS0vqucTa0S7zN8MZa62C
-=nJd2
+iF4EAREIAAYFAk+ToCoACgkQC77qH+pIQ6Ri9gD+PybLwyniQ7dMVcn8JnC0juZ9
+WmCAwUc4BVBrZgqPM1QA/1yHcEpLWPUriGkVu6KNKwh8SwvnCX1+j9znSjYu/JtN
+=Xkb/
-----END PGP SIGNATURE-----
diff --git a/sys-fs/zfs/files/linuxrc b/sys-fs/zfs/files/linuxrc
new file mode 100644
index 000000000000..1e63837fad04
--- /dev/null
+++ b/sys-fs/zfs/files/linuxrc
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+PATH="/usr/sbin:/usr/bin:/sbin:/bin"
+
+j=0
+for i in $(cat /movefs)
+do
+ mkdir "/${j}"
+ mount --move "${i}" "/${j}"
+ j=$(expr $j + 1)
+done
+
+zfs umount -a
+
+for i in $(zpool list -H -o name)
+do
+ zpool export "$i"
+done;
diff --git a/sys-fs/zfs/files/zfs-shutdown b/sys-fs/zfs/files/zfs-shutdown
new file mode 100644
index 000000000000..17791b67cfb1
--- /dev/null
+++ b/sys-fs/zfs/files/zfs-shutdown
@@ -0,0 +1,57 @@
+#!/sbin/runscript
+
+description="Export ZFS Root Filesystem"
+
+copy_binaries() {
+ local destdir=$1
+ shift
+ lddtree "$@" \
+ | tr ')(' '\n' \
+ | awk '/=>/{ if($3 ~ /^\//){print $3}}' \
+ | sort \
+ | uniq \
+ | cpio -p --make-directories --dereference --quiet $destdir
+
+}
+
+depend()
+{
+ need mount-ro
+ keyword -prefix -openvz -vserver -lxc
+}
+
+start()
+{
+
+ ROOTFSTYPE=$(df -TP / | awk 'NR>1{print $2}')
+ TMPDIR='/dev/pivot_root'
+ MOVEFS=$(df -TP -x zfs | awk 'NR>2{print $7}')
+
+ # Make sure that we are dealing with zfs
+ test "${ROOTFSTYPE}" = "zfs" || eerror "rootfs is not zfs" && exit
+
+ # Construct new rootfs
+ mkdir -p "${TMPDIR}"
+ mount -t tmpfs none ${TMPDIR}
+ mkdir "${TMPDIR}/oldroot" "${TMPDIR}/dev"
+ mknod -m 660 "${TMPDIR}/dev/null" c 1 3
+ mknod -m 660 "${TMPDIR}/dev/zfs" c 10 59
+
+ # Make tmpfs root filesystem
+ copy_binaries ${TMPDIR} $(which chroot sh cat mount mkdir zfs zpool)
+
+ # Make directories for temporary mounts
+ for i in $(seq $(echo "$MOVEFS" | wc -w)); do mkdir "${TMPDIR}/${i}"; done;
+
+ # Pass temporary mount information to chroot
+ echo "$MOVEFS" > "${TMPDIR}/movefs"
+
+ # Copy shutdown script
+ cp /usr/share/zfs/linuxrc "${TMPDIR}/linuxrc"
+
+ # Pivot into new root
+ cd "${TMPDIR}"
+ pivot_root . oldroot
+ exec chroot . /linuxrc
+
+}
diff --git a/sys-fs/zfs/metadata.xml b/sys-fs/zfs/metadata.xml
index 93137d2837e1..cb8f3d474b4a 100644
--- a/sys-fs/zfs/metadata.xml
+++ b/sys-fs/zfs/metadata.xml
@@ -12,6 +12,7 @@
</maintainer>
<use>
<flag name="dracut">Install dracut module</flag>
+ <flag name="rootfs">Install zfs-shutdown script to support exporting a pool containing rootfs</flag>
<flag name="test-suite">Install regression test suite</flag>
</use>
</pkgmetadata>
diff --git a/sys-fs/zfs/zfs-9999.ebuild b/sys-fs/zfs/zfs-9999.ebuild
index 4fbe3345f888..b3207ba37456 100644
--- a/sys-fs/zfs/zfs-9999.ebuild
+++ b/sys-fs/zfs/zfs-9999.ebuild
@@ -1,9 +1,12 @@
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-fs/zfs/zfs-9999.ebuild,v 1.19 2012/04/21 17:54:52 floppym Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-fs/zfs/zfs-9999.ebuild,v 1.20 2012/04/22 06:07:32 floppym Exp $
EAPI="4"
+
+AT_M4DIR="config"
AUTOTOOLS_AUTORECONF="1"
+AUTOTOOLS_IN_SOURCE_BUILD="1"
inherit flag-o-matic git-2 linux-mod toolchain-funcs autotools-utils
@@ -15,12 +18,12 @@ EGIT_REPO_URI="git://github.com/zfsonlinux/zfs.git"
LICENSE="CDDL GPL-2"
SLOT="0"
KEYWORDS=""
-IUSE="custom-cflags debug dracut test test-suite static-libs"
+IUSE="custom-cflags debug dracut +rootfs test test-suite static-libs"
DEPEND="
>=sys-kernel/spl-${PV}
sys-apps/util-linux[static-libs?]
- sys-libs/zlib[static-libs?]
+ sys-libs/zlib[static-libs(+)?]
"
RDEPEND="${DEPEND}
!sys-fs/zfs-fuse
@@ -34,14 +37,15 @@ RDEPEND="${DEPEND}
sys-process/procps
virtual/modutils
)
+ rootfs? (
+ app-arch/cpio
+ app-misc/pax-utils
+ )
"
DEPEND+="
test? ( sys-fs/mdadm )
"
-AT_M4DIR="config"
-AUTOTOOLS_IN_SOURCE_BUILD="1"
-
pkg_setup() {
CONFIG_CHECK="!DEBUG_LOCK_ALLOC
!PREEMPT
@@ -49,12 +53,10 @@ pkg_setup() {
BLK_DEV_LOOP
EFI_PARTITION
MODULES
- PREEMPT_NONE
ZLIB_DEFLATE
ZLIB_INFLATE"
kernel_is ge 2 6 26 || die "Linux 2.6.26 or newer required"
check_extra_config
- use x86 && ewarn "32-bit kernels are unsupported by ZFSOnLinux upstream. Do not file bug reports."
}
src_prepare() {
@@ -95,4 +97,24 @@ src_install() {
gen_usr_ldscript -a uutil nvpair zpool zfs
use dracut || rm -rf "${ED}usr/share/dracut"
use test-suite || rm -rf "${ED}usr/libexec"
+
+ if use rootfs
+ then
+ doinitd "${FILESDIR}/zfs-shutdown"
+ exeinto /usr/share/zfs
+ doexe "${FILESDIR}/linuxrc"
+ fi
+
+}
+
+pkg_postinst() {
+
+ use x86 && ewarn "32-bit kernels are unsupported by ZFSOnLinux upstream. Do not file bug reports."
+
+ [ -e "${EROOT}/etc/runlevels/boot/zfs" ] \
+ || ewarn 'You should add zfs to the boot runlevel.'
+
+ use rootfs && ([ -e "${EROOT}/etc/runlevels/shutdown/zfs-shutdown" ] \
+ || ewarn 'You should add zfs-shutdown to the shutdown runlevel.')
+
}