summaryrefslogtreecommitdiffstats
path: root/perl-install/detect_devices.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/detect_devices.pm')
-rw-r--r--perl-install/detect_devices.pm50
1 files changed, 31 insertions, 19 deletions
diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm
index b46fef8d2..09911714e 100644
--- a/perl-install/detect_devices.pm
+++ b/perl-install/detect_devices.pm
@@ -1416,17 +1416,6 @@ sub isServer() {
|| (any { $_->{'model name'} =~ /(Xeon|Opteron)/i } getCPUs());
}
-=item isHyperv()
-
-Are we running under Hyper-V hypervisor?
-
-=cut
-
-sub isHyperv() {
- dmidecode_category('System')->{Manufacturer} =~ /Microsoft Corporation/i
- && dmidecode_category('System')->{'Product Name'} =~ /Virtual Machine/i;
-}
-
sub BIGMEM() {
arch() !~ /x86_64/ && $> == 0 && dmi_detect_memory() > 4 * 1024;
}
@@ -1471,6 +1460,27 @@ sub is_xbox() {
any { $_->{vendor} == 0x10de && $_->{id} == 0x02a5 } pci_probe();
}
+=item virt_technology()
+
+Returns the virtualization technology (eg: kvm, oracle, ...)
+
+=cut
+
+sub virt_technology() {
+ state $tech;
+ $tech ||= chomp_(run_program::get_stdout('systemd-detect-virt'));
+}
+
+=item isHyperv()
+
+Are we running under Hyper-V hypervisor?
+
+=cut
+
+sub isHyperv() {
+ virt_technology() eq 'microsoft';
+}
+
=item is_virtualbox()
Are we running under VirtualBox hypervisor?
@@ -1478,7 +1488,7 @@ Are we running under VirtualBox hypervisor?
=cut
sub is_virtualbox() {
- any { $_->{driver} eq 'vboxadd' } detect_devices::pci_probe();
+ virt_technology() eq 'oracle';
}
=item is_vmware()
@@ -1488,7 +1498,7 @@ Are we running under VMware hypervisor?
=cut
sub is_vmware() {
- any { $_->{driver} =~ /Card:VMware/ } detect_devices::pci_probe();
+ virt_technology() eq 'vmware';
}
=item is_netbook_nettop()
@@ -1542,14 +1552,16 @@ Returns a hash of flags (laptop, hyperv, touchpad, 64bit, wireless, ...)
sub matching_types() {
+{
- mips_lemote => is_mips_lemote(),
+ '64bit' => to_bool(arch() =~ /64/),
+ hyperv => isHyperv(),
+ laptop => isLaptop(),
mips_ict => is_mips_ict(),
+ mips_lemote => is_mips_lemote(),
mips_st_ls2f => is_mips_st_ls2f(),
- laptop => isLaptop(),
- hyperv => isHyperv(),
- 'numpad' => hasNumpad(),
- 'touchpad' => hasTouchpad(),
- '64bit' => to_bool(arch() =~ /64/),
+ numpa => hasNumpad(),
+ touchpad => hasTouchpad(),
+ virtualbox => is_virtualbox(),
+ vmware => is_vmware(),
wireless => to_bool(get_wireless_interface() || probe_category('network/wireless')),
};
}