summaryrefslogtreecommitdiff
path: root/src/mongo/installer/msi/wxs/Installer_64.wxs
blob: c2b8d8e2a49c093e1313611ee5a4ca340b60c4fb (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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
     xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
  <Product Id="$(var.ProductId)" 
           Name="!(wix.ProductName)" 
           Language="1033" 
           Version="$(var.MongoDBVersion)" 
           Manufacturer="MongoDB Inc." 
           UpgradeCode="$(var.UpgradeCode)">

    <Package InstallerVersion="405" Compressed="yes" Platform="x64"/>

    <WixVariable Id="InstallFolder" Value="$(var.MongoDBMajorVersion)"/>

    <?if $(var.Edition) = Enterprise ?>
        <WixVariable Id="ProductName" Value="MongoDB $(var.MongoDBVersion) $(var.Flavor) Enterprise (64 bit)" />
        <WixVariable Id="ProductMajorName" Value="MongoDB $(var.MongoDBMajorVersion) $(var.Flavor) Enterprise (64 bit)" />
    <?elseif $(var.Edition) = SSL ?>
        <WixVariable Id="ProductName" Value="MongoDB $(var.MongoDBVersion) $(var.Flavor) SSL (64 bit)" />
        <WixVariable Id="ProductMajorName" Value="MongoDB $(var.MongoDBMajorVersion) $(var.Flavor) SSL (64 bit)" />
    <?else?>
        <WixVariable Id="ProductName" Value="MongoDB $(var.MongoDBVersion) $(var.Flavor) (64 bit)" />
        <WixVariable Id="ProductMajorName" Value="MongoDB $(var.MongoDBMajorVersion) $(var.Flavor) (64 bit)" />
    <?endif?>

    <MajorUpgrade
      DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit."/>

    <Directory Id="TARGETDIR" Name="SourceDir">
        <Directory Id="ProgramFiles64Folder">
            <Directory Id="MongoDB" Name="MongoDB">
                <Directory Id="Server" Name="Server">
                    <Directory Id="INSTALLLOCATION" Name="!(wix.InstallFolder)">
                      <Directory Id="BIN" Name="bin" />
                        <Directory Id="MONGO_DATA_PATH" Name="data" />
                        <Directory Id="MONGO_LOG_PATH" Name="log" />
                      <Directory Id="SNMP" Name="snmp" />
                    </Directory>
                </Directory>
            </Directory>
        </Directory>
        <Directory Id="CommonAppDataFolder">
            <Directory Id="MongoDBData" Name="MongoDB">
                <Directory Id="ServerData" Name="Server">
                    <Directory Id="VersionData" Name="!(wix.InstallFolder)" />
                </Directory>
            </Directory>
        </Directory>
    </Directory>

    <Binary Id="CAIntro" SourceFile="$(var.CustomActionDll)"/>

    <CustomAction Id="UpdateMongoYAML"
        BinaryKey="CAIntro"
        DllEntry="UpdateMongoYAML"
        Execute="deferred"
        Return="check"
        Impersonate="no"
        HideTarget="no" />

    <CustomAction Id="UpdateMongoYAML.SetProperty" 
        Return="check"
        Property="UpdateMongoYAML"
        Value="BIN=[BIN];MONGO_DATA_PATH=[MONGO_DATA_PATH];MONGO_LOG_PATH=[MONGO_LOG_PATH]"/>

    <CustomAction Id="ValidateServiceLogon"
        BinaryKey="CAIntro"
        DllEntry="ValidateServiceLogon"
        Execute="immediate" />

    <InstallExecuteSequence>
      <Custom Action="UpdateMongoYAML.SetProperty" Before="InstallFiles" />
      <Custom Action="UpdateMongoYAML" After="InstallFiles">MONGO_SERVICE_INSTALL AND NOT REMOVE</Custom>
    </InstallExecuteSequence>
  
    <Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />
    <WixVariable Id="WixUIDialogBmp" Value="$(var.ProjectDir)Dialog.bmp" />
    <WixVariable Id="WixUIBannerBmp" Value="$(var.ProjectDir)Banner.bmp" />
    <WixVariable Id="WixUIInfoIco" Value="$(var.ProjectDir)Installer_Icon_32x32.ico" />
    <WixVariable Id="WixUIExclamationIco" Value="$(var.ProjectDir)Installer_Icon_32x32.ico" />

    <Property Id="ARPPRODUCTICON" Value="MongoDBIcon" />
    <Property Id="ARPHELPLINK" Value="http://www.mongodb.org/" />
    <Property Id="ARPURLINFOABOUT" Value="http://www.mongodb.org/" />

    <Icon Id="MongoDBIcon" SourceFile="$(var.ProjectDir)Installer_Icon_32x32.ico" />
    <Binary Id="MongoDBIconBinary" SourceFile="$(var.ProjectDir)Installer_Icon_32x32.ico" />

    <FeatureGroupRef Id="fg_MongoDBAll" />

    <UIRef Id="MongoWixUI" />
    <UIRef Id="WixUI_ErrorProgressText" />
    <Property Id="WIXUI_INSTALLDIR" Value="INSTALLLOCATION" />

    <!-- Settings for Install MongoDB as a service -->
    <Property Id="MONGO_SERVICE_INSTALL" Value="0" Secure="yes" />
    <Property Id="MONGO_SERVICE_ACCOUNT_TYPE" Secure="yes" Value="ServiceLocalNetwork" />
    <Property Id="MONGO_SERVICE_NAME" Secure="yes" Value="MongoDB" />
    <Property Id="MONGO_SERVICE_ACCOUNT_DOMAIN" Value="." />
    <Property Id="MONGO_SERVICE_ACCOUNT_NAME" Secure="yes" Value="MongoDB" />
    <Property Id="MONGO_SERVICE_ACCOUNT_PASSWORD" Secure="yes" Hidden="yes"/>

    <Property Id="MONGO_DATA_PATH" Secure="yes" />
    <Property Id="MONGO_LOG_PATH" Secure="yes" />

    <util:Group Id="PerfmonGroup" Name="Performance Monitor Users" />

    <!-- 
        Setup the domain to use for granting permissions, the gotcha is the local machine.
        The util:User element wants an empty string for the domain for the local machine.
        The ServiceInstall element wants '.' for the domain for the local machine.
    -->
    <!-- Default the domain to grant to the user request -->
    <CustomAction Id="MongoDB.SetGrantAccountDefault"
        Property="MONGO_SERVICE_ACCOUNT_DOMAIN_GRANT" Value="[MONGO_SERVICE_ACCOUNT_DOMAIN]" />

    <!-- Change the domain to blank if the user specified '.' i.e. local machine -->
    <CustomAction Id="MongoDB.SetGrantAccountToBlank"
        Property="MONGO_SERVICE_ACCOUNT_DOMAIN_GRANT" Value="" />

    <!-- Change the domain to blank if the user specified '.' i.e. local machine -->
    <CustomAction Id="MongoDB.SetGrantAccountToNetworkAccount"
        Property="MONGO_SERVICE_ACCOUNT_DOMAIN_GRANT" Value="NT AUTHORITY" />

    <!-- Default to the fully qualified domain\account for the service account -->
    <CustomAction Id="MongoDB.SetServiceAccountDefault"
        Property="MONGO_SERVICE_FULL_ACCOUNT_NAME"
        Value="[MONGO_SERVICE_ACCOUNT_DOMAIN]\[MONGO_SERVICE_ACCOUNT_NAME]" />

    <!-- Default to .\account if the user left domain blank -->
    <CustomAction Id="MongoDB.SetServiceAccountToDot"
        Property="MONGO_SERVICE_FULL_ACCOUNT_NAME" Value=".\[MONGO_SERVICE_ACCOUNT_NAME]" />

    <!-- If the user chose network service, then just set the user account to Network Service -->
    <CustomAction Id="MongoDB.SetServiceNetworkAccount"
        Property="MONGO_SERVICE_FULL_ACCOUNT_NAME" Value="NT AUTHORITY\NetworkService" />
    <CustomAction Id="MongoDB.SetServiceNetworkAccount2"
        Property="MONGO_SERVICE_ACCOUNT_NAME" Value="NetworkService" />

    <InstallExecuteSequence>
        <Custom Action="MongoDB.SetGrantAccountDefault" After="CostFinalize" />
        <Custom Action="MongoDB.SetGrantAccountToBlank" After="CostFinalize">MONGO_SERVICE_ACCOUNT_DOMAIN = "."</Custom>
        <Custom Action="MongoDB.SetGrantAccountToNetworkAccount" After="CostFinalize">MONGO_SERVICE_ACCOUNT_TYPE = "ServiceLocalNetwork"</Custom>

        <Custom Action="MongoDB.SetServiceAccountDefault" After="CostFinalize" />
        <Custom Action="MongoDB.SetServiceAccountToDot" After="CostFinalize">MONGO_SERVICE_ACCOUNT_DOMAIN = ""</Custom>
        <Custom Action="MongoDB.SetServiceNetworkAccount" After="CostFinalize">MONGO_SERVICE_ACCOUNT_TYPE = "ServiceLocalNetwork"</Custom>
        <Custom Action="MongoDB.SetServiceNetworkAccount2" After="CostFinalize">MONGO_SERVICE_ACCOUNT_TYPE = "ServiceLocalNetwork"</Custom>
    </InstallExecuteSequence>

    <Property Id="MONGO_MULTIPLE_SKU" >
        <RegistrySearch Id="Mongo_Multiple_Sku"
            Root="HKLM"
            Key="Software\MongoDB\Server\$(var.MongoDBMajorVersion)"
            Name="Edition"
            Type="raw" />
    </Property>

    <Condition Message="You cannot install multiple editions for the same version of MongoDB. Already installed product '[MONGO_MULTIPLE_SKU]' conflicts with this product.">
        Installed OR (NOT MONGO_MULTIPLE_SKU OR MONGO_MULTIPLE_SKU = "!(wix.ProductMajorName)")
    </Condition>

    <Property Id="SHOULD_INSTALL_COMPASS" Secure="yes" Value="1" />

    <Property Id="POWERSHELLVERSION">
      <RegistrySearch
          Id="POWERSHELLVERSION"
          Type="raw"
          Root="HKLM"
          Key="SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine\PowerShellVersion"
          Name="Path" />
    </Property>
    <Condition Message="You must have PowerShell 3.0 or higher.">
      <![CDATA[Installed OR POWERSHELLVERSION >= 3.0]]>
    </Condition>

    <Property Id="POWERSHELLEXE">
      <RegistrySearch
          Id="POWERSHELLEXE"
          Type="raw"
          Root="HKLM"
          Key="SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell"
          Name="Path" />
    </Property>

    <SetProperty
        Id="InstallCompassScript"
        Before="InstallCompassScript"
        Sequence="execute"
        Value ="&quot;[POWERSHELLEXE]&quot; -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command &quot;&amp; '[#InstallCompassScript]' ; exit $$($Error.Count)&quot;" />

    <CustomAction
        Id="InstallCompassScript"
        BinaryKey="WixCA"
        DllEntry="WixQuietExec64"
        Execute="deferred"
        Return="ignore"
        Impersonate="yes" />

    <InstallExecuteSequence>
      <Custom Action='InstallCompassScript' After='InstallFiles'>
        (NOT Installed) AND (SHOULD_INSTALL_COMPASS = 1)
      </Custom>
    </InstallExecuteSequence>

  </Product>
</Wix>