xref: /openbmc/qemu/qga/installer/qemu-ga.wxs (revision ddbb0d09)
1<?xml version="1.0" encoding="UTF-8"?>
2<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
3  <?ifndef env.QEMU_GA_VERSION ?>
4    <?error Environment variable QEMU_GA_VERSION undefined?>
5  <?endif?>
6
7  <?ifndef env.QEMU_GA_DISTRO ?>
8    <?error Environment variable QEMU_GA_DISTRO undefined?>
9  <?endif?>
10
11  <?ifndef env.QEMU_GA_MANUFACTURER ?>
12    <?error Environment variable QEMU_GA_MANUFACTURER undefined?>
13  <?endif?>
14
15  <?ifndef var.Arch?>
16    <?error Define Arch to 32 or 64?>
17  <?endif?>
18
19  <?ifndef var.Mingw_bin?>
20    <?if $(var.Arch) = "64"?>
21      <?define Mingw_bin=/usr/x86_64-w64-mingw32/sys-root/mingw/bin ?>
22    <?endif?>
23    <?if $(var.Arch) = "32"?>
24      <?define Mingw_bin=/usr/i686-w64-mingw32/sys-root/mingw/bin ?>
25    <?endif?>
26  <?endif?>
27
28  <?if $(var.Arch) = "64"?>
29    <?define ArchLib=libgcc_s_seh-1.dll?>
30    <?define GaProgramFilesFolder="ProgramFiles64Folder" ?>
31  <?endif?>
32
33  <?if $(var.Arch) = "32"?>
34    <?define ArchLib=libgcc_s_sjlj-1.dll?>
35    <?define GaProgramFilesFolder="ProgramFilesFolder" ?>
36  <?endif?>
37
38  <?ifndef var.ArchLib ?>
39    <?error Unexpected Arch value $(var.Arch)?>
40  <?endif?>
41
42  <Product
43    Name="QEMU guest agent"
44    Id="*"
45    UpgradeCode="{EB6B8302-C06E-4bec-ADAC-932C68A3A98D}"
46    Manufacturer="$(env.QEMU_GA_MANUFACTURER)"
47    Version="$(env.QEMU_GA_VERSION)"
48    Language="1033">
49    <?if $(var.Arch) = 32 ?>
50    <Condition Message="Error: 32-bit version of Qemu GA can not be installed on 64-bit Windows.">NOT VersionNT64</Condition>
51    <?endif?>
52    <Package
53      Manufacturer="$(env.QEMU_GA_MANUFACTURER)"
54      InstallerVersion="200"
55      Languages="1033"
56      Compressed="yes"
57      InstallScope="perMachine"
58      />
59    <Media Id="1" Cabinet="qemu_ga.$(env.QEMU_GA_VERSION).cab" EmbedCab="yes" />
60    <Property Id="WHSLogo">1</Property>
61    <Property Id="PREVIOUSVERSIONSINSTALLED" />
62    <Upgrade Id="{EB6B8302-C06E-4bec-ADAC-932C68A3A98D}">
63      <UpgradeVersion
64        Minimum="1.0.0.0" Maximum="$(env.QEMU_GA_VERSION)"
65        Property="PREVIOUSVERSIONSINSTALLED"
66        IncludeMinimum="yes" IncludeMaximum="no" />
67    </Upgrade>
68
69    <Directory Id="TARGETDIR" Name="SourceDir">
70      <Directory Id="$(var.GaProgramFilesFolder)" Name="QEMU Guest Agent">
71        <Directory Id="qemu_ga_directory" Name="Qemu-ga">
72          <Component Id="qemu_ga" Guid="{908B7199-DE2A-4dc6-A8D0-27A5AE444FEA}">
73            <File Id="qemu_ga.exe" Name="qemu-ga.exe" Source="../../qemu-ga.exe" KeyPath="yes" DiskId="1"/>
74            <?ifdef var.InstallVss ?>
75            <File Id="qga_vss.dll" Name="qga-vss.dll" Source="../vss-win32/qga-vss.dll" KeyPath="no" DiskId="1"/>
76            <File Id="qga_vss.tlb" Name="qga-vss.tlb" Source="../vss-win32/qga-vss.tlb" KeyPath="no" DiskId="1"/>
77            <?endif?>
78            <File Id="iconv.dll" Name="iconv.dll" Source="$(var.Mingw_bin)/iconv.dll" KeyPath="no" DiskId="1"/>
79            <File Id="libgcc_arch_lib" Name="$(var.ArchLib)" Source="$(var.Mingw_bin)/$(var.ArchLib)" KeyPath="no" DiskId="1"/>
80            <File Id="libglib_2.0_0.dll" Name="libglib-2.0-0.dll" Source="$(var.Mingw_bin)/libglib-2.0-0.dll" KeyPath="no" DiskId="1"/>
81            <File Id="libintl_8.dll" Name="libintl-8.dll" Source="$(var.Mingw_bin)/libintl-8.dll" KeyPath="no" DiskId="1"/>
82            <File Id="libssp_0.dll" Name="libssp-0.dll" Source="$(var.Mingw_bin)/libssp-0.dll" KeyPath="no" DiskId="1"/>
83            <File Id="libwinpthread_1.dll" Name="libwinpthread-1.dll" Source="$(var.Mingw_bin)/libwinpthread-1.dll" KeyPath="no" DiskId="1"/>
84            <ServiceInstall
85              Id="ServiceInstaller"
86              Type="ownProcess"
87              Vital="yes"
88              Name="QEMU-GA"
89              DisplayName="QEMU Guest Agent"
90              Description="QEMU Guest Agent"
91              Start="auto"
92              Account="LocalSystem"
93              ErrorControl="ignore"
94              Interactive="no"
95              Arguments="-d"
96              >
97            </ServiceInstall>
98            <ServiceControl Id="StartService" Start="install" Stop="both" Remove="uninstall" Name="QEMU-GA" Wait="no" />
99          </Component>
100
101          <Component Id="registry_entries" Guid="d075d109-51ca-11e3-9f8b-000c29858960">
102            <RegistryKey Root="HKLM"
103                         Key="Software\$(env.QEMU_GA_MANUFACTURER)\$(env.QEMU_GA_DISTRO)\Tools\QemuGA">
104              <RegistryValue Type="string" Name="ProductID" Value="fb0a0d66-c7fb-4e2e-a16b-c4a3bfe8d13b" />
105              <RegistryValue Type="string" Name="Version" Value="$(env.QEMU_GA_VERSION)" />
106            </RegistryKey>
107          </Component>
108        </Directory>
109      </Directory>
110    </Directory>
111
112    <Property Id="cmd" Value="cmd.exe"/>
113
114    <?ifdef var.InstallVss ?>
115    <CustomAction Id="RegisterCom"
116             ExeCommand='/c "[qemu_ga_directory]qemu-ga.exe" -s vss-install'
117              Execute="deferred"
118              Property="cmd"
119              Impersonate="no"
120              Return="check"
121              >
122    </CustomAction>
123    <CustomAction Id="UnRegisterCom"
124              ExeCommand='/c "[qemu_ga_directory]qemu-ga.exe" -s vss-uninstall'
125              Execute="deferred"
126              Property="cmd"
127              Impersonate="no"
128              Return="check"
129              ></CustomAction>
130    <?endif?>
131
132    <Feature Id="QEMUFeature" Title="QEMU Guest Agent" Level="1">
133      <ComponentRef Id="qemu_ga" />
134      <ComponentRef Id="registry_entries" />
135    </Feature>
136
137    <InstallExecuteSequence>
138      <RemoveExistingProducts Before="InstallInitialize" />
139      <?ifdef var.InstallVss ?>
140      <Custom Action="RegisterCom" After="InstallServices">NOT Installed</Custom>
141      <Custom Action="UnRegisterCom" After="StopServices">Installed</Custom>
142      <?endif?>
143    </InstallExecuteSequence>
144  </Product>
145</Wix>
146