# HG changeset patch # User Franz Glasner # Date 1574237508 -3600 # Node ID 57b9b899bf77e0d2436581827d151dc10990e46d # Parent e9dfaa9431a3055aa95ac07197658b752c078ac7 Provide functions that will be the base for "/var/empty" handling (manipulate the "readonly" property when doing some special operations) diff -r e9dfaa9431a3 -r 57b9b899bf77 sbin/fjail --- a/sbin/fjail Thu Nov 07 09:42:44 2019 +0100 +++ b/sbin/fjail Wed Nov 20 09:11:48 2019 +0100 @@ -66,6 +66,47 @@ umask 0022 +_get_dataset_for_mountpoint() { + : 'Use `zfs mount` to determine the ZFS dataset for a given mountpoint. + + ' + local _mountpoint + local _ds _mount + + _mountpoint="$1" + + while read -r _ds _mount; do + if [ "$_mount" = "$_mountpoint" ]; then + echo $_ds + return 0 + fi + done </var/empty which may be + mounted read-only. + + ' + local _mountpoint + local _ve_mount + + _mountpoint="$1" + + if [ "$_mountpoint" = '/' ]; then + _ve_mount='/var/empty' + else + _ve_mount="${_mountpoint}/var/empty" + fi + + _get_dataset_for_mountpoint "${_ve_mount}" +} + + # # "datasets" -- create the ZFS dataset tree #