Mercurial > hgrepos > FreeBSD > ports > sysutils > local-bsdtools
comparison sbin/ftjail @ 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 | 071f24359eef |
| children | f6f64fd6f17b |
comparison
equal
deleted
inserted
replaced
| 443:071f24359eef | 444:84e43d1bd128 |
|---|---|
| 61 . "${_p_datadir}/common.subr" | 61 . "${_p_datadir}/common.subr" |
| 62 | 62 |
| 63 | 63 |
| 64 # Reset to standard umask | 64 # Reset to standard umask |
| 65 umask 0022 | 65 umask 0022 |
| 66 | |
| 67 | |
| 68 _get_dataset_for_mountpoint() { | |
| 69 : 'Use `mount -t zfs -p` to determine the ZFS dataset for a given mountpoint. | |
| 70 | |
| 71 ' | |
| 72 local _mountpoint | |
| 73 | |
| 74 local _ds _mount _rest | |
| 75 | |
| 76 _mountpoint="$1" | |
| 77 | |
| 78 mount -t zfs -p \ | |
| 79 | { | |
| 80 while IFS=' '$'\t' read -r _ds _mount _rest ; do | |
| 81 if [ "$_mount" = "$_mountpoint" ]; then | |
| 82 echo "${_ds}" | |
| 83 return 0 | |
| 84 fi | |
| 85 done | |
| 86 return 1 | |
| 87 } | |
| 88 } | |
| 89 | 66 |
| 90 | 67 |
| 91 #: | 68 #: |
| 92 #: Search for a running jail where it's "path" points to a given location | 69 #: Search for a running jail where it's "path" points to a given location |
| 93 #: | 70 #: |
