Hush Documentation for all levels of users
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

5.6 KiB

Creating SilentDragonLite MSI installer for Windows with msitools and wixl

This documentation is for creating a SilentDragonLite MSI installer for Windows using msitools and wixl. Documentation for msitools is here: https://wiki.gnome.org/msitools Documentation for wixl can refer to WiX toolset as it tries to share the same syntax: https://wixtoolset.org/documentation/manual/v3/ This was tested on Ubuntu 20.04.4 LTS

Install msitools and wixl

sudo apt-get -y install msitools wixl

Download latest SilentDragonLite Windows release and unzip

Latest releases located here: https://git.hush.is/hush/SilentDragonLite/releases Example below is for SilentDragonLite 1.5.2

wget https://git.hush.is/attachments/37c68ff3-725c-4ceb-b28a-8c131739585c
unzip 37c68ff3-725c-4ceb-b28a-8c131739585c

This will unzip into a directory named SilentDragonLite-v1.5.2-win

cd SilentDragonLite-v1.5.2-win

Copy silentdragon.ico to SilentDragonLite directory

The icon file silentdragon.ico is currently not included in release zip, but is required to create an MSI installer with a smaller size. Setting icon SourceFile in the .wxs file to SilentDragonLite.exe will duplicate the .exe and make the installer over 100MB instead of ~80MB. How you get this .ico file is up to you. I extracted from .exe on Windows. Maybe it will be included in .zip release in the future to make this easier for anyone trying to create a MSI file for the first time.

Create WiX source file (.wxs)

This is an XML file. You should name it what you want the .msi file to be named IE: SilentDragonLite-1.5.2.wxs Below is a copy of the contents of the SilentDragonLite-1.5.2.wxs file. Note that GUID's all need to be unique. This will create shortcuts to SilentDragonLite on desktop and in the start menu as well as have uninstall support from Add/Remove Programs. A tutorial that explains the basics of creating these files can be found here: https://www.firegiant.com/wix/tutorial/

<?xml version='1.0' encoding='windows-1252'?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
  <Product Name='SilentDragonLite' Id='2dc57a1d-b094-4ada-9141-c1cd4bd3ac42' UpgradeCode='d67c14a1-8cf8-438b-b32b-5e8aaae06a40'
    Language='1033' Codepage='1252' Version='1.5.2' Manufacturer='HUSH'>

    <Package Id='*' Keywords='Installer' Description="HUSH SilentDragonLite Installer"
      Comments='' Manufacturer='HUSH'
      InstallerVersion='100' Languages='1033' Compressed='yes' SummaryCodepage='1252' />

    <Media Id='1' Cabinet='SilentDragonLite.cab' EmbedCab='yes' DiskPrompt="CD-ROM #1" />
    <Property Id='DiskPrompt' Value="HUSH SilentDragonLite 1.5.2 Installation [1]" />

    <Directory Id='TARGETDIR' Name='SourceDir'>
      <Directory Id='ProgramFilesFolder' Name='PFiles'>
        <Directory Id='HUSH' Name='HUSH'>
          <Directory Id='INSTALLDIR' Name='SilentDragonLite'>
            <Component Id='MainExecutable' Guid='24fb99eb-d6b6-4d96-a1b1-631acdff8222'>
              <File Id='SilentDragonLiteEXE' Name='SilentDragonLite.exe' DiskId='1' Source='SilentDragonLite.exe' KeyPath='yes'>
                <Shortcut Id="startmenuSilentDragonLite" Directory="ProgramMenuDir" Name="SilentDragonLite" WorkingDirectory='INSTALLDIR' Icon="SilentDragonLite.exe" IconIndex="0" Advertise="yes" />
                <Shortcut Id="desktopSilentDragonLite" Directory="DesktopFolder" Name="SilentDragonLite" WorkingDirectory='INSTALLDIR' Icon="SilentDragonLite.exe" IconIndex="0" Advertise="yes" />
              </File>
            </Component>
            <Component Id="READMEFILE" Guid="126d74da-bd82-496d-a936-78d6f0bf2f3c">
                <File Id="README" DiskId='1' Source="README" KeyPath="yes"/>
            </Component>			
          </Directory>
        </Directory>
      </Directory>

      <Directory Id="ProgramMenuFolder" Name="Programs">
        <Directory Id="ProgramMenuDir" Name="SilentDragonLite">
          <Component Id="ProgramMenuDir" Guid="a47c750e-1dcc-49cd-bec1-d283f4b24401">
            <RemoveFolder Id='ProgramMenuDir' On='uninstall' />
            <RegistryValue Root='HKCU' Key='Software\[Manufacturer]\[ProductName]' Type='string' Value='' KeyPath='yes' />
          </Component>
        </Directory>
      </Directory>

      <Directory Id="DesktopFolder" Name="Desktop" />
    </Directory>

    <Feature Id='Complete' Level='1'>
      <ComponentRef Id='MainExecutable' />
      <ComponentRef Id='ProgramMenuDir' />
      <ComponentRef Id='READMEFILE' />
    </Feature>

    <Icon Id="SilentDragonLite.exe" SourceFile="silentdragon.ico" />

  </Product>
</Wix>

Build MSI file from WiX source file

wixl -v SilentDragonLite-1.5.2.wxs

This will create a SilentDragonLite-1.5.2.msi file in the same directory which can then be distributed. If it created without error and is larger than 0kb, congratulations!

Potential known issue and work-around if wixl generates MSI with corrupt cabinet file

There is a known issue where wixl may generate a corrupt cabinet file, causing the Windows installer to fail with a corrupt cabinet file error. This appears related to the file size of SilentDragonLite.exe and reported issue with gcab: https://gitlab.gnome.org/GNOME/gcab/-/issues/16

File size where this becomes an issue is not exactly known, but it has occurred when SilentDragonLite.exe was ~100 MB. There is no cabinet file corruption when compressing SilentDragonLite.exe to ~80 MB. UPX is used to compress the executable and then MSI is created again: https://upx.github.io/

Install UPX

sudo apt-get install upx

Compress SilentDragonLite.exe

upx SilentDragonLite.exe --force

Re-create MSI using compressed exe

wixl -v SilentDragonLite-1.5.2.wxs