virtual.vmware.patch
| virtual.rb 2009-03-30 16:11:26.067664000 -0400 | ||
|---|---|---|
| 21 | 28 |
end |
| 22 | 29 | |
| 23 | 30 |
if result == "physical" |
| 24 |
lspciexists = system "which lspci > /dev/null 2>&1"
|
|
| 31 |
checkvm = system "which vmware-checkvm > /dev/null 2>&1"
|
|
| 25 | 32 |
if $?.exitstatus == 0 |
| 26 |
output = %x{lspci}
|
|
| 27 |
output.each {|p|
|
|
| 28 |
# --- look for the vmware video card to determine if it is virtual => vmware. |
|
| 29 |
# --- 00:0f.0 VGA compatible controller: VMware Inc [VMware SVGA II] PCI Display Adapter |
|
| 30 |
result = "vmware" if p =~ /VM[wW]are/ |
|
| 31 |
} |
|
| 33 |
result = "vmware" |
|
| 32 | 34 |
else |
| 33 |
dmidecodeexists = system "which dmidecode > /dev/null 2>&1"
|
|
| 35 |
lspciexists = system "which lspci > /dev/null 2>&1"
|
|
| 34 | 36 |
if $?.exitstatus == 0 |
| 35 |
outputd = %x{dmidecode}
|
|
| 36 |
outputd.each {|pd|
|
|
| 37 |
result = "vmware" if pd =~ /VMware|Parallels/ |
|
| 37 |
output = %x{lspci}
|
|
| 38 |
output.each {|p|
|
|
| 39 |
# --- look for the vmware video card to determine if it is virtual => vmware. |
|
| 40 |
# --- 00:0f.0 VGA compatible controller: VMware Inc [VMware SVGA II] PCI Display Adapter |
|
| 41 |
result = "vmware" if p =~ /VM[wW]are/ |
|
| 38 | 42 |
} |
| 43 |
else |
|
| 44 |
dmidecodeexists = system "which dmidecode > /dev/null 2>&1" |
|
| 45 |
if $?.exitstatus == 0 |
|
| 46 |
outputd = %x{dmidecode}
|
|
| 47 |
outputd.each {|pd|
|
|
| 48 |
result = "vmware" if pd =~ /VMware|Parallels/ |
|
| 49 |
} |
|
| 50 |
end |
|
| 39 | 51 |
end |
| 40 | 52 |
end |
| 41 | 53 |
end |