File: 37-do-not-run-if-not-in-vm.patch

package info (click to toggle)
virtualbox 7.2.2-dfsg-2
  • links: PTS, VCS
  • area: contrib
  • in suites: sid
  • size: 616,072 kB
  • sloc: cpp: 2,377,613; ansic: 2,351,258; asm: 379,359; python: 233,965; xml: 89,678; sh: 25,697; makefile: 8,169; perl: 5,697; java: 5,337; cs: 4,872; pascal: 1,785; javascript: 1,692; objc: 1,131; lex: 931; sed: 921; php: 906; yacc: 707
file content (29 lines) | stat: -rw-r--r-- 944 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Description: Check if we are running in a virtual machine before wasting time
running virtualbox guest things
Author: Kevin Puetz (puetzk)

Origin: https://bugs.launchpad.net/ubuntu/+source/virtualbox/+bug/1762491/comments/9
Last-Update: 2018-07-19

Index: virtualbox/src/VBox/Additions/x11/Installer/98vboxadd-xclient
===================================================================
--- virtualbox.orig/src/VBox/Additions/x11/Installer/98vboxadd-xclient
+++ virtualbox/src/VBox/Additions/x11/Installer/98vboxadd-xclient
@@ -25,6 +25,17 @@
 # SPDX-License-Identifier: GPL-3.0-only
 #
 
+in_virtual_machine()
+{
+	if [ -z "$(lspci -d 80ee:cafe)" ]; then
+	echo "VirtualBox Additions disabled, not in a Virtual Machine" >&2
+	return 1
+	fi
+
+	return 0
+}
+in_virtual_machine || return
+
 # Sanity check: if non-writeable PID-files are present in the user home
 # directory VBoxClient will fail to start.
 for i in $HOME/.vboxclient-*.pid; do