xref: /freebsd/libexec/rc/rc.d/zpool (revision cfd6422a5217410fbd66f7a7a8a64d9d85e61229)
1#!/bin/sh
2#
3# $FreeBSD$
4#
5
6# PROVIDE: zpool
7# REQUIRE: hostid disks
8# BEFORE: mountcritlocal
9# KEYWORD: nojail
10
11. /etc/rc.subr
12
13name="zpool"
14desc="Import ZPOOLs"
15rcvar="zfs_enable"
16start_cmd="zpool_start"
17required_modules="zfs"
18
19zpool_start()
20{
21	local cachefile
22
23	for cachefile in /etc/zfs/zpool.cache /boot/zfs/zpool.cache; do
24		if [ -r $cachefile ]; then
25			zpool import -c $cachefile -a -N && break
26		fi
27	done
28}
29
30load_rc_config $name
31run_rc_command "$1"
32