File: export-zfs.sh.in

package info (click to toggle)
zfs-linux 2.1.11-1%2Bdeb12u1
  • links: PTS, VCS
  • area: contrib
  • in suites: bookworm
  • size: 77,344 kB
  • sloc: ansic: 376,447; sh: 59,625; python: 7,872; asm: 6,476; makefile: 5,812; perl: 770; sed: 41; awk: 5
file content (28 lines) | stat: -rwxr-xr-x 457 bytes parent folder | download
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
#!/bin/sh

_do_zpool_export() {
	ret=0
	errs=""
	final="${1}"

	info "ZFS: Exporting ZFS storage pools..."
	errs=$(zpool export -aF 2>&1)
	ret=$?
	[ -z "${errs}" ] || echo "${errs}" | vwarn
	if [ "x${ret}" != "x0" ]; then
		info "ZFS: There was a problem exporting pools."
	fi

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

	return ${ret}
}

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