summaryrefslogtreecommitdiff
path: root/src/hvinfo.adb
blob: aa456a4247d2a978400fb109cc5f2faa6c64fdb3 (plain)
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
30
31
32
33
34
35
with Ada.Strings.Unbounded;
with Ada.Text_IO.Unbounded_IO; use Ada.Text_IO.Unbounded_IO;
with Ada.Command_Line; use Ada.Command_Line;

with Hypervisor_Check; use Hypervisor_Check;

procedure HVInfo is
    package US renames Ada.Strings.Unbounded;
    CPUID_HV_Name, SMBIOS_HV_Name, Hypervisor_Name : US.Unbounded_String;
begin
    CPUID_HV_Name := US.To_Unbounded_String ("");
    SMBIOS_HV_Name := US.To_Unbounded_String ("");

    if Hypervisor_Present then
        CPUID_HV_Name := Get_Vendor_Name;
    end if;

    SMBIOS_HV_Name := Get_DMI_Vendor_Name;

    declare
        use US;
    begin
        if (CPUID_HV_Name = "") and (SMBIOS_HV_Name = "") then
            Set_Exit_Status (1);
        elsif (CPUID_HV_Name /= "") then
            Set_Exit_Status (0);
            UIO.Put_Line (CPUID_HV_Name);
        else
            Set_Exit_Status (0);
            UIO.Put_Line (SMBIOS_HV_Name); 
        end if;
    end;

end HVInfo;