xref: /freebsd/libexec/rc/rc.d/zpool (revision a784185078e566103b7f8abffc7c0a4a1e813eb1)
174e2b24fSCy Schubert#!/bin/sh
274e2b24fSCy Schubert#
374e2b24fSCy Schubert# $FreeBSD$
474e2b24fSCy Schubert#
574e2b24fSCy Schubert
674e2b24fSCy Schubert# PROVIDE: zpool
774e2b24fSCy Schubert# REQUIRE: hostid
874e2b24fSCy Schubert# BEFORE: zvol mountcritlocal
974e2b24fSCy Schubert# KEYWORD: nojail
1074e2b24fSCy Schubert
1174e2b24fSCy Schubert. /etc/rc.subr
1274e2b24fSCy Schubert
1374e2b24fSCy Schubertname="zpool"
1474e2b24fSCy Schubertdesc="Import ZPOOLs"
1574e2b24fSCy Schubertrcvar="zfs_enable"
1674e2b24fSCy Schubertstart_cmd="zpool_start"
1774e2b24fSCy Schubertrequired_modules="zfs"
1874e2b24fSCy Schubert
1974e2b24fSCy Schubertzpool_start()
2074e2b24fSCy Schubert{
2174e2b24fSCy Schubert	local cachefile
2274e2b24fSCy Schubert
23*a7841850SCy Schubert	for cachefile in /etc/zfs/zpool.cache /boot/zfs/zpool.cache; do
2474e2b24fSCy Schubert		if [ -r $cachefile ]; then
25*a7841850SCy Schubert			zpool import -c $cachefile -a -N && break
2674e2b24fSCy Schubert		fi
2774e2b24fSCy Schubert	done
2874e2b24fSCy Schubert}
2974e2b24fSCy Schubert
3074e2b24fSCy Schubertload_rc_config $name
3174e2b24fSCy Schubertrun_rc_command "$1"
32