View | Details | Raw Unified | Return to bug 262650
Collapse All | Expand All

(-)b/ports-mgmt/poudriere/files/patch-src_share_poudriere_common.sh (+76 lines)
Added Link Here
1
--- src/share/poudriere/common.sh.orig	2021-08-18 18:10:31.000000000 +0000
2
+++ src/share/poudriere/common.sh	2022-03-17 03:07:39.535905000 +0000
3
@@ -277,6 +277,16 @@
4
 	fi
5
 }
6
 
7
+_sys_linuxbase() {
8
+	local default="/compat/linux"
9
+	local mib=compat.linux.emul_path
10
+	if [ -z "${NOLINUX-}" ]; then
11
+		sysctl -qn "${mib}" || echo "${default}"
12
+	else
13
+		echo "${default}"
14
+	fi
15
+}
16
+
17
 _mastermnt() {
18
 	local hashed_name mnt mnttest mnamelen testpath mastername _gsub
19
 
20
@@ -291,7 +301,7 @@
21
 	mastername="${_gsub}"
22
 	mnt="${POUDRIERE_DATA}/.m/${mastername}/ref"
23
 	if [ -z "${NOLINUX}" ]; then
24
-		testpath="/compat/linux/proc"
25
+		testpath="$(_sys_linuxbase)/proc"
26
 	else
27
 		testpath="/var/db/ports"
28
 	fi
29
@@ -1415,6 +1425,7 @@
30
 common_mtree() {
31
 	[ $# -eq 1 ] || eargs common_mtree mnt
32
 	local mnt="${1}"
33
+	local linuxbase=$(_sys_linuxbase)
34
 	local exclude nullpaths schgpaths dir
35
 
36
 	cat <<-EOF
37
@@ -1422,7 +1433,7 @@
38
 	./.p
39
 	./.poudriere-snap-*
40
 	.${HOME}/.ccache
41
-	./compat/linux/proc
42
+	./${linuxbase}/proc
43
 	./dev
44
 	./distfiles
45
 	./packages
46
@@ -1574,6 +1585,7 @@
47
 	local mnt="$2"
48
 	local name="$3"
49
 	local devfspath="null zero random urandom stdin stdout stderr fd fd/* bpf* pts pts/*"
50
+	local linuxbase=$(_sys_linuxbase)
51
 	local srcpath nullpaths nullpath p arch
52
 
53
 	# from==mnt is via jail -u
54
@@ -1582,7 +1594,7 @@
55
 	if [ ${mnt##*/} = "ref" ]; then
56
 		mkdir -p ${mnt}/proc \
57
 		    ${mnt}/dev \
58
-		    ${mnt}/compat/linux/proc \
59
+		    ${mnt}/${linuxbase}/proc \
60
 		    ${mnt}/usr/src
61
 	fi
62
 
63
@@ -1614,11 +1626,11 @@
64
 	[ "${USE_PROCFS}" = "yes" ] && \
65
 	    mount -t procfs proc "${mnt}/proc"
66
 
67
-	if [ -z "${NOLINUX}" ] && [ -d "${mnt}/compat" ]; then
68
+	if [ -z "${NOLINUX}" ] && [ -d "${mnt}/${linuxbase}" ]; then
69
 		_jget arch "${name}" arch || \
70
 		    err 1 "Missing arch metadata for jail"
71
 		[ "${arch}" = "i386" -o "${arch}" = "amd64" ] && \
72
-		    mount -t linprocfs linprocfs "${mnt}/compat/linux/proc"
73
+		    mount -t linprocfs linprocfs "${mnt}/${linuxbase}/proc"
74
 	fi
75
 
76
 	run_hook jail mount ${mnt}

Return to bug 262650