summaryrefslogtreecommitdiff
path: root/src/hvinfo.adb
blob: 0d4be3fd5d8909bbf090bb8a832c1c7eaeb9d895 (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
36
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;
    package CL renames Ada.Command_Line;
    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
            CL.Set_Exit_Status (1);
        elsif (CPUID_HV_Name /= "") then
            CL.Set_Exit_Status (0);
            UIO.Put_Line (CPUID_HV_Name);
        else
            CL.Set_Exit_Status (0);
            UIO.Put_Line (SMBIOS_HV_Name); 
        end if;
    end;

end HVInfo;