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 26 if [ $? -ne 0 ]; then 27 echo "Import of zpool cache ${cachefile} failed," \ 28 "will retry after root mount hold release" 29 root_hold_wait 30 zpool import -c $cachefile -a -N 31 fi 32 break 33 fi 34 done 35} 36 37load_rc_config $name 38run_rc_command "$1" 39