Replace deprecated vmware-detect with virt-what/imvirt
authorMichael Prokop <mika@grml.org>
Fri, 1 Sep 2023 11:57:49 +0000 (13:57 +0200)
committerMichael Prokop <mika@grml.org>
Fri, 1 Sep 2023 11:57:49 +0000 (13:57 +0200)
As of git commit 0c1cd5d0cbee in grml-scripts we no longer ship our
vmware-detect binary, so instead rely on virt-what and imvirt.

Output of virt-what executed inside a VM on a VMware cluster is `vmware`
and `VMware ESX server` for imvirt.

Thanks: Christoph Biedl and AndrĂ¡s Korn for feedback

autoconfig.functions

index 891242e..af3a117 100755 (executable)
@@ -184,7 +184,8 @@ KVM=false
 VIRTUALBOX=false
 VMWARE=false
 
-if vmware-detect &>/dev/null; then
+if virt-what 2>/dev/null | grep -q 'vmware' || \
+  imvirt 2>/dev/null | grep -i "vmware" ; then
   VIRTUAL=true; VMWARE=true; VIRTUAL_ENV='VMware'
 fi