2014-10-06 15:08:33 +04:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
_do_zpool_export() {
|
|
|
|
local ret=0
|
|
|
|
local final=$1
|
|
|
|
local force
|
2015-02-07 13:34:22 +03:00
|
|
|
local OLDIFS="$IFS"
|
|
|
|
local NEWLINE="
|
|
|
|
"
|
2014-10-06 15:08:33 +04:00
|
|
|
|
|
|
|
if [ "x$final" != "x" ]; then
|
|
|
|
force="-f"
|
|
|
|
fi
|
|
|
|
|
|
|
|
info "Exporting ZFS storage pools"
|
2015-02-07 13:34:22 +03:00
|
|
|
# Change IFS to allow for blanks in pool names.
|
|
|
|
IFS="$NEWLINE"
|
2015-02-04 12:45:19 +03:00
|
|
|
for fs in `zpool list -H -o name` ; do
|
2014-10-06 15:08:33 +04:00
|
|
|
zpool export $force "$fs" || ret=$?
|
|
|
|
done
|
2015-02-07 13:34:22 +03:00
|
|
|
IFS="$OLDIFS"
|
2014-10-06 15:08:33 +04:00
|
|
|
|
|
|
|
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
|