diff sbin/fjail @ 444:84e43d1bd128

Move "_get_dataset_for_mountpoint()" and "_get_dataset_for_varempty()" into common.subr
author Franz Glasner <fzglas.hg@dom66.de>
date Mon, 06 May 2024 09:14:41 +0200
parents 9c3b1966ba91
children 0159c8453fa2
line wrap: on
line diff
--- a/sbin/fjail	Fri May 03 09:41:38 2024 +0200
+++ b/sbin/fjail	Mon May 06 09:14:41 2024 +0200
@@ -95,50 +95,12 @@
 '
 
 
-# Reset to standard umask
-umask 0022
+_p_datadir="$(dirname "$0")"/../share/local-bsdtools
+. "${_p_datadir}/common.subr"
 
 
-_get_dataset_for_mountpoint() {
-    : 'Use `mount -t zfs -p` to determine the ZFS dataset for a given mountpoint.
-
-    '
-    local _mountpoint
-    local _ds _mount _rest
-
-    _mountpoint="$1"
-
-    mount -t zfs -p \
-    | {
-        while IFS=' '$'\t' read -r _ds _mount _rest ; do
-            if [ "$_mount" = "$_mountpoint" ]; then
-                echo "${_ds}"
-                return 0
-            fi
-        done
-        return 1
-    }
-}
-
-
-_get_dataset_for_varempty() {
-    : 'Allow special handling for <mountpoint>/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}"
-}
+# Reset to standard umask
+umask 0022
 
 
 #: