X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;f=etc%2Finit.d%2Fzfs.gentoo;h=f709ed9e7d6bc2406fbf5e01d82e48f30e816ae7;hb=22872ff5da0d12fe393e40d3e4b3c5a58d93e360;hp=c9c5d8502c9ba4e768068d75a316e8fc13aa5d6f;hpb=6f582dc708e713f1d5e1c6871657ac726873b4bf;p=zfs.git diff --git a/etc/init.d/zfs.gentoo b/etc/init.d/zfs.gentoo index c9c5d85..f709ed9 100644 --- a/etc/init.d/zfs.gentoo +++ b/etc/init.d/zfs.gentoo @@ -5,21 +5,19 @@ depend() { - before net - after udev + # bootmisc will log to /var which may be a different zfs than root. + before net bootmisc + after udev localmount keyword -lxc -openvz -prefix -vserver } CACHEFILE=/etc/zfs/zpool.cache -ZPOOL=/usr/sbin/zpool -ZFS=/usr/sbin/zfs +ZPOOL=/sbin/zpool +ZFS=/sbin/zfs ZFS_MODULE=zfs checksystem() { - if [ -c /dev/zfs ]; then - einfo "ZFS modules already loaded" - return 0 - else + if [ ! -c /dev/zfs ]; then einfo "Checking if ZFS modules present" if [ "x$(modprobe -l $ZFS_MODULE | grep $ZFS_MODULE)" == "x" ]; then eerror "$ZFS_MODULE not found. Is the ZFS package installed?" @@ -41,6 +39,10 @@ checksystem() { 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=$? @@ -75,6 +77,15 @@ start() { 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 } @@ -85,10 +96,12 @@ stop() $ZFS umount -a rv=$? if [ $rv -ne 0 ]; then - eerror "Failed to umount ZFS filesystems." + einfo "Some ZFS filesystems not unmounted" fi - eend $rv + # Don't fail if we couldn't umount everything. /usr might be in use. + eend 0 + return 0 } status()