From 5dece9b25a5bdf7f5b2bb643548ef8e60cf2779a Mon Sep 17 00:00:00 2001 From: Edward Tomasz Napierala Date: Wed, 13 Nov 2019 20:27:38 +0000 Subject: [PATCH] Add 'linux_mounts_enable' rc.conf(5) variable, to make it possible to disable mounting Linux-specific filesystems under /compat/linux when 'linux_enable' is set to YES. Reviewed by: netchild, ian (earlier version) MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22320 --- libexec/rc/rc.conf | 2 ++ libexec/rc/rc.d/linux | 14 ++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/libexec/rc/rc.conf b/libexec/rc/rc.conf index e60ddda369cd..a58ed1670b53 100644 --- a/libexec/rc/rc.conf +++ b/libexec/rc/rc.conf @@ -640,6 +640,8 @@ firstboot_sentinel="/firstboot" # Scripts with "firstboot" keyword are run if # the file can be deleted after the boot completes. sysvipc_enable="NO" # Load System V IPC primitives at startup (or NO). linux_enable="NO" # Linux binary compatibility loaded at startup (or NO). +linux_mounts_enable="YES" # If linux_enable is set to YES, mount Linux-specific + # filesystems at startup. clear_tmp_enable="NO" # Clear /tmp at startup. clear_tmp_X="YES" # Clear and recreate X11-related directories in /tmp ldconfig_insecure="NO" # Set to YES to disable ldconfig security checks diff --git a/libexec/rc/rc.d/linux b/libexec/rc/rc.d/linux index 7cce3100a4c6..8bcfc946e017 100755 --- a/libexec/rc/rc.d/linux +++ b/libexec/rc/rc.d/linux @@ -46,12 +46,14 @@ linux_start() sysctl kern.elf32.fallback_brand=3 > /dev/null fi - _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" - mount -o nocover -t fdescfs fdescfs "${_emul_path}/dev/fd" - mount -o nocover,mode=1777 -t tmpfs tmpfs "${_emul_path}/dev/shm" + 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" + mount -o nocover -t fdescfs fdescfs "${_emul_path}/dev/fd" + mount -o nocover,mode=1777 -t tmpfs tmpfs "${_emul_path}/dev/shm" + fi } load_rc_config $name