comparison sbin/fjail @ 161:57b9b899bf77

Provide functions that will be the base for "/var/empty" handling (manipulate the "readonly" property when doing some special operations)
author Franz Glasner <fzglas.hg@dom66.de>
date Wed, 20 Nov 2019 09:11:48 +0100
parents 3f9cae8f5862
children 9bd38c55a75c
comparison
equal deleted inserted replaced
160:e9dfaa9431a3 161:57b9b899bf77
62 ' 62 '
63 63
64 64
65 # Reset to standard umask 65 # Reset to standard umask
66 umask 0022 66 umask 0022
67
68
69 _get_dataset_for_mountpoint() {
70 : 'Use `zfs mount` to determine the ZFS dataset for a given mountpoint.
71
72 '
73 local _mountpoint
74 local _ds _mount
75
76 _mountpoint="$1"
77
78 while read -r _ds _mount; do
79 if [ "$_mount" = "$_mountpoint" ]; then
80 echo $_ds
81 return 0
82 fi
83 done <<EOF__GDSFM
84 $(zfs mount)
85 EOF__GDSFM
86 return 1
87 }
88
89
90 _get_dataset_for_varempty() {
91 : 'Allow special handling for <mountpoint>/var/empty which may be
92 mounted read-only.
93
94 '
95 local _mountpoint
96 local _ve_mount
97
98 _mountpoint="$1"
99
100 if [ "$_mountpoint" = '/' ]; then
101 _ve_mount='/var/empty'
102 else
103 _ve_mount="${_mountpoint}/var/empty"
104 fi
105
106 _get_dataset_for_mountpoint "${_ve_mount}"
107 }
67 108
68 109
69 # 110 #
70 # "datasets" -- create the ZFS dataset tree 111 # "datasets" -- create the ZFS dataset tree
71 # 112 #