summaryrefslogtreecommitdiff
path: root/omnibus/resources/chef/msi/source.wxs.erb
blob: b566ca61918210b985b3fdbfa4ea9560db67fdb9 (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<?xml version='1.0'?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">

  <!-- This is how we include wxi files -->
  <?include "parameters.wxi" ?>

  <!--
    Id="*" is to enable upgrading. * means that the product ID will be autogenerated on each build.
    Name is made of localized product name and version number.
  -->
  <Product Id="*" Name="!(loc.ProductName) v$(var.DisplayVersionNumber)" Language="!(loc.LANG)"
          Version="$(var.VersionNumber)" Manufacturer="!(loc.ManufacturerName)" UpgradeCode="$(var.UpgradeCode)">

    <!--
      Define the minimum supported installer version (2.0).
      The install should be done for the whole machine not just the current user
    -->
    <Package InstallerVersion="200" InstallPrivileges="elevated"
             Compressed="yes" InstallScope="perMachine" />

    <!--
      Create property references for the well known SIDs of the 
      accounts we want to restrict for the project location folder
    -->
    <PropertyRef Id="WIX_ACCOUNT_LOCALSYSTEM" />
    <PropertyRef Id="WIX_ACCOUNT_ADMINISTRATORS" />
    <PropertyRef Id="WIX_ACCOUNT_USERS" />

    <Media Id="1" Cabinet="ChefClient.cab" EmbedCab="yes" CompressionLevel="high" />

    <!--
      Uncomment launch condition below to check for minimum OS
      601 = Windows 7/Server 2008R2.
    -->
    <!-- Condition Message="!(loc.MinimumOSVersionMessage)">
      <![CDATA[Installed OR VersionNT >= 601]]>
    </Condition -->

    <!-- We always do Major upgrades -->
    <MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeErrorMessage)" />


    <!--
      If fastmsi is set, custom actions will be invoked during install to unzip
      project files, and during uninstall to remove the project folder
    -->
    <% if fastmsi %>
    <SetProperty Id="FastUnzip"
                 Value="FASTZIPDIR=[INSTALLLOCATION];FASTZIPAPPNAME=$(var.ProjectLocationDir)"
                 Sequence="execute"
                 Before="FastUnzip" />

    <CustomAction Id="FastUnzip"
                  BinaryKey="CustomActionFastMsiDLL"
                  DllEntry="FastUnzip"
                  Execute="deferred"
                  Impersonate="no"
                  Return="check" />

    <Binary Id="CustomActionFastMsiDLL"
            SourceFile="CustomActionFastMsi.CA.dll" />

    <CustomAction Id="Cleanup"
                  Directory="INSTALLLOCATION"
                  ExeCommand="cmd /C &quot;rd /S /Q $(var.ProjectLocationDir)&quot;"
                  Execute="deferred"
                  Impersonate="no"
                  Return="ignore" />

    <InstallExecuteSequence>
      <Custom Action="FastUnzip" After="InstallFiles">NOT Installed</Custom>
      <Custom Action="Cleanup" After="RemoveFiles">REMOVE~="ALL"</Custom>
    </InstallExecuteSequence>

    <UI>
      <ProgressText Action="FastUnzip">!(loc.FileExtractionProgress)</ProgressText>
    </UI>
    <% end %>

    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="WindowsVolume">
        <!-- Service needs chef directory to be present. -->
        <Directory Id="CONFIGLOCATION" Name="chef">
          <Component Id="CONFIGLOCATIONDIR" Guid="{F66F6394-51A4-4C5D-908B-E55584473436}" >
            <CreateFolder Directory="CONFIGLOCATION" />
          </Component>
        </Directory>
        <Directory Id="INSTALLLOCATION" Name="opscode">
          <Directory Id="PROJECTLOCATION" Name="$(var.ProjectLocationDir)" >
            <Component Id="ProjectLocationPermissions" Guid="{75f50556-efae-4ede-beb2-a2c9b1a4d43f}" >
              <CreateFolder>
                <Permission User="[WIX_ACCOUNT_LOCALSYSTEM]" GenericAll="yes"/>
                <Permission User="[WIX_ACCOUNT_ADMINISTRATORS]" GenericAll="yes"/>
                <Permission User="[WIX_ACCOUNT_USERS]" GenericRead="yes" GenericExecute="yes"/>
              </CreateFolder>
            </Component>
            <Directory Id="PROJECTLOCATIONBIN" Name="bin" >
              <Component Id="ChefClientPath" Guid="{7F663F88-55A2-4E20-82BF-8BD2E60BB83A}" >
                <Environment Id="ClientPathEnvironment"
                             Name="PATH" Action="set" Part="last" System="yes" Value="[PROJECTLOCATIONBIN]" />
              </Component>
            </Directory>
            <Directory Id="PSMODULES" Name="modules" >
              <Component Id="ChefPSModulePath" Guid="{357DA654-F02E-430A-9EA6-A10554E3EF38}" >
                <Environment Id="ChefPSModulePathEnvironment"
                             Name="PSModulePath" Action="set" Part="last" System="yes" Value="[PSMODULES]" />
              </Component>
            </Directory>
            <Directory Id="EMBEDDED" Name="embedded" >
              <Directory Id="EMBEDDEDBIN" Name="bin" >
                <Component Id="ChefClientService" Guid="{69B2D8BE-4A47-4BE3-AEE8-83FAEB6E2FAF}" >
                  <File Id="RubyExecutable" Source="$(var.ProjectSourceDir)\embedded\bin\ruby.exe" KeyPath="yes" />
                  <ServiceInstall Name="chef-client" Type="ownProcess"
                                  Start="auto" Vital="yes" ErrorControl="ignore"
                                  Arguments="[PROJECTLOCATION]bin\chef-windows-service"
                                  DisplayName="!(loc.ServiceDisplayName)"
                                  Description="!(loc.ServiceDescription)">
                      <ServiceDependency Id="Winmgmt" />
                      <ServiceConfig DelayedAutoStart="yes" OnInstall="yes" />
                  </ServiceInstall>
                  <ServiceControl Id="ControlChefClientService" Name="chef-client"
                                  Remove="both" Stop="both" Wait="yes" />
                </Component>
                <Component Id="ChefClientLog" Guid="{8e492d59-3a0c-43fd-b889-e35dfa33da91}">
                    <util:EventSource xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
                        Name="Chef" Log="Application"
                        EventMessageFile="[PROJECTLOCATION]$(var.ChefLogDllPath)"
                        />
                </Component>
              </Directory>
            </Directory>
          </Directory>
        </Directory>
      </Directory>
    </Directory>

    <!-- Set the components defined in our fragment files that will be used for our feature  -->
    <Feature Id="ChefClientFeature" Title="!(loc.FeatureMainName)" Absent="disallow" AllowAdvertise="no" Level="1" ConfigurableDirectory="INSTALLLOCATION">
      <ComponentGroupRef Id="ProjectDir" />
      <ComponentRef Id="ProjectLocationPermissions" />
      <ComponentRef Id="ChefClientPath" />
      <ComponentRef Id="CONFIGLOCATIONDIR" />
      <ComponentRef Id="ChefClientLog" />
    </Feature>

    <Feature Id="ChefPSModuleFeature" Title="!(loc.FeaturePSModuleName)" Level="1000" AllowAdvertise="no">
      <ComponentRef Id="ChefPSModulePath" />
    </Feature>

    <Feature Id="ChefServiceFeature" Title="!(loc.FeatureServiceName)" Level="1000" AllowAdvertise="no">
      <ComponentRef Id="ChefClientService" />
    </Feature>

    <!--
      TODO:

      * create initial Client config? ie C:\chef\client.rb?
      * optionally install extra tools?  ie git?

    -->

    <!--
      UI Stuff
    -->
    <Icon Id="oc.ico" SourceFile="Resources\assets\oc_16x16.ico"/>
    <Property Id="ARPPRODUCTICON" Value="oc.ico" />
    <Property Id="ARPHELPLINK" Value="http://www.getchef.com/support/" />
    <Property Id="WIXUI_INSTALLDIR" Value="INSTALLLOCATION" />

    <UIRef Id="ChefClientUI_InstallDir"/>
    <UI Id="ChefClientUI_InstallDir">
      <UIRef Id="WixUI_FeatureTree"/>
      <TextStyle Id="WixUI_Font_Normal_White" FaceName="Tahoma" Size="8" Red="255" Green="255" Blue="255" />
      <TextStyle Id="WixUI_Font_Bigger_White" FaceName="Tahoma" Size="12" Red="255" Green="255" Blue="255" />
      <TextStyle Id="WixUI_Font_Title_White" FaceName="Tahoma" Size="9" Bold="yes" Red="255" Green="255" Blue="255" />
    </UI>

    <WixVariable Id="WixUILicenseRtf" Value="Resources\assets\LICENSE.rtf" />
    <WixVariable Id="WixUIDialogBmp" Value="Resources\assets\dialog_background.bmp" />
    <WixVariable Id="WixUIBannerBmp" Value="Resources\assets\banner_background.bmp" />

    <WixVariable Id="WixUIExclamationIco" Value="Resources\assets\oc_32x32.ico" />
    <WixVariable Id="WixUIInfoIco" Value="Resources\assets\oc_32x32.ico" />
    <WixVariable Id="WixUINewIco" Value="Resources\assets\oc_16x16.ico" />
    <WixVariable Id="WixUIUpIco" Value="Resources\assets\oc_16x16.ico" />

  </Product>
</Wix>