summaryrefslogtreecommitdiffstats
path: root/etc/inc/pfsense-utils.inc
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2015-02-04 07:42:51 -0200
committerRenato Botelho <garga@FreeBSD.org>2015-02-04 07:43:06 -0200
commit7e36f71c32f11ec322abd42d12b6b3160c09a721 (patch)
treec186526d863f313a270bdb2ebad2568082c8624f /etc/inc/pfsense-utils.inc
parentd7f4c1a42def0b2db12db56c11a6d1949129122d (diff)
downloadpfsense-7e36f71c32f11ec322abd42d12b6b3160c09a721.zip
pfsense-7e36f71c32f11ec322abd42d12b6b3160c09a721.tar.gz
Silent kenv when smbios.system.product is not present. While here, add VirtualBox to the list of virtualenvs
Diffstat (limited to 'etc/inc/pfsense-utils.inc')
-rw-r--r--etc/inc/pfsense-utils.inc10
1 files changed, 7 insertions, 3 deletions
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc
index 36640aa..7fcb000 100644
--- a/etc/inc/pfsense-utils.inc
+++ b/etc/inc/pfsense-utils.inc
@@ -1630,10 +1630,14 @@ function load_thermal_hardware() {
* returns true if machine is running under a virtual environment
******/
function isvm() {
- $virtualenvs = array("vmware", "parallels", "qemu", "bochs", "plex86");
- $bios_product = trim(`/bin/kenv smbios.system.product`);
+ $virtualenvs = array("vmware", "parallels", "qemu", "bochs", "plex86", "VirtualBox");
+ $_gb = exec('/bin/kenv smbios.system.product 2>/dev/null', $output, $rc);
+
+ if ($rc != 0 || !isset($output[0]))
+ return false;
+
foreach ($virtualenvs as $virtualenv)
- if (stripos($bios_product, $virtualenv) !== false)
+ if (stripos($output[0], $virtualenv) !== false)
return true;
return false;
OpenPOWER on IntegriCloud