xref: /freebsd/libexec/rc/rc.d/zpool (revision a0b9e2e854027e6ff61fb075a1309dbc71c42b54)
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