]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - dracut/90zfs/export-zfs.sh.in
Fix Dracut scripts to allow for blanks in pool and dataset names
[FreeBSD/FreeBSD.git] / dracut / 90zfs / export-zfs.sh.in
1 #!/bin/sh
2
3 _do_zpool_export() {
4         local ret=0
5         local final=$1
6         local force
7         local OLDIFS="$IFS"
8         local NEWLINE="
9 "
10
11         if [ "x$final" != "x" ]; then
12                 force="-f"
13         fi
14
15         info "Exporting ZFS storage pools"
16         # Change IFS to allow for blanks in pool names.
17         IFS="$NEWLINE"
18         for fs in `zpool list -H -o name` ; do
19                 zpool export $force "$fs" || ret=$?
20         done
21         IFS="$OLDIFS"
22
23         if [ "x$final" != "x" ]; then
24                 info "zpool list"
25                 zpool list 2>&1 | vinfo
26         fi
27
28         return $ret
29 }
30
31 if command -v zpool >/dev/null; then
32         _do_zpool_export $1
33 else
34         :
35 fi