Mercurial > hgrepos > FreeBSD > ports > sysutils > local-bsdtools
comparison sbin/fjail @ 210:4d7e00b500a1
Implement a sanity and consistency check when doing "natural" mounts
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Sun, 21 Aug 2022 15:55:01 +0200 |
| parents | 1b176ccd41b9 |
| children | ee9b32ab0e9a |
comparison
equal
deleted
inserted
replaced
| 209:1b176ccd41b9 | 210:4d7e00b500a1 |
|---|---|
| 444 _relative_mp="${_mp#${_rootds_mountpoint}}" | 444 _relative_mp="${_mp#${_rootds_mountpoint}}" |
| 445 # Eventually remove a trailing slash | 445 # Eventually remove a trailing slash |
| 446 _relative_mp="${_relative_mp%/}" | 446 _relative_mp="${_relative_mp%/}" |
| 447 # The real effective full mountpoint | 447 # The real effective full mountpoint |
| 448 _real_mp="${_mountpoint}${_relative_mp}" | 448 _real_mp="${_mountpoint}${_relative_mp}" |
| 449 | |
| 450 # | |
| 451 # Consistency and sanity check: computed real mountpoint must | |
| 452 # be equal to the configured mountpoint when no custom mountpoint | |
| 453 # is given. | |
| 454 # | |
| 455 if [ "${_mount_natural}" = "yes" ]; then | |
| 456 if [ "${_real_mp}" != "${_mp}" ]; then | |
| 457 echo "ERROR: mountpoint mismatch" >&2 | |
| 458 return 1 | |
| 459 fi | |
| 460 fi | |
| 461 | |
| 449 if [ "${_dry_run}" = "yes" ]; then | 462 if [ "${_dry_run}" = "yes" ]; then |
| 450 echo "Would mount ${_name} on ${_real_mp}" | 463 echo "Would mount ${_name} on ${_real_mp}" |
| 451 else | 464 else |
| 452 mkdir -p "${_real_mp}" 1> /dev/null 2> /dev/null || \ | 465 mkdir -p "${_real_mp}" 1> /dev/null 2> /dev/null || \ |
| 453 { echo "ERROR: cannot create mountpoint ${_real_mp}" >&2; return 1; } | 466 { echo "ERROR: cannot create mountpoint ${_real_mp}" >&2; return 1; } |
