summaryrefslogtreecommitdiff
blob: 5a593faec6995cb38e8890c29ca9245a72ec22fc (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
47
#!/sbin/runscript
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

depend() {
	need hostid
	before fsck
}

start() {
	einfo "Starting zfs volumes..."
	zfs volinit
	eend $?
	# Enable swap on ZVOLs that have org.freebsd:swap=on.
	zfs list -H -o org.freebsd:swap,name -t volume | \
	while read state name; do
		case "${state}" in
		[oO][nN])
			einfo "Enabling swap on zvol ${name}"
			swapon /dev/zvol/${name} 
			eend $?
			;;
		esac
	done
}

stop() {
	# Disable what we had enabled before.
	zfs list -H -o org.freebsd:swap,name -t volume | \
	while read state name; do
		case "${state}" in
		[oO][nN])
			einfo "Disabling swap on zvol ${name}"
			swapoff /dev/zvol/${name}
			eend $?
			;;
		esac
	done
	einfo "Stopping zfs volumes..."
	zfs volfini
	eend $?
}

restart() {
	:
}