summaryrefslogtreecommitdiff
blob: 415ea99fc42934cbc1bbb4466ee15ba34b986e43 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/sbin/runscript
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-fs/zfs-fuse/files/zfs-fuse.rc,v 1.3 2010/06/05 23:46:32 ssuominen Exp $

depend() {
	before net
	need fuse
}

PIDFILE="/var/run/zfs/zfs-fuse.pid"
EXEFILE="/usr/sbin/zfs-fuse"

checksystem() {
	return 0 # TODO
}

start() {
	ebegin "Starting ZFS-FUSE"
	checksystem || return 1
	start-stop-daemon --start --exec ${EXEFILE} \
        	--user daemon --group disk -- --pidfile ${PIDFILE}
	rv=$?
	eend $rv

	if [[ $rv -eq 0 ]]; then
		ebegin "Mounting ZFS filesystems"
		zfs mount -a
		eend $?
	fi
}

stop() {
	ebegin "Unmounting ZFS filesystems"
	sync
	sleep 1
	zfs umount -f -a
	eend $?
	sync

	ebegin "Stopping ZFS-FUSE"
	checksystem || return 2
	start-stop-daemon --stop --pidfile ${PIDFILE} \
		--exec ${EXEFILE} --retry TERM/1/TERM/2/TERM/4/TERM/8/KILL
	eend $?
}