当前位置: 首页 > 工具软件 > msitools > 使用案例 >

CentOS7下msitools安裝

孙思源
2023-12-01

CentOS7下暂无官方的msitools.rpm包,安装需要下载源码
下载地址
下载安装后进入目录
首先添加构建所必须的包,下列不全
yum install -y bison libgsf-devel libgcab1-devel gcc
./configure
make all install
安装后wixl打包工具位于
/usr/local/bin/wixl

打包命令:
环境变量声明
wixl -o msi包名 -a arch -D define 配置文件
例如:
QEMU_GA_VERSION=“2.12.0” QEMU_GA_MANUFACTURER=“CentOS” QEMU_GA_DISTRO=“RHEL” BUILD_DIR="/root/src/qemu-win64-dev" wixl -o qemu-ga-s-x86_64.msi -a x64 -D Arch=64 -D InstallVss -D Mingw_dlls=/usr/x86_64-w64-mingw32/sys-root/mingw/bin /root/src/qemu-win64-dev/qga/installer/qemu-ga-s.wxs
//uuid 生成: cat /proc/sys/kernel/random/uuid|tr [a-z] [A-Z]
配置文件内容

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <?ifndef env.QEMU_GA_VERSION ?>
    <?error Environment variable QEMU_GA_VERSION undefined?>
  <?endif?>

  <?ifndef env.QEMU_GA_DISTRO ?>
    <?error Environment variable QEMU_GA_DISTRO undefined?>
  <?endif?>

  <?ifndef env.QEMU_GA_MANUFACTURER ?>
    <?error Environment variable QEMU_GA_MANUFACTURER undefined?>
  <?endif?>

  <?ifndef var.Arch?>
    <?error Define Arch to 32 or 64?>
  <?endif?>

  <?ifndef var.Mingw_bin?>
    <?if $(var.Arch) = "64"?>
      <?define Mingw_bin=/usr/x86_64-w64-mingw32/sys-root/mingw/bin ?>
    <?endif?>
    <?if $(var.Arch) = "32"?>
      <?define Mingw_bin=/usr/i686-w64-mingw32/sys-root/mingw/bin ?>
    <?endif?>
  <?endif?>

  <?if $(var.Arch) = "64"?>
    <?define ArchLib=libgcc_s_seh-1.dll?>
    <?define GaProgramFilesFolder="ProgramFiles64Folder" ?>
  <?endif?>

  <?if $(var.Arch) = "32"?>
    <?define ArchLib=libgcc_s_sjlj-1.dll?>
    <?define GaProgramFilesFolder="ProgramFilesFolder" ?>
  <?endif?>

  <?ifndef var.ArchLib ?>
    <?error Unexpected Arch value $(var.Arch)?>
  <?endif?>

  <Product
    Name="QEMU guest agent S"
    Id="{9C6C237E-8CEB-4031-B743-69451B666AFA}"
    UpgradeCode="{A9BA6C1F-4DF7-4B17-BCF0-713DA704E716}"
    Manufacturer="$(env.QEMU_GA_MANUFACTURER)"
    Version="$(env.QEMU_GA_VERSION)"
    Language="1033">
    <?if $(var.Arch) = 32 ?>
    <Condition Message="Error: 32-bit version of Qemu GA can not be installed on 64-bit Windows.">NOT VersionNT64</Condition>
    <?endif?>
    <Package
      Manufacturer="$(env.QEMU_GA_MANUFACTURER)"
      InstallerVersion="200"
      Languages="1033"
      Compressed="yes"
      InstallScope="perMachine"
      />
    <Media Id="1" Cabinet="qemu_ga.$(env.QEMU_GA_VERSION).cab" EmbedCab="yes" />
    <Property Id="WHSLogo">1</Property>
    <MajorUpgrade
      DowngradeErrorMessage="Error: A newer version of QEMU guest agent is already installed."
      />

    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="$(var.GaProgramFilesFolder)" Name="QEMU Guest Agent S">
        <Directory Id="qemu_ga_directory" Name="Qemu-ga-s">
          <Component Id="qemu_ga" Guid="{B3F00FD3-EAE6-4A82-A04E-5166F6CD758C}">
            <File Id="qemu_ga.exe" Name="qemu-ga.exe" Source="$(env.BUILD_DIR)/qemu-ga.exe" KeyPath="yes" DiskId="1"/>
            <ServiceInstall
              Id="ServiceInstaller"
              Type="ownProcess"
              Vital="yes"
              Name="QEMU-GA-S"
              DisplayName="QEMU Guest Agent S"
              Description="QEMU Guest Agent SLAVER"
              Start="auto"
              Account="LocalSystem"
              ErrorControl="ignore"
              Interactive="no"
              Arguments="-c &quot;C:\Program Files\Qemu-ga-s\qemu-ga-s.conf&quot;"
              >
            </ServiceInstall>
            <ServiceControl Id="StartService" Start="install" Stop="both" Remove="uninstall" Name="QEMU-GA-S" Wait="no" />
          </Component>
          <?ifdef var.InstallVss?>
          <Component Id="qga_vss_dll" Guid="{B5983D24-0FE1-4B21-AE88-29BB32E9FABD}">
            <File Id="qga_vss.dll" Name="qga-vss.dll" Source="$(env.BUILD_DIR)/qga/vss-win32/qga-vss.dll" KeyPath="yes" DiskId="1"/>
          </Component>
          <Component Id="qga_vss_tlb" Guid="{1127CFF9-4B6A-4D3A-9106-C9A0D79E14A6}">
            <File Id="qga_vss.tlb" Name="qga-vss.tlb" Source="$(env.BUILD_DIR)/qga/vss-win32/qga-vss.tlb" KeyPath="yes" DiskId="1"/>
          </Component>
          <?endif?>
          <?if $(var.Arch) = "32"?>
          <Component Id="gspawn-helper-console" Guid="{5EFFC7F9-FF04-4AAA-9051-E8C6857FAFBF}">
            <File Id="gspawn-win32-helper-console.exe" Name="gspawn-win32-helper-console.exe" Source="$(var.Mingw_bin)/gspawn-win32-helper-console.exe" KeyPath="yes" DiskId="1"/>
          </Component>
          <Component Id="gspawn-helper" Guid="{3FEB3DFF-7401-41FA-81EC-A49E2867ADA8}">
            <File Id="gspawn-win32-helper.exe" Name="gspawn-win32-helper.exe" Source="$(var.Mingw_bin)/gspawn-win32-helper-console.exe" KeyPath="yes" DiskId="1"/>
          </Component>
          <?endif?>
          <?if $(var.Arch) = "64"?>
          <Component Id="gspawn-helper-console" Guid="{D993DACA-80B4-4CDC-AF5D-85AE664772AF}">
            <File Id="gspawn-win64-helper-console.exe" Name="gspawn-win64-helper-console.exe" Source="$(var.Mingw_bin)/gspawn-win64-helper-console.exe" KeyPath="yes" DiskId="1"/>
          </Component>
          <Component Id="gspawn-helper" Guid="{0AD340C2-B025-4C3A-9DBE-B5FD98B6F164}">
            <File Id="gspawn-win64-helper.exe" Name="gspawn-win64-helper.exe" Source="$(var.Mingw_bin)/gspawn-win64-helper-console.exe" KeyPath="yes" DiskId="1"/>
          </Component>
          <?endif?>
          <Component Id="iconv" Guid="{D12CBE72-BB1A-4874-A0CF-E2151B1D99B4}">
            <File Id="iconv.dll" Name="iconv.dll" Source="$(var.Mingw_bin)/iconv.dll" KeyPath="yes" DiskId="1"/>
          </Component>
          <Component Id="libgcc_arch_lib" Guid="{FAD8C560-F36D-42C1-A96A-3EC25DFBB8E7}">
            <File Id="libgcc_arch_lib" Name="$(var.ArchLib)" Source="$(var.Mingw_bin)/$(var.ArchLib)" KeyPath="yes" DiskId="1"/>
          </Component>
          <Component Id="libglib" Guid="{69734E62-DBB6-473B-9C8C-9ACF6C847C02}">
            <File Id="libglib_2.0_0.dll" Name="libglib-2.0-0.dll" Source="$(var.Mingw_bin)/libglib-2.0-0.dll" KeyPath="yes" DiskId="1"/>
          </Component>
          <Component Id="libintl" Guid="{E24F6461-AFA2-4FB3-A247-E4E205C83B91}">
            <File Id="libintl_8.dll" Name="libintl-8.dll" Source="$(var.Mingw_bin)/libintl-8.dll" KeyPath="yes" DiskId="1"/>
          </Component>
          <Component Id="libssp" Guid="{71D50318-A1F7-4CB5-8686-E650B30FFDDB}">
            <File Id="libssp_0.dll" Name="libssp-0.dll" Source="$(var.Mingw_bin)/libssp-0.dll" KeyPath="yes" DiskId="1"/>
          </Component>
          <Component Id="libwinpthread" Guid="{8517810A-DAA4-4075-B972-7A765BD47A7A}">
            <File Id="libwinpthread_1.dll" Name="libwinpthread-1.dll" Source="$(var.Mingw_bin)/libwinpthread-1.dll" KeyPath="yes" DiskId="1"/>
          </Component>
          <Component Id="libpcre" Guid="{1A61428D-8336-4DE0-AAF5-2434FEBC6BE1}">
            <File Id="libpcre_1.dll" Name="libpcre-1.dll" Source="$(var.Mingw_bin)/libpcre-1.dll" KeyPath="yes" DiskId="1"/>
          </Component>
          <Component Id="qemu_ga_s" Guid="{47BF9079-B07D-4DE8-A7A5-4F7C060A9632}">
            <File Id="qemu_ga_s.conf" Name="qemu-ga-s.conf" Source="$(env.BUILD_DIR)/config/win32/qemu-ga-s.conf" KeyPath="yes" DiskId="1"/>
          </Component>
         <Component Id="registry_entries" Guid="{882E3681-3694-4C44-86EF-BAB5F7731CBE}">
            <RegistryKey Root="HKLM"
                         Key="Software\$(env.QEMU_GA_MANUFACTURER)\$(env.QEMU_GA_DISTRO)\Tools\QemuGAS">
              <RegistryValue Type="string" Name="ProductID" Value="806B6E0A-6A08-494D-A95F-E9E71A8AB9E6" />
              <RegistryValue Type="string" Name="Version" Value="$(env.QEMU_GA_VERSION)" />
            </RegistryKey>
          </Component>
        </Directory>
      </Directory>
    </Directory>

    <Property Id="cmd" Value="cmd.exe"/>
    <Property Id="REINSTALLMODE" Value="amus"/>

    <?ifdef var.InstallVssService?>
    <CustomAction Id="RegisterCom"
              ExeCommand='/c "[qemu_ga_directory]qemu-ga.exe" -s vss-install'
              Execute="deferred"
              Property="cmd"
              Impersonate="no"
              Return="check"
              >
    </CustomAction>
    <CustomAction Id="UnRegisterCom"
              ExeCommand='/c "[qemu_ga_directory]qemu-ga.exe" -s vss-uninstall'
              Execute="deferred"
              Property="cmd"
              Impersonate="no"
              Return="check"
              >
    </CustomAction>
    <?endif?>

    <Feature Id="QEMUFeature" Title="QEMU Guest Agent" Level="1">
      <ComponentRef Id="qemu_ga" />
      <?ifdef var.InstallVss?>
      <ComponentRef Id="qga_vss_dll" />
      <ComponentRef Id="qga_vss_tlb" />
      <?endif?>
      <ComponentRef Id="gspawn-helper-console" />
      <ComponentRef Id="gspawn-helper" />
      <ComponentRef Id="iconv" />
      <ComponentRef Id="libgcc_arch_lib" />
      <ComponentRef Id="libglib" />
      <ComponentRef Id="libintl" />
      <ComponentRef Id="libssp" />
      <ComponentRef Id="libwinpthread" />
      <ComponentRef Id="registry_entries" />
      <ComponentRef Id="libpcre" />
      <ComponentRef Id="qemu_ga_s" />
   </Feature>

    <InstallExecuteSequence>
      <?ifdef var.InstallVssService?>
      <Custom Action="UnRegisterCom" After="StopServices">Installed</Custom>
      <Custom Action="RegisterCom" After="InstallServices">NOT REMOVE</Custom>
      <?endif?>
    </InstallExecuteSequence>
  </Product>
</Wix>
 类似资料: