git: 0b49e504a32d - main - rc.d/jail: add legacy compatibility for zfs.dataset

From: Alexander Leidinger <netchild_at_FreeBSD.org>
Date: Wed, 17 Jan 2024 12:38:03 UTC
The branch main has been updated by netchild:

URL: https://cgit.FreeBSD.org/src/commit/?id=0b49e504a32d90ccd6785841bced2ca8c93a87e6

commit 0b49e504a32d90ccd6785841bced2ca8c93a87e6
Author:     Alexander Leidinger <netchild@FreeBSD.org>
AuthorDate: 2024-01-17 12:32:39 +0000
Commit:     Alexander Leidinger <netchild@FreeBSD.org>
CommitDate: 2024-01-17 12:38:00 +0000

    rc.d/jail: add legacy compatibility for zfs.dataset
    
    Evaluate the jail_${jailname}_zfs_dataset variable for legacy
    jail managers.
    
    This variable can take a space separated list of datasets.
    The singular was used specially to allow unmaintained jail
    managers like ezjail to use this (simply rename
    jail_${jailname}_zfs_datasets in the ezjail config to
    jail_${jailname}_zfs_dataset).
---
 libexec/rc/rc.d/jail | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/libexec/rc/rc.d/jail b/libexec/rc/rc.d/jail
index f12dae280bb0..e24d6f8e21e0 100755
--- a/libexec/rc/rc.d/jail
+++ b/libexec/rc/rc.d/jail
@@ -268,6 +268,13 @@ parse_options()
 		extract_var $_jv enforce_statfs enforce_statfs - 2
 		extract_var $_jv osreldate osreldate
 		extract_var $_jv osrelease osrelease
+
+		_zfs_dataset="$(eval echo \$jail_${_jv}_zfs_dataset)"
+		if [ -n "$_zfs_dataset" ]; then
+			for ds in $_zfs_dataset; do
+				echo "	zfs.dataset += ${ds};"
+			done
+		fi
 		for _p in $_parameters; do
 			echo "	${_p%\;};"
 		done