github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/scripts/windows/pyroscope.wsx (about)

     1  <?xml version="1.0" encoding="UTF-8"?>
     2  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     3  
     4  	Mandatory pre-processor variables:
     5  		- PyroscopeSourceExecutable - path to the local pyroscope binary.
     6  
     7  	Optional pre-processor variables:
     8  		- ProductVersion - if not set, the value is taken from the pyroscope binary VersionInfo.
     9  
    10   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
    11  <Wix
    12  		xmlns="http://schemas.microsoft.com/wix/2006/wi"
    13  		xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
    14  
    15  	<!-- Product versioning
    16  		Use -dProductVersion candle flag to specify the package version.
    17  	-->
    18  	<?ifndef ProductVersion ?>
    19  		<?define ProductVersion="!(bind.FileVersion.PyroscopeExe)"?>
    20  	<?endif?>
    21  
    22  	<?define ProductUpgradeCode="fcf551d4-b847-10bd-a5f2-4451366a1174"?>
    23  	<?define ManufacturerName="Pyroscope"?>
    24  
    25  	<?define PyroscopeFullName="Pyroscope Agent"?>
    26      <?define PyroscopeServiceName="pyroscope"?>
    27      <?define PyroscopeDescription="Pyroscope continuous profiling platform agent"?>
    28  
    29  	<!-- Multi-arch
    30  		Use -arch candle flag (BUILDARCH) to specify architecture the MSI is compiled for - one of x86, x64 is allowed.
    31  		Any arch-dependent vars must be defined in this section.
    32  	-->
    33  
    34  	<?if $(sys.BUILDARCH)="x86"?>
    35  		<?define Minimum_Version="100"?>
    36  		<?define ArchProgramFiles="ProgramFilesFolder"?>
    37  		<?define QuietExec="CAQuietExec"?>
    38  	<?elseif $(sys.BUILDARCH)="x64"?>
    39  		<?define Minimum_Version="200"?>
    40  		<?define ArchProgramFiles="ProgramFiles64Folder"?>
    41  		<?define QuietExec="CAQuietExec64"?>
    42  	<?else?>
    43  		<?error Unsupported value of sys.BUILDARCH=$(sys.BUILDARCH)?>
    44  	<?endif?>
    45  
    46  	<!-- Default MSI parameters -->
    47  
    48  	<Product Id="*"
    49  			 Name="$(var.PyroscopeFullName)"
    50  			 Language="1033"
    51  			 Version="$(var.ProductVersion)"
    52  			 UpgradeCode="$(var.ProductUpgradeCode)"
    53  			 Manufacturer="Pyroscope, Inc" >
    54  
    55  		<Package
    56  				Compressed="yes"
    57  				InstallScope="perMachine"
    58  				Manufacturer="$(var.ManufacturerName)"
    59  				Description="$(var.PyroscopeDescription)"/>
    60  
    61  		<Media Id="1" Cabinet="product.cab" EmbedCab="yes"/>
    62  
    63  		<Condition Message="You need to be an administrator to install this product.">
    64  			Privileged
    65  		</Condition>
    66  
    67  		<!-- Set properties for add/remove programs -->
    68  		<Property Id="ARPNOREPAIR" Value="yes" Secure="yes"/> <!-- Remove repair -->
    69  		<Property Id="ARPNOMODIFY" Value="yes" Secure="yes"/> <!-- Remove modify -->
    70  		<Property Id="ARPPRODUCTICON" Value="Icon.exe"/>
    71  
    72  		<!-- Define icons (ID should not be longer than 18 chars and must end with ".exe") -->
    73  		<Icon Id="Icon.exe" SourceFile="resources\app.ico"/>
    74  
    75  		<!-- Upgrades
    76  			AllowSameVersionUpgrades - MSI ignores the fourth product version field, setting this attribute to yes
    77  			also allows downgrades when the first three product version fields are identical.
    78  
    79  			For example, product version 1.0.0.1 will "upgrade" 1.0.0.2998 because they're seen as the same
    80  			version (1.0.0). That could reintroduce serious bugs so the safest choice is to change the first three
    81  			version fields and omit this attribute to get the default of no. Refer to:
    82  			https://wixtoolset.org/documentation/manual/v3/xsd/wix/majorupgrade.html.
    83  
    84  			When AllowSameVersionUpgrades is set to true, warning LGHT1076 is raised by light:
    85  			ICE61: This product should remove only older versions of itself. The Maximum version is not less than
    86  			the current product.
    87  
    88  			Use -sw1076 light flag to suppress the message.
    89  		-->
    90  
    91  		<MajorUpgrade
    92  				AllowDowngrades="no"
    93  				AllowSameVersionUpgrades="yes"
    94  				DowngradeErrorMessage="A later version of [ProductName] is already installed."/>
    95  
    96  		<Directory Id="TARGETDIR" Name="SourceDir">
    97  			<Directory Id="$(var.ArchProgramFiles)">
    98  				<Directory Id="ManufacturerDir" Name="$(var.ManufacturerName)">
    99                      <Directory Id="INSTALLDIR" Name="$(var.PyroscopeFullName)" />
   100  				</Directory>
   101  			</Directory>
   102  		</Directory>
   103  
   104  		<DirectoryRef Id="INSTALLDIR">
   105  			<Component Id="Pyroscope" Guid="*">
   106  				<File
   107  						Id="PyroscopeExe"
   108  						Source="$(var.PyroscopeSourceExecutable)"
   109  						Vital="yes"
   110  						KeyPath="yes"/>
   111                  <Environment
   112  						Id="PATH"
   113  						Name="PATH"
   114  						Value="[INSTALLDIR]"
   115  						Permanent="yes"
   116  						Part="last"
   117  						Action="set"
   118  						System="yes" />
   119  				<!-- https://blogs.msdn.microsoft.com/jcalev/2008/01/10/some-tricks-with-service-restart-logic/ -->
   120  				<ServiceInstall
   121  						Id="PyroscopeService"
   122  						Type="ownProcess"
   123  						Arguments="agent"
   124  						Name="$(var.PyroscopeServiceName)"
   125  						DisplayName="$(var.PyroscopeFullName)"
   126  						Description="$(var.PyroscopeDescription)"
   127  						Start="auto"
   128  						ErrorControl="ignore"
   129  						Vital="yes">
   130  					<util:ServiceConfig
   131  							FirstFailureActionType='restart'
   132  							SecondFailureActionType='restart'
   133  							ThirdFailureActionType='restart'
   134  							RestartServiceDelayInSeconds='60'
   135  							ResetPeriodInDays='0'/>
   136  				</ServiceInstall>
   137  				<ServiceControl
   138  						Id="PyroscopeServiceControl"
   139  						Name="$(var.PyroscopeServiceName)"
   140  						Start="install"
   141  						Stop="both"
   142  						Remove="uninstall"
   143  						Wait="no"/>
   144  			</Component>
   145  		</DirectoryRef>
   146  
   147  		<Feature Id="Complete" Level="1">
   148  			<ComponentRef Id="Pyroscope"/>
   149  		</Feature>
   150  
   151  	</Product>
   152  </Wix>