Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Mar 2021 18:43:43 GMT
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 1b2802ed4ed0 - stable/13 - Use compat.linux.emul_path instead of hardcoded path in /etc/rc.d/linux
Message-ID:  <202103021843.122IhhSV018761@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by trasz:

URL: https://cgit.FreeBSD.org/src/commit/?id=1b2802ed4ed09746d6870080f85d79a9ccd782b0

commit 1b2802ed4ed09746d6870080f85d79a9ccd782b0
Author:     Edward Tomasz Napierala <trasz@FreeBSD.org>
AuthorDate: 2021-02-02 14:40:38 +0000
Commit:     Edward Tomasz Napierala <trasz@FreeBSD.org>
CommitDate: 2021-03-02 18:43:26 +0000

    Use compat.linux.emul_path instead of hardcoded path in /etc/rc.d/linux
    
    In /etc/rc.d/linux the mounting paths of procfs, sysfs and devfs
    are hardcoded to "/compat/linux".  Switching to the content of
    compat.linux.emul_path sysctl would allow to switch linuxulator
    to different place.
    
    Submitted by:   freebsdnewbie_freenet.de
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D27807
    
    (cherry picked from commit e40787f900f3c262d5134d342e5a16757dd2193c)
---
 libexec/rc/rc.d/linux | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libexec/rc/rc.d/linux b/libexec/rc/rc.d/linux
index 4fe9cee6e751..4381b62cc660 100755
--- a/libexec/rc/rc.d/linux
+++ b/libexec/rc/rc.d/linux
@@ -18,6 +18,7 @@ stop_cmd=":"
 linux_start()
 {
 	local _emul_path _tmpdir
+	_emul_path="$(sysctl -n compat.linux.emul_path)"
 
 	load_kld -e 'linux(aout|elf)' linux
 	case `sysctl -n hw.machine_arch` in
@@ -25,11 +26,11 @@ linux_start()
 		load_kld -e 'linux64elf' linux64
 		;;
 	esac
-	if [ -x /compat/linux/sbin/ldconfigDisabled ]; then
+	if [ -x ${_emul_path}/sbin/ldconfigDisabled ]; then
 		_tmpdir=`mktemp -d -t linux-ldconfig`
-		/compat/linux/sbin/ldconfig -C ${_tmpdir}/ld.so.cache
-		if ! cmp -s ${_tmpdir}/ld.so.cache /compat/linux/etc/ld.so.cache; then
-			cat ${_tmpdir}/ld.so.cache > /compat/linux/etc/ld.so.cache
+		${_emul_path}/sbin/ldconfig -C ${_tmpdir}/ld.so.cache
+		if ! cmp -s ${_tmpdir}/ld.so.cache ${_emul_path}/etc/ld.so.cache; then
+			cat ${_tmpdir}/ld.so.cache > ${_emul_path}/etc/ld.so.cache
 		fi
 		rm -rf ${_tmpdir}
 	fi
@@ -47,7 +48,6 @@ linux_start()
 	fi
 
 	if checkyesno linux_mounts_enable; then 
-		_emul_path="/compat/linux"
 		mount -o nocover -t linprocfs linprocfs "${_emul_path}/proc"
 		mount -o nocover -t linsysfs linsysfs "${_emul_path}/sys"
 		mount -o nocover -t devfs devfs "${_emul_path}/dev"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202103021843.122IhhSV018761>