aboutsummaryrefslogtreecommitdiff
path: root/libexec/rc/rc.d/zpool
diff options
context:
space:
mode:
Diffstat (limited to 'libexec/rc/rc.d/zpool')
-rwxr-xr-xlibexec/rc/rc.d/zpool31
1 files changed, 31 insertions, 0 deletions
diff --git a/libexec/rc/rc.d/zpool b/libexec/rc/rc.d/zpool
new file mode 100755
index 000000000000..01028f8633ea
--- /dev/null
+++ b/libexec/rc/rc.d/zpool
@@ -0,0 +1,31 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: zpool
+# REQUIRE: hostid
+# BEFORE: zvol mountcritlocal
+# KEYWORD: nojail
+
+. /etc/rc.subr
+
+name="zpool"
+desc="Import ZPOOLs"
+rcvar="zfs_enable"
+start_cmd="zpool_start"
+required_modules="zfs"
+
+zpool_start()
+{
+ local cachefile
+
+ for cachefile in /boot/zfs/zpool.cache /etc/zfs/zpool.cache; do
+ if [ -r $cachefile ]; then
+ zpool import -c $cachefile -a -N
+ fi
+ done
+}
+
+load_rc_config $name
+run_rc_command "$1"