diff --git a/etc/default/zfs.in b/etc/default/zfs.in index ae813e9de..e4433277c 100644 --- a/etc/default/zfs.in +++ b/etc/default/zfs.in @@ -30,6 +30,9 @@ ZFS_SHARE='yes' # Run `zfs unshare -a` during system stop? ZFS_UNSHARE='yes' +# Run `zpool export -a` during system stop? +ZPOOL_EXPORT='yes' + # By default, a verbatim import of all pools is performed at boot based on the # contents of the default zpool cache file. The contents of the cache are # managed automatically by the 'zpool import' and 'zpool export' commands. diff --git a/etc/init.d/zfs-import.in b/etc/init.d/zfs-import.in index a9a0604f8..544621828 100755 --- a/etc/init.d/zfs-import.in +++ b/etc/init.d/zfs-import.in @@ -305,6 +305,14 @@ do_start() fi } +do_stop() +{ + if check_boolean "$ZPOOL_EXPORT" + then + zpool export -a + fi +} + # ---------------------------------------------------- if [ ! -e /sbin/openrc-run ] @@ -314,7 +322,7 @@ then do_start ;; stop) - # no-op + do_stop ;; status) do_status @@ -334,5 +342,6 @@ else # Create wrapper functions since Gentoo don't use the case part. depend() { do_depend; } start() { do_start; } + stop() { do_stop; } status() { do_status; } fi