git: 2c92e193cc5f - main - ports-mgmt/rc-subr-jail: Bug fixes.

From: Gleb Popov <arrowd_at_FreeBSD.org>
Date: Thu, 16 Mar 2023 07:10:11 UTC
The branch main has been updated by arrowd:

URL: https://cgit.FreeBSD.org/ports/commit/?id=2c92e193cc5f7800b0f177b272edc772c10178be

commit 2c92e193cc5f7800b0f177b272edc772c10178be
Author:     Alexey Yushkin <636808@mail.ru>
AuthorDate: 2023-03-03 10:59:38 +0000
Commit:     Gleb Popov <arrowd@FreeBSD.org>
CommitDate: 2023-03-16 07:10:00 +0000

    ports-mgmt/rc-subr-jail: Bug fixes.
    
    - Fix check for "jail_mount_devfs" knob.
    - Make "jail_nullfs_mounts" handle relative paths.
    
    Co-authored-by: Alexey Donskov <voxnod@gmail.com>
---
 ports-mgmt/rc-subr-jail/files/rc.subr.jail | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/ports-mgmt/rc-subr-jail/files/rc.subr.jail b/ports-mgmt/rc-subr-jail/files/rc.subr.jail
index 7d16c34bf9ee..c40101bbe5b1 100644
--- a/ports-mgmt/rc-subr-jail/files/rc.subr.jail
+++ b/ports-mgmt/rc-subr-jail/files/rc.subr.jail
@@ -91,8 +91,8 @@ prepare_jail()
             _src=$(echo "$_mnt_line" | awk '{print $1}')
             _dst=$(echo "$_mnt_line" | awk '{print $2}')
             _opts=$(echo "$_mnt_line" | awk '{print $3}')
-            mkdir -p "$_dst"
-            mount_nullfs -o "$_opts" "$_src" "$_dst"
+            /bin/sh -c "cd \"$jroot\" && mkdir -p \"$_dst\""
+            /bin/sh -c "cd \"$jroot\" && mount_nullfs  -o \"$_opts\" \"$_src\" \"$_dst\""
         done
     fi
 
@@ -120,8 +120,8 @@ destroy_jail()
         echo "$jail_nullfs_mounts" | xargs -n 3 | while read -r _mnt_line; do
             local _dst
             _dst=$(echo "$_mnt_line" | awk '{print $2}')
-            umount "$_dst"
-            rmdir "$_dst"
+            /bin/sh -c "cd \"$jroot\" && umount \"$_dst\"" 2> /dev/null
+            /bin/sh -c "cd \"$jroot\" && rmdir \"$_dst\"" 2> /dev/null
         done
     fi