mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-26 11:19:32 +03:00
ba9b5428fd
As the Gentoo sys-fs/zfs maintainer, I receive license compatibility questions and at times, those questions can be harassing. I feel that the presence of the GPL in Gentoo's package metadata promotes such questions. zfs.gentoo.in is the only GPLv2 licensed file in ZFS, so I have taken the liberty of contacting all contributors to this file to request permission to relicense it. All of the contributors to this file have agreed to relicense it under the 2-clause BSD license. I have added their Signed-offs to this commit, in order of first contribution. Thank you everyone for being so understanding. Signed-off-by: devsk <devsku@gmail.com> Signed-off-by: Alexey Shvetsov <alexxy@gentoo.org> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Andrew Tselischev <andrewtselischev@gmail.com> Signed-off-by: Zachary Bedell <zac@thebedells.org> Signed-off-by: Gunnar Beutner <gunnar@beutner.name> Signed-off-by: Kyle Fuller <inbox@kylefuller.co.uk> Signed-off-by: Richard Yao <ryao@cs.stonybrook.edu> Closes #819
112 lines
2.3 KiB
Plaintext
112 lines
2.3 KiB
Plaintext
#!/sbin/runscript
|
|
# Copyright 1999-2011 Gentoo Foundation
|
|
# Released under the 2-clause BSD license.
|
|
# $Header: /var/cvsroot/gentoo-x86/sys-fs/zfs/files/zfs,v 0.9 2011/04/30 10:13:43 devsk Exp $
|
|
|
|
depend()
|
|
{
|
|
# bootmisc will log to /var which may be a different zfs than root.
|
|
before net bootmisc
|
|
after udev localmount
|
|
keyword -lxc -openvz -prefix -vserver
|
|
}
|
|
|
|
ZFS="@sbindir@/zfs"
|
|
ZPOOL="@sbindir@/zpool"
|
|
ZPOOL_CACHE="@sysconfdir@/zfs/zpool.cache"
|
|
ZFS_MODULE=zfs
|
|
|
|
checksystem() {
|
|
if [ ! -c /dev/zfs ]; then
|
|
einfo "Checking if ZFS modules present"
|
|
if ! modinfo zfs > /dev/null 2>&1 ; then
|
|
eerror "$ZFS_MODULE not found. Is the ZFS package installed?"
|
|
return 1
|
|
fi
|
|
fi
|
|
einfo "Checking if zfs userspace tools present"
|
|
if [ ! -x $ZPOOL ]; then
|
|
eerror "$ZPOOL binary not found."
|
|
return 1
|
|
fi
|
|
if [ ! -x $ZFS ]; then
|
|
eerror "$ZFS binary not found."
|
|
return 1
|
|
fi
|
|
return 0
|
|
}
|
|
|
|
start() {
|
|
ebegin "Starting ZFS"
|
|
checksystem || return 1
|
|
|
|
# Delay until all required block devices are present.
|
|
udevadm settle
|
|
|
|
if [ ! -c /dev/zfs ]; then
|
|
modprobe $ZFS_MODULE
|
|
rv=$?
|
|
if [ $rv -ne 0 ]; then
|
|
eerror "Failed to load the $ZFS_MODULE module, check 'dmesg|tail'."
|
|
eend $rv
|
|
return $rv
|
|
fi
|
|
fi
|
|
|
|
# Import all pools described by the cache file, and then mount
|
|
# all filesystem based on their properties.
|
|
if [ -f $ZPOOL_CACHE ]; then
|
|
einfo "Importing ZFS pools"
|
|
# as per fedora script, import can fail if all pools are already imported
|
|
# The check for $rv makes no sense...but someday, it will work right.
|
|
$ZPOOL import -c $ZPOOL_CACHE -aN 2>/dev/null || true
|
|
rv=$?
|
|
if [ $rv -ne 0 ]; then
|
|
eerror "Failed to import not-yet imported pools."
|
|
eend $rv
|
|
return $rv
|
|
fi
|
|
fi
|
|
|
|
einfo "Mounting ZFS filesystems"
|
|
$ZFS mount -a
|
|
rv=$?
|
|
if [ $rv -ne 0 ]; then
|
|
eerror "Failed to mount ZFS filesystems."
|
|
eend $rv
|
|
return $rv
|
|
fi
|
|
|
|
einfo "Exporting ZFS filesystems"
|
|
$ZFS share -a
|
|
rv=$?
|
|
if [ $rv -ne 0 ]; then
|
|
eerror "Failed to export ZFS filesystems."
|
|
eend $rv
|
|
return $rv
|
|
fi
|
|
|
|
eend 0
|
|
return 0
|
|
}
|
|
|
|
stop()
|
|
{
|
|
ebegin "Unmounting ZFS filesystems"
|
|
$ZFS umount -a
|
|
rv=$?
|
|
if [ $rv -ne 0 ]; then
|
|
einfo "Some ZFS filesystems not unmounted"
|
|
fi
|
|
|
|
# Don't fail if we couldn't umount everything. /usr might be in use.
|
|
eend 0
|
|
return 0
|
|
}
|
|
|
|
status()
|
|
{
|
|
# show pool status and list
|
|
$ZPOOL status && echo && $ZPOOL list
|
|
}
|