aboutsummaryrefslogtreecommitdiffstats
path: root/dracut/90zfs/export-zfs.sh.in
blob: 6382d762aa9783f81b51ab034d887a054b1e81d1 (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
#!/bin/sh

_do_zpool_export() {
	local ret=0
	local final=$1
	local force
	local OLDIFS="$IFS"
	local NEWLINE="
"

	if [ "x$final" != "x" ]; then
		force="-f"
	fi

	info "Exporting ZFS storage pools"
	# Change IFS to allow for blanks in pool names.
	IFS="$NEWLINE"
	for fs in `zpool list -H -o name` ; do
		zpool export $force "$fs" || ret=$?
	done
	IFS="$OLDIFS"

	if [ "x$final" != "x" ]; then
		info "zpool list"
		zpool list 2>&1 | vinfo
	fi

	return $ret
}

if command -v zpool >/dev/null; then
	_do_zpool_export $1
else
	:
fi