summaryrefslogtreecommitdiff
path: root/sys-fs/zfs-utils/files/zfs-init.sh.in
blob: ed84585cd5f686eed067fe24319943454d515fa8 (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
#!/bin/sh

ZFS="@sbindir@/zfs"
ZPOOL="@sbindir@/zpool"
ZPOOL_CACHE="@sysconfdir@/zfs/zpool.cache"

if [ -f "${ZPOOL_CACHE}" ]; then
    "${ZPOOL}" import -c "${ZPOOL_CACHE}" -aN 2>/dev/null
    if [ "${?}" != "0" ]; then
        echo "Failed to import not-yet imported pools." >&2
    fi
fi

echo "Mounting ZFS filesystems"
"${ZFS}" mount -a
if [ "${?}" != "0" ]; then
    echo "Failed to mount ZFS filesystems." >&2
    exit 1
fi

echo "Exporting ZFS filesystems"
"${ZFS}" share -a
if [ "${?}" != "0" ]; then
    echo "Failed to export ZFS filesystems." >&2
    exit 1
fi

exit 0