summaryrefslogtreecommitdiff
path: root/win/packaging/extra.wxs.in
blob: 5aab7bc813cf2a3eee349c769a1d099d622986f5 (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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"  xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
  <Fragment>
    <!--
      Check, if upgrade wizard was built 
      It currently requires MFC, which is not in SDK 
      neither in express edítions of VS.
    -->
    <?ifndef HaveUpgradeWizard ?>
      <?define HaveUpgradeWizard="1"?>
    <?endif?>

    <!-- If Innodb is compiled in, enable "optimize for transactions" checkbox -->
    <?ifndef HaveInnodb ?>
      <?define HaveInnodb="0"?>
    <?endif?>

    <Property Id="PortTemplate" Value="#####" />
    <?if $(var.HaveInnodb) = "1" ?>
      <Property Id="BufferPoolSizeTemplate" Value="#######" />
    <?endif?>
    <!--
      Installation parameters that can be passed via msiexec command line
      For "booleans" (like skip networking), just providing any value means property set to "yes".
    -->
    <!-- instalation directory (default under program files)-->
    <!--- (defined elsewhere) <Property Id="INSTALLDIR" Secure="yes" /> -->

    <!-- Database data directory (default under INSTALLDIR\data) -->
    <!--- (defined elsewhere) <Property Id="DATADIR" Secure="yes"/> -->

    <!-- Service name of database instanced (default MySQL in GUI, nothing with command line) -->
    <!--  (defined elsewhere) <Property Id="SERVICENAME" Secure="yes" /> -->

    <!-- Root password -->
    <Property Id="PASSWORD" Hidden="yes" Secure="yes" />
    <!-- Database port -->
    <Property Id="PORT" Value="3306" Secure="yes"/>
    <!-- Whether to allow remote access for root user -->
    <Property Id="ALLOWREMOTEROOTACCESS" Secure="yes" />
    <!-- Skip networking. This will switch configuration to use named pipe-->
    <Property Id="SKIPNETWORKING" Secure="yes"/>
    <!-- Whether to keep default (unauthenticated) user. Default is no-->
    <Property Id="DEFAULTUSER" Secure="yes"/>
    <!-- Whether to data on uninstall (default yes, after asking user consent) -->
    <Property Id="CLEANUPDATA" Secure="yes" Value="1"/>
    <!-- Force per machine installation -->
    <Property Id="ALLUSERS" Secure="yes" Value="1"/>
    <!-- Disable advertised shortcuts weirdness -->
    <Property Id="DISABLEADVTSHORTCUTS" Secure="yes" Value="1"/>

    <?if $(var.HaveInnodb) = "1" ?>
      <!-- Quick configuration : set default storage engine to innodb, use strict sql_mode -->
      <Property Id="STDCONFIG" Secure="yes" Value="1"/>
    <?endif?>
    <!-- Innodb Buffer pool size in MB-->
    <Property Id="BUFFERPOOLSIZE" Secure="yes"/>


    <!-- 
      User interface dialogs 
     -->
    <WixVariable Id='WixUIBannerBmp' Value='@CMAKE_CURRENT_SOURCE_DIR@\WixUIBannerBmp.jpg' />
    <WixVariable Id='WixUIDialogBmp' Value='@CMAKE_CURRENT_SOURCE_DIR@\WixUIDialogBmp.jpg' />
    <UI>

      <!-- Dialog on uninstall of the database -->
      <Dialog Id="ConfirmDataCleanupDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">

        <!--<Control Id="CleanupDataCheckBox" Type="CheckBox" X="20" Y="100" Height="30" Property="CLEANUPDATA" Width="300" CheckBoxValue="1"
                Text="{\Font1}Remove default database directory &#xD;&#xA;'[DATADIR]'"/>
                -->
        <Control Id="RemoveDatadirButton" Type="PushButton" X="40" Y="65" Width="80" Height="18"
                  Text="Remove data">
          <Publish Property="CLEANUPDATA" Value="1">1</Publish>
          <Publish Event="NewDialog" Value="VerifyReadyDlg">WixUI_InstallMode</Publish>
          <Publish Event="EndDialog" Value="Return">NOT WixUI_InstallMode</Publish>

        </Control>
        <Control Id="RemoveDatadirText" Type="Text" X="60" Y="85" Width="280" Height="20">
          <Text>Remove default database directory [DATADIR]. Ensures proper cleanup on uninstall.</Text>
        </Control>

        <Control Id="KeepDatadirButton" Type="PushButton" X="40" Y="118" Width="80" Height="18"
                 Text="Keep data">
          <Publish Property="CLEANUPDATA">1</Publish>
          <Publish Event="NewDialog" Value="VerifyReadyDlg">WixUI_InstallMode</Publish>
          <Publish Event="EndDialog" Value="Return">NOT WixUI_InstallMode</Publish>
        </Control>
        <Control Id="KeepDataDirText" Type="Text" X="60" Y="138" Width="280" Height="70" >
          <Text>Do not remove [DATADIR]. Choose this option if you intend to use data in the future</Text>
        </Control>


        <!-- Navigation buttons-->
        <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&amp;Back">
          <Publish Event="NewDialog" Value="CustomizeDlg">WixUI_InstallMode="Change"</Publish>
          <Condition Action="disable">NOT WixUI_InstallMode</Condition>
        </Control>
        <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Disabled="yes" Text="&amp;Next">
          <Publish Event="NewDialog" Value="VerifyReadyDlg">WixUI_InstallMode</Publish>
          <Publish Event="EndDialog" Value="Return">NOT WixUI_InstallMode</Publish>
        </Control>
        <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
          <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
        </Control>
        <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="WixUI_Bmp_Banner" />
        <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes">
          <Text>Remove default [ProductName] database</Text>
        </Control>
        <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
        <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
          <Text>{\WixUI_Font_Title}Default instance properties</Text>
        </Control>
        <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
      </Dialog>

      <!-- Dialog new or upgrade instance -->

      <Property Id="CreateOrUpgradeChoice" Value="Create"/>
      
      <Dialog Id="NewOrUpgradeInstanceDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
        <Control Id="Text" Type="Text" X="40" Y="65" Width="270" Height="30">
          <Text>Setup found existing database instances that can be upgraded to [ProductName].You can create a new instance and/or upgrade existing one.
          </Text>
        </Control>

        <Control Id="CreateOrUpgradeButton" 
                 Type="RadioButtonGroup" X="40" Y="100" Width="300" Height="70" 
                 Property="CreateOrUpgradeChoice" Text="Specify what to do">
          <RadioButtonGroup Property="CreateOrUpgradeChoice">
            <RadioButton Value="Create" X="0" Y="0" Width="300" Height="25"
                  Text="{\Font1}Create new database instance."/>
            <RadioButton Value="Upgrade" X="0" Y="30" Width="300" Height="25"
                  Text="{\Font1}Do not create a new database. Optionally upgrade existing instances." />
          </RadioButtonGroup>
        </Control>

        <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&amp;Back">
          <Publish Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
        </Control>
        <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Text="&amp;Next">
          <Publish Event="Remove" Value="DBInstance">CreateOrUpgradeChoice = "Upgrade" </Publish>
          <Publish Event="AddLocal" Value="DBInstance">CreateOrUpgradeChoice = "Create"</Publish>
          <Publish Event="NewDialog" Value="CustomizeDlg">1</Publish>
        </Control>
        <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
          <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
        </Control>
        <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="WixUI_Bmp_Banner" />
        <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes">
          <Text>Create or upgrade database instance</Text>
        </Control>
        <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
        <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
          <Text>{\WixUI_Font_Title}[ProductName] setup</Text>
        </Control>
        <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
      </Dialog>
      
      <!-- Error popup dialog -->
      <Dialog Id="WarningDlg" Width="320" Height="85" Title="[ProductName] Setup" NoMinimize="yes">
       <Control Id="Icon" Type="Icon" X="15" Y="15" Width="24" Height="24"
       ToolTip="Information icon" FixedSize="yes" IconSize="32" Text="WixUI_Ico_Info" />
        <Control Id="Ok" Type="PushButton" X="132" Y="57" Width="56" Height="17"
          Default="yes" Cancel="yes" Text="OK">
          <Publish Property="WarningText">1</Publish>
          <Publish Event="EndDialog" Value="Return">1</Publish>
        </Control>
        <Control Id="Text" Type="Text" X="48" Y="15" Width="260" Height="30">
          <Text>[WarningText]</Text>
        </Control>
      </Dialog>


      <Property Id="ModifyRootPassword" Value="1"/>
      <TextStyle Id="Font1" FaceName="Tahoma" Size="8" Red="0" Green="0" Blue="0" Bold="yes" />

      <!-- Root password plus default user dialog  -->
      <Dialog Id="UserSettingsDlg" X="50" Y="50" Width="370" Height="270" Title="User settings">
        <Control Id="EditRootPassword" Type="Edit" X="104" Y="82" Width="91" Height="15" Property="PASSWORD" Password="yes" TabSkip="no">
          <Text>{100}</Text>
          <Condition Action="enable">ModifyRootPassword</Condition>
          <Condition Action="disable">NOT ModifyRootPassword</Condition>
        </Control>
        <Control Id="EditRootPasswordConfirm" Type="Edit" X="104" Y="103" Width="91" Height="15" Property="RootPasswordConfirm"  Password="yes" TabSkip="no">
          <Text>{100}</Text>
          <Condition Action="enable">ModifyRootPassword</Condition>
          <Condition Action="disable">NOT ModifyRootPassword</Condition>
        </Control>

        <Control Id="CheckBoxModifyRootPassword" Type="CheckBox" X="8" Y="62" Width="222" Height="18" Property="ModifyRootPassword" CheckBoxValue="1" TabSkip="no">
          <Text>{\Font1}Modify root password</Text>
          <Publish Property="PASSWORD" >NOT ModifyRootPassword</Publish>
          <Publish Property="RootPasswordConfirm">NOT ModifyRootPassword</Publish>
          <Publish Property="ALLOWREMOTEROOTACCESS">NOT ModifyRootPassword</Publish>
          <Publish Property="ALLOWREMOTEROOTACCESS" Value="1">ModifyRootPassword</Publish>
        </Control>

        <Control Id="Text5" Type="Text" X="23" Y="82" Width="77" Height="14" TabSkip="yes">
          <Text>New root password:</Text>
        </Control>
        <Control Id="Text6" Type="Text" X="201" Y="85" Width="100" Height="17" TabSkip="yes">
          <Text>Enter new root password</Text>
        </Control>
        <Control Id="Text8" Type="Text" X="23" Y="105" Width="75" Height="17" TabSkip="yes">
          <Text>Confirm:</Text>
        </Control>

        <Control Id="Text10" Type="Text" X="201" Y="104" Width="100" Height="17" TabSkip="yes">
          <Text>Retype the password</Text>
        </Control>
        <Control Id="CheckBoxALLOWREMOTEROOTACCESS" Type="CheckBox" X="23" Y="122" Width="196" Height="18" Property="ALLOWREMOTEROOTACCESS"
                 CheckBoxValue="--allow-remote-root-access" TabSkip="no">
          <Text>{\Font1}Enable root access from remote machines</Text>
          <Condition Action="enable">ModifyRootPassword</Condition>
          <Condition Action="disable">NOT ModifyRootPassword</Condition>
        </Control>

        <Control Id="CheckBoxCreateDefaultUser" Type="CheckBox" X="8" Y="154" Width="200" Height="18" Property="DEFAULTUSER"
                 CheckBoxValue="--default-user" TabSkip="no">
          <Text>{\Font1}Create An Anonymous Account</Text>
        </Control>
        <Control Id="Text14" Type="Text" X="21" Y="174" Width="268" Height="16" TabSkip="yes">
          <Text>This option will create an anonymous account on this server. </Text>
        </Control>
        <Control Id="Text13" Type="Text" X="21" Y="190" Width="254" Height="24" TabSkip="yes">
          <Text>Please note: this setting can lead to insecure systems.</Text>
        </Control>

        <!-- Navigation buttons-->
        <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&amp;Back">
          <Publish Event="NewDialog" Value="CustomizeDlg">1</Publish>
        </Control>
        <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="&amp;Next">
          <Publish Property="WarningText" Value="Passwords do not match."><![CDATA[PASSWORD <> RootPasswordConfirm]]></Publish>
          <Publish Event="SpawnDialog" Value="WarningDlg"><![CDATA[WarningText <>""]]></Publish>
          <Publish Property="SERVICENAME" Value="MySQL">NOT SERVICENAME AND NOT WarningText</Publish>
          <Publish Event="NewDialog" Value="ServicePortDlg"><![CDATA[WarningText=""]]></Publish>
          <Condition Action="enable"><![CDATA[NOT ModifyRootPassword OR PASSWORD]]> </Condition>
          <Condition Action="disable"><![CDATA[ModifyRootPassword AND (NOT PASSWORD)]]> </Condition>
        </Control>
        <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
          <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
        </Control>
        <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="WixUI_Bmp_Banner" />
        <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes">
          <Text> [ProductName] database configuration</Text>
        </Control>
        <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
        <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
          <Text>{\WixUI_Font_Title}Default instance properties</Text>
        </Control>
        <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
      </Dialog>

      <Property Id="InstallService" Value="1"/>
      <Property Id="EnableNetworking" Value="1"/>

      <!-- Service and port configuration -->
      <Dialog Id="ServicePortDlg" Width="370" Height="270" Title="Database settings">
        <Control Id="InstallAsService" Type="CheckBox" X="9" Y="61" Width="222" Height="19" Property="InstallService" CheckBoxValue="1" TabSkip="no">
          <Text>{\Font1}Install as service</Text>
        </Control>
        <Control Id="EditServiceName" Type="Edit" X="104" Y="82" Width="91" Height="15" Property="SERVICENAME" TabSkip="no">
          <Text>{20}</Text>
          <Condition Action="enable">InstallService</Condition>
          <Condition Action="disable">Not InstallService</Condition>
        </Control>
        <Control Id="Text5" Type="Text" X="25" Y="82" Width="77" Height="14" TabSkip="yes">
          <Text>Service Name:</Text>
        </Control>
        <Control Id="CheckBoxEnableNetworking" Type="CheckBox" Height="18" Width="102" X="9" Y="117" Property="EnableNetworking" CheckBoxValue="1">
          <Text>{\Font1}Enable networking</Text>
          <!--<Publish Property="PORT">NOT EnableNetworking</Publish>-->
          <Publish Property="SKIPNETWORKING" Value="--skip-networking">NOT EnableNetworking</Publish>
          <Publish Property="SKIPNETWORKING">EnableNetworking</Publish>
        </Control>
        <Control Id="LabelTCPPort" Type="Text" Height="17" Width="75" X="25" Y="142" Text="TCP port:" />
        <Control Id="Port" Type="MaskedEdit" X="104" Y="140" Width="28" Height="15" Property="PORT"  Sunken="yes" Text="[PortTemplate]">
          <Condition Action="enable" >EnableNetworking</Condition>
          <Condition Action="disable">Not EnableNetworking</Condition>
        </Control>

        <?if $(var.HaveInnodb) = "1" ?>
        <Control Id="CheckBoxStandardConfig" Type="CheckBox" Height="18" Width="220" X="9" Y="171" Property="STDCONFIG" CheckBoxValue="1">
          <Text>{\Font1}Optimize for transactions</Text>
        </Control>

        <Control Id="StandardConfigExplain" Type="Text" X="25" Y="190" Width="270" Height="14" TabSkip="yes">
          <Text>(Uses transactional storage engine and "strict" SQL mode)</Text>
          <Condition Action="enable" >STDCONFIG</Condition>
          <Condition Action="disable">Not STDCONFIG</Condition>
        </Control>
        <Control Id="LabelInnodbBufferpool" Type="Text" Height="17" Width="77" X="25" Y="210" Text="Buffer pool size:" >
        <Condition Action="enable" >STDCONFIG</Condition>
          <Condition Action="disable">Not STDCONFIG</Condition>
        </Control>
        <Control Id="BPSize" Type="MaskedEdit" X="104" Y="208" Width="40" Height="15" Property="BUFFERPOOLSIZE"  Sunken="yes" Text="[BufferPoolSizeTemplate]">
          <Condition Action="enable" >STDCONFIG</Condition>
          <Condition Action="disable">Not STDCONFIG</Condition>
        </Control>
        <Control Id="LabelMB" Type="Text" Height="17" Width="15" X="150" Y="210" Text="MB" >
        <Condition Action="enable" >STDCONFIG</Condition>
          <Condition Action="disable">Not STDCONFIG</Condition>
        </Control>
       <?endif?>

        <!-- Navigation buttons-->
        <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&amp;Back">
          <Publish Event="NewDialog" Value="UserSettingsDlg">1</Publish>
        </Control>
        <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="no" Text="&amp;Next">
          <Publish Property="SERVICENAME">NOT InstallService</Publish>
          <Publish Property="WarningText" Value="Please enter valid port or uncheck 'Enable Networking' checkbox">
            <![CDATA[EnableNetworking AND NOT PORT AND NOT WarningText]]>
          </Publish>
          <Publish Property="WarningText" Value="Please enter valid service name port or uncheck 'Install Service' checkbox">
            <![CDATA[InstallService AND NOT SERVICENAME AND NOT WarningText]]>
          </Publish>
          <Publish Event="DoAction" Value="CheckDatabaseProperties">NOT WarningText</Publish>
          <Publish Event="SpawnDialog" Value="WarningDlg">WarningText</Publish>
          <Publish Event="NewDialog" Value="VerifyReadyDlg">Not WarningText</Publish>
        </Control>
        <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="no" Text="Cancel">
          <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
        </Control>
        <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="WixUI_Bmp_Banner" />
        <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes">
          <Text>[ProductName] database configuration</Text>
        </Control>
        <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="2" />
        <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
          <Text>{\WixUI_Font_Title}Default instance properties</Text>
        </Control>
        <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="2" />
      </Dialog>
    </UI>

    <Property Id="CRLF" Value="&#xD;&#xA;" />
    <CustomAction Id="CheckDataDirectoryEmpty" BinaryKey="wixca.dll" DllEntry="CheckDataDirectoryEmpty" Execute="immediate" Impersonate="yes"/>
    <!--  What to do when navigation buttons are clicked -->
    <UI Id="MyWixUI_Mondo">
      <UIRef Id="WixUI_FeatureTree" />
      <UIRef Id="WixUI_ErrorProgressText" />
      <Publish Dialog="WelcomeDlg"  Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="999">
        OLDERVERSIONBEINGUPGRADED
      </Publish>
      <Publish Dialog="LicenseAgreementDlg"  Control="Next" Event="NewDialog" Value="NewOrUpgradeInstanceDlg" Order="999">
        NOT Installed AND UpgradableServiceFound
      </Publish>

      <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="ServicePortDlg" Order="3" ><![CDATA[&DBInstance=3 AND NOT !DBInstance=3]]></Publish>
      <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="3"> <![CDATA[OLDERVERSIONBEINGUPGRADED <>""]]></Publish>
      <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="ConfirmDataCleanupDlg" Order="1" ><![CDATA[(&DBInstance=2) AND (!DBInstance=3)]]></Publish>


      <Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="NewOrUpgradeInstanceDlg" Order="999">
        NOT Installed AND UpgradableServiceFound
      </Publish>
      <Publish Dialog="CustomizeDlg" Control="Next" Event="DoAction" Value="CheckDataDirectoryEmpty" Order="1"><![CDATA[&DBInstance=3 AND NOT !DBInstance=3]]></Publish>
      <Publish Dialog="CustomizeDlg" Property="DATADIRNOTEMPTY" Control="Next"  Order="1"><![CDATA[NOT(&DBInstance=3 AND NOT !DBInstance=3)]]></Publish>
      <Publish  Dialog="CustomizeDlg" Control="Next"  Property="WarningText" Order="2"
         Value="Selected data directory [DATADIR] is not empty. Either clean it, or choose another location for 'Database Instance' feature.">
        DATADIRNOTEMPTY
      </Publish>
      <Publish Dialog="CustomizeDlg" Control="Next" Event="SpawnDialog" Value="WarningDlg" Order="3">WarningText</Publish>
      <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="ConfirmDataCleanupDlg" Order="4">
        <![CDATA[(&DBInstance=2) AND (!DBInstance=3)]]>
      </Publish>
      <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="UserSettingsDlg" Order="5">
        <![CDATA[&DBInstance=3 AND NOT !DBInstance=3 AND NOT WarningText]]>
      </Publish>

      <Publish Dialog="ConfirmDataCleanupDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg">WixUI_InstallMode = "Change"</Publish>
      <Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="ConfirmDataCleanupDlg" Order="999">
        !DBInstance=3 AND (CLEANUPDATA Or USECONFIRMDATACLEANUPDLG)
      </Publish>
      <Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Property="USECONFIRMDATACLEANUPDLG" Value="1" Order="999">
        !DBInstance=3 AND CLEANUPDATA
      </Publish>
      <Publish Dialog="ConfirmDataCleanupDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg">WixUI_InstallMode = "Remove"</Publish>
    </UI>

    <!-- End of UI section -->

    <!-- Extra folders we need (DATADIR and shortcut folder) -->
    <DirectoryRef Id='INSTALLDIR'>
      <Directory Id="DATADIR" Name="data">
      </Directory>
      <Directory Id="ProgramMenuFolder">
        <Directory Id="ShortcutFolder" Name="@CPACK_WIX_PACKAGE_NAME@">
        </Directory>
      </Directory>
    </DirectoryRef>


    <!-- Extra feature (database instance). This could be split to several subfeatures if desired (e.g firewall exception)-->
    <Feature Id='DBInstance'
         Title='Database instance'
         Description=
             'Install database instance. Only new database can be installed with this feature.'
         ConfigurableDirectory='DATADIR'
         AllowAdvertise='no'
         Level='1'>

      <!-- Data directory with some reasonable security settings -->
      <Component Id="C.datadir" Guid="*" Directory="DATADIR">
        <RegistryValue Root='HKLM'
           Key='SOFTWARE\@MANUFACTURER@\@CPACK_WIX_PACKAGE_NAME@'
           Name='DATADIR' Value='[DATADIR]' Type='string' KeyPath='yes'/>
        <CreateFolder>
          <util:PermissionEx User="[LogonUser]" GenericAll="yes" />
          <util:PermissionEx User="NetworkService" GenericAll="yes" />
        </CreateFolder>
      </Component>

      <!-- Database service conditioned on SERVICENAME property-->
      <Component Id="C.service" Guid="*" Directory="DATADIR">
        <Condition>SERVICENAME</Condition>
        <RegistryValue Root='HKLM'
           Key='SOFTWARE\@MANUFACTURER@\@CPACK_WIX_PACKAGE_NAME@'
           Name='SERVICENAME' Value='[SERVICENAME]' Type='string' KeyPath='yes'/>
        <ServiceControl Id='DBInstanceServiceStop' Name='[SERVICENAME]'  Stop='both' Remove='uninstall' Wait='yes'/>
        <ServiceControl Id='DBInstanceServiceStart' Name='[SERVICENAME]' Start='install' Wait='yes'/>
      </Component>
      <?if $(var.HaveInnodb) = "1" ?>
      <Component Id="C.myiniconfig" Guid="*" Directory="DATADIR">
      <Condition>STDCONFIG</Condition>
        <RegistryValue Root='HKLM'
           Key='SOFTWARE\@MANUFACTURER@\@CPACK_WIX_PACKAGE_NAME@'
           Name='STDCONFIG' Value='1' Type='string' KeyPath='yes'/>
        <IniFile Id="Ini1"
            Action="createLine"
            Directory="DATADIR"
            Section="mysqld"
            Name="my.ini"
            Key="sql_mode"
            Value="&quot;STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION&quot;" />
        <IniFile Id="Ini2"
            Action="createLine"
            Directory="DATADIR"
            Section="mysqld"
            Name="my.ini"
            Key="default_storage_engine"
            Value="innodb" />
        <IniFile Id="Ini3"
            Action="createLine"
            Directory="DATADIR"
            Section="mysqld"
            Name="my.ini"
            Key="innodb_buffer_pool_size"
            Value="[BUFFERPOOLSIZE]M" />
        <IniFile Id="Ini4"
            Action="createLine"
            Directory="DATADIR"
            Section="mysqld"
            Name="my.ini"
            Key="innodb_log_file_size"
            Value="[LOGFILESIZE]M" />
      </Component>
      <?endif?>
      <!--- Grant service account permission to the database folder (Windows 7 and later) -->
      <Component Id="C.serviceaccount.permission" Guid="*" Directory='DATADIR' Transitive='yes'>
        <Condition><![CDATA[SERVICENAME AND (VersionNT > 600)]]></Condition>
        <RegistryValue Root='HKLM'
             Key='SOFTWARE\@MANUFACTURER@\@CPACK_WIX_PACKAGE_NAME@'
             Name='servicepermission' Value='1' Type='string' KeyPath='yes'/>
        <CreateFolder>
          <util:PermissionEx User="NT SERVICE\[SERVICENAME]" GenericAll="yes" />
        </CreateFolder>
      </Component>

      <!-- Shortcuts in program menu (mysql client etc) -->
      <Component Id="c.shortcuts" Guid="*" Directory="ShortcutFolder">
        <!-- shortcut to my.ini-->
        <RegistryValue  Root="HKCU" Key="Software\@CPACK_WIX_PACKAGE_NAME@\Uninstall" Name="shortcuts" Value="1" Type="string" KeyPath="yes"  />
        <RemoveFolder Id="RemoveShorcutFolder" On="uninstall" />
        <Shortcut Id="shortcut.my.ini"
          Name="my.ini (@CPACK_WIX_PACKAGE_NAME@)"
          Target="[System64Folder]notepad.exe"
          Arguments="&quot;[DATADIR]my.ini&quot;"
          Directory="ShortcutFolder"
          Description="Edit database configuration" />
        <Shortcut Id="shortcut.errorlog"
          Name="Error log (@CPACK_WIX_PACKAGE_NAME@)"
          Target="[System64Folder]notepad.exe"
          Arguments="&quot;[DATADIR][ComputerName].err&quot;"
          Directory="ShortcutFolder"
          Description="View Database Error log" />
        <Shortcut Id="shortcut.dbfolder" Name="Database directory (@CPACK_WIX_PACKAGE_NAME@)"
          Target="[DATADIR]" />
      </Component>

      <!-- add reference so mysql client won't get uninstalled and we have a shortcut pointing to nowhere-->
      <ComponentRef Id="C.bin.mysql.exe"/>

      <Component Id="c.shortcuts.commandline" Guid="*" Directory="ShortcutFolder">
        <RegistryValue
          Root="HKCU" Key="Software\@CPACK_WIX_PACKAGE_NAME@\Uninstall"
          Name="shortcuts.commandline"
          Value="1" Type="string" KeyPath="yes" />
        <!-- shortcut to client-->
        <Shortcut Id="shortcut.mysql.exe"
          Name="MySQL Client (@CPACK_WIX_PACKAGE_NAME@)"
          Target="[System64Folder]cmd.exe"
          Arguments="/k &quot; &quot;[D.bin]mysql.exe&quot; &quot;--defaults-file=[DATADIR]my.ini&quot; -uroot -p&quot;"
          Directory="ShortcutFolder"
          WorkingDirectory="D.bin"
          Description="Starts mysql.exe for root user"  />
      </Component>
      <Component Id="c.shortcuts.commandprompt.db"  Guid="*"  Directory="ShortcutFolder" Transitive="yes">
        <Condition>SERVICENAME</Condition>
        <RegistryValue
        Root="HKCU" Key="Software\@CPACK_WIX_PACKAGE_NAME@\Uninstall"
        Name="shortcuts.commandprompt.db"
        Value="1" Type="string" KeyPath="yes" />
        <!-- just command prompt in the bin directory (so all utilities can be called) -->
        <Shortcut Id="shortcut.commandprompt.exe.db"
          Name="Command Prompt (@CPACK_WIX_PACKAGE_NAME@)"
          Target="[System64Folder]cmd.exe"
          Directory="ShortcutFolder"
          Arguments="/k  &quot;set MYSQL_HOME=[DATADIR]&amp;&amp; set PATH=[D.bin];%PATH%;&amp;&amp;echo Setting environment for [ProductName] &quot;"
          Description="Opens command line in the installation bin directory" />
      </Component>


    </Feature>

    <Feature Id="SharedClientServerComponents"
      Title='Utilities used by both server and client.'
      Description=
      'Client utilities that are also used with server.Required for upgrade.'
      ConfigurableDirectory='INSTALLDIR'
      AllowAdvertise='no'
      Level='1'
      Display='hidden'>
      <ComponentRef Id='C.bin.mysql.exe'/>
      <ComponentRef Id='C.bin.mysqladmin.exe'/>
      <ComponentRef Id='C.bin.mysql_upgrade.exe'/>
      <ComponentRef Id='C.bin.mysqlcheck.exe'/>
      <Component Id="c.shortcuts.commandprompt.nodb"  Guid="*"  Directory="ShortcutFolder" Transitive="yes">
        <Condition>NOT SERVICENAME</Condition>
        <RegistryValue
          Root="HKCU" Key="Software\@CPACK_WIX_PACKAGE_NAME@\Uninstall"
          Name="shortcuts.commandprompt.nodb"
          Value="1" Type="string" KeyPath="yes" />
        <!-- just command prompt in the bin directory (so all utilities can be called) -->
        <Shortcut Id="shortcut.commandprompt.exe.nodb"
          Name="Command Prompt (@CPACK_WIX_PACKAGE_NAME@)"
          Target="[System64Folder]cmd.exe"
          Directory="ShortcutFolder"
          Arguments="/k  &quot;set PATH=[D.bin];%PATH%;&amp;&amp;echo Setting environment for [ProductName] &quot;"
          Description="Opens command line in the installation bin directory" />
      </Component>
     <?if $(var.HaveUpgradeWizard) != "0" ?>
     <ComponentRef Id='C.bin.mysql_upgrade_wizard.exe'/>
     <Component Id="c.shortcuts.upgrade_wizard"  Guid="*"  Directory="ShortcutFolder" Transitive="yes">
       <RegistryValue
       Root="HKCU" Key="Software\@CPACK_WIX_PACKAGE_NAME@\Uninstall"
       Name="shortcuts.upgrade_wizard"
       Value="1" Type="string" KeyPath="yes" />
      <Shortcut Id="shortcut.upgrade_wizard"
        Name="Upgrade Wizard (@CPACK_WIX_PACKAGE_NAME@)"
       Target="[INSTALLDIR]bin\mysql_upgrade_wizard.exe"
       Directory="ShortcutFolder"
       Description="Upgrades older instances of MariaDB/MySQL services to version @MAJOR_VERSION@.@MINOR_VERSION@"  
       Advertise="no"/>
     </Component>
     <?endif?>
    </Feature>

    <!-- Optional 3rd party tools -->
    <DirectoryRef Id='TARGETDIR'>
     <Directory Id='CommonFilesFolder'>
       <Directory Id='MariaDBShared' Name='MariaDBShared'/>
     </Directory>
     <Directory Id='DesktopFolder'/>
     </DirectoryRef>


    <?if "@WITH_THIRD_PARTY@" != "" ?>

    <!-- Include definition of 3party components -->
    <?foreach tool in @WITH_THIRD_PARTY@ ?>
     <?include "${CMAKE_CURRENT_BINARY_DIR}\$(var.tool).wxi" ?>
    <?endforeach ?>

    <Feature Id="ThirdPartyTools"
      Title='Third party tools'
      Description= 'Third party tools'
      AllowAdvertise='no'
      Level='1'
      Display='expand'>
    @THIRD_PARTY_FEATURE_CONDITION@
    <!-- Include definition of 3rd party features -->
    <?foreach tool in @WITH_THIRD_PARTY@ ?>
     <?include "${CMAKE_CURRENT_BINARY_DIR}\$(var.tool)_feature.wxi" ?>
    <?endforeach ?>

   </Feature>
   
   <?endif ?>
   
    <!--  Custom action, call mysql_install_db  -->
    <SetProperty  Sequence='execute'  Before='CreateDatabaseCommand' Id="SKIPNETWORKING"  Value="--skip-networking" >SKIPNETWORKING</SetProperty>
    <SetProperty Sequence='execute'  Before='CreateDatabaseCommand'  Id="ALLOWREMOTEROOTACCESS" Value="--allow-remote-root-access">ALLOWREMOTEROOTACCESS</SetProperty>
    <SetProperty Sequence='execute'  Before='CreateDatabaseCommand' Id="DEFAULTUSER" Value="--default-user">DEFAULTUSER</SetProperty>
    <CustomAction Id='CheckDatabaseProperties' BinaryKey='wixca.dll' DllEntry='CheckDatabaseProperties' />
    <CustomAction Id='PresetDatabaseProperties' BinaryKey='wixca.dll' DllEntry='PresetDatabaseProperties' />
    <CustomAction Id="CreateDatabaseCommand" Property="CreateDatabase"
    Value=
    "&quot;[#F.bin.mysql_install_db.exe]&quot;  &quot;--service=[SERVICENAME]&quot; --port=[PORT] &quot;--password=[PASSWORD]&quot; &quot;--datadir=[DATADIR]\&quot; [SKIPNETWORKING] [ALLOWREMOTEROOTACCESS] [DEFAULTUSER]"
     Execute="immediate"
     HideTarget="yes"
     />
    <CustomAction Id="CreateDatabaseRollbackCommand" Property="CreateDatabaseRollback"
        Value="[SERVICENAME]\[DATADIR]"
        Execute="immediate"/>
    <CustomAction Id="CreateDatabase" BinaryKey="WixCA" DllEntry="CAQuietExec"
            Execute="deferred" Return="check" Impersonate="no" />
    <CustomAction Id="CreateDatabaseRollback" BinaryKey="wixca.dll" DllEntry="CreateDatabaseRollback"
        Execute="rollback" Return="check" Impersonate="no"/>
    <UI>
      <ProgressText Action="CreateDatabase">Running mysql_install_db.exe</ProgressText>
    </UI>

    <!-- Error injection script activated by TEST_FAIL=1 passed to msiexec (to see how good custom action rollback works)  -->
    <Property Id="FailureProgram">
      <![CDATA[
         Function Main()
         Main = 3
         End Function
         ]]>
    </Property>
    <CustomAction Id="FakeFailure"
     VBScriptCall="Main"
     Property="FailureProgram"
     Execute="deferred" />

    <CustomAction Id='ErrorDataDirNotEmpty' 
                  Error='Chosen data directory [DATADIR] is not empty. It must be empty prior to installation.'/>
    <InstallExecuteSequence>
      <Custom Action="CheckDataDirectoryEmpty" After="CostFinalize">
        <![CDATA[&DBInstance=3 AND NOT !DBInstance=3 AND OLDERVERSIONBEINGUPGRADED=""]]>
      </Custom>
      <Custom Action="ErrorDataDirNotEmpty" After="CheckDataDirectoryEmpty" >DATADIRNOTEMPTY</Custom>

      <Custom Action="CreateDatabaseCommand" After="CostFinalize" >
        <![CDATA[&DBInstance=3 AND NOT !DBInstance=3 AND OLDERVERSIONBEINGUPGRADED=""]]>
      </Custom>
      <Custom Action="CreateDatabase" After="InstallFiles">
        <![CDATA[&DBInstance=3 AND NOT !DBInstance=3 AND OLDERVERSIONBEINGUPGRADED=""]]>
      </Custom>
      <Custom Action="CreateDatabaseRollbackCommand" After="CostFinalize">
        <![CDATA[&DBInstance=3 AND NOT !DBInstance=3 AND OLDERVERSIONBEINGUPGRADED=""]]>
      </Custom>
      <Custom Action="CreateDatabaseRollback" Before="CreateDatabase">
        <![CDATA[&DBInstance=3 AND NOT !DBInstance=3 AND OLDERVERSIONBEINGUPGRADED=""]]>
      </Custom>
      <Custom Action='FakeFailure' Before='InstallFinalize'>
        <![CDATA[&DBInstance=3 AND NOT !DBInstance=3 AND OLDERVERSIONBEINGUPGRADED="" AND TESTFAIL]]>
      </Custom>
    </InstallExecuteSequence>


    <!-- Custom action to remove data on uninstall  -->
    <Binary Id='wixca.dll' SourceFile='@WIXCA_LOCATION@' />
    <CustomAction Id="RemoveDataDirectory.SetProperty" Return="check" 
                  Property="RemoveDataDirectory" Value="[DATADIR]" />
    <CustomAction Id="RemoveDataDirectory"  BinaryKey="wixca.dll"
                  DllEntry="RemoveDataDirectory"
                  Execute="deferred"
                  Impersonate="no"
                  Return="ignore"   />
    <InstallExecuteSequence>
      <Custom Action="RemoveDataDirectory.SetProperty" After="CreateDatabaseCommand" >
        <![CDATA[($C.datadir=2) AND (CLEANUPDATA) AND NOT UPGRADINGPRODUCTCODE]]>
      </Custom>
      <Custom Action="RemoveDataDirectory" Before="RemoveFiles">
        <![CDATA[($C.datadir=2) AND (CLEANUPDATA) AND NOT UPGRADINGPRODUCTCODE]]>
      </Custom>
    </InstallExecuteSequence>

    <InstallExecuteSequence>
      <StopServices>SERVICENAME</StopServices>
      <DeleteServices>SERVICENAME</DeleteServices>
    </InstallExecuteSequence>
    <CustomAction Id="CheckDBInUse" Return="ignore" 
                  BinaryKey="wixca.dll" DllEntry="CheckDBInUse"  Execute="firstSequence"/>
    <InstallExecuteSequence>
      <Custom Action="CheckDBInUse" Before="LaunchConditions">Installed</Custom>
      <Custom Action="PresetDatabaseProperties" After="CheckDBInUse"></Custom>
    </InstallExecuteSequence>
    <InstallUISequence>
      <Custom Action="CheckDBInUse" Before="LaunchConditions">Installed</Custom>
      <Custom Action="PresetDatabaseProperties" After="CheckDBInUse"></Custom>
    </InstallUISequence>

    <!-- Store some properties persistently in registry, mainly for upgrades -->

    <Feature Id='StoreInstallLocation' Level='1' Absent='disallow' Display='hidden'>
      <Component Directory='INSTALLDIR' Guid='*' Id='C.storeinstalllocation'>
        <RegistryValue Root='HKLM' Key='SOFTWARE\@MANUFACTURER@\@CPACK_WIX_PACKAGE_NAME@' 
                       Name='INSTALLDIR' Value='[INSTALLDIR]' Type='string'  KeyPath='yes'/>
      </Component>
    </Feature>

    <?foreach STOREDVAR in SERVICENAME;DATADIR;INSTALLDIR?>

    <Property Id='$(var.STOREDVAR)' Secure='yes'>
      <RegistrySearch Id='$(var.STOREDVAR)Property' Root='HKLM'
                      Key='SOFTWARE\@MANUFACTURER@\@CPACK_WIX_PACKAGE_NAME@'
                      Name='$(var.STOREDVAR)' Type='raw' />
    </Property>
    <CustomAction Id='SaveCmdLineValue_$(var.STOREDVAR)' Property='CMDLINE_$(var.STOREDVAR)'
              Value='[$(var.STOREDVAR)]' Execute='firstSequence' />
    <CustomAction Id='SetFromCmdLineValue_$(var.STOREDVAR)' Property='$(var.STOREDVAR)' 
                  Value='[CMDLINE_$(var.STOREDVAR)]' Execute='firstSequence' />
    <InstallUISequence>
      <Custom Action='SaveCmdLineValue_$(var.STOREDVAR)' Before='AppSearch' />
      <Custom Action='SetFromCmdLineValue_$(var.STOREDVAR)' After='AppSearch'>CMDLINE_$(var.STOREDVAR)</Custom>
    </InstallUISequence>
    <InstallExecuteSequence>
      <Custom Action='SaveCmdLineValue_$(var.STOREDVAR)' Before='AppSearch' />
      <Custom Action='SetFromCmdLineValue_$(var.STOREDVAR)' After='AppSearch'>CMDLINE_$(var.STOREDVAR)</Custom>
    </InstallExecuteSequence>

    <?endforeach?>

    <!-- 
      Optionally, start upgrade wizard on exit.
    -->
    

    
    <?if $(var.HaveUpgradeWizard) != "0" ?>
    <UI>
      <Publish Dialog="ExitDialog"
          Control="Finish"
          Event="DoAction"
          Value="LaunchApplication">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>
    </UI>
    <Property 
      Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" 
      Value="Launch wizard to upgrade existing MariaDB or MySQL services." />
    <Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOX" Value="1"/>
    <Property Id="WixShellExecTarget" Value="[#F.bin.mysql_upgrade_wizard.exe]" />
    <CustomAction Id="LaunchApplication"
        BinaryKey="WixCA"
        DllEntry="WixShellExec"
        Impersonate="yes" />
    <CustomAction 
      Id="CheckServiceUpgrades"   Return="ignore" BinaryKey="wixca.dll" 
      DllEntry="CheckServiceUpgrades"
      Execute="immediate" />
    <InstallUISequence>
      <Custom Action="CheckServiceUpgrades" After="CostFinalize">
        $C.bin.mysql_upgrade_wizard.exe = 3 AND NOT Installed
      </Custom>
    </InstallUISequence>
    <SetProperty Before="ExecuteAction" Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" 
       Sequence="ui"  Value="[NonExistentProperty]">
      <![CDATA[($C.bin.mysql_upgrade_wizard.exe <> 3) AND NOT Installed]]>
    </SetProperty>
    <SetProperty Before="ExecuteAction" Id="WIXUI_EXITDIALOGOPTIONALCHECKBOX" 
       Sequence="ui"  Value="[NonExistentProperty]">
      <![CDATA[($C.bin.mysql_upgrade_wizard.exe <> 3) AND NOT Installed]]>
    </SetProperty>
    
    <?endif ?> <!-- HaveUpgradeWizard -->

    <!-- 
      Author the registry entries for "add or remove programs" 
      We choose to define ARPSYSTEMCOMPONENT to 1 because we want to show 
      "do you want to remove data directory" on uninstall
    -->
    <Property Id="ARPSYSTEMCOMPONENT" Value="1" Secure="yes" />
    <Property Id="ARPINSTALLLOCATION" Secure="yes"/>
    <SetProperty Id="ARPINSTALLLOCATION" Value="[INSTALLDIR]" After="InstallValidate"  Sequence="execute"/>
    <Feature Id='ARPRegistryEntries'
          Title='Add or remove program entries'
          Description='Add or remove program entries'
          AllowAdvertise='no'
          Absent='disallow'  Display='hidden'
          Level='1'>
      <Component Id="C.arp_entries" Guid="*" Directory="INSTALLDIR">
        <RemoveFolder Id="RemoveINSTALLDIR" On="uninstall"/>
        <RegistryValue Root='HKLM'
           Key='Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_WIX_PACKAGE_NAME@'
           Name='DisplayName' Value='[ProductName]' Type='string' KeyPath='yes'/>
        <RegistryValue Root='HKLM'
          Key='Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_WIX_PACKAGE_NAME@'
          Name='Publisher' Value='@MANUFACTURER@' Type='string'/>
        <RegistryValue Root='HKLM'
          Key='Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_WIX_PACKAGE_NAME@'
          Name='DisplayVersion' Value='[ProductVersion]' Type='string'/>
        <RegistryValue Root='HKLM'
          Key='Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_WIX_PACKAGE_NAME@'
          Name='InstallLocation' Value='[INSTALLDIR]' Type='string'/>
        <RegistryValue Root='HKLM'
          Key='Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_WIX_PACKAGE_NAME@'
          Name='UninstallString' Value='msiexec.exe /I [ProductCode]' Type='string'/>
        <RegistryValue Root='HKLM'
          Key='Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_WIX_PACKAGE_NAME@'
          Name='MajorVersion' Value='@MAJOR_VERSION@' Type='string'/>
        <RegistryValue Root='HKLM'
          Key='Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_WIX_PACKAGE_NAME@'
          Name='MinorVersion' Value='@MINOR_VERSION@' Type='string'/>
      </Component>
    </Feature>

    <!-- Extra condition to block the installer if NSIS based installation is detected-->
    <Property Id="NSISINSTALLKEY">
      <RegistrySearch Id='NSISKey' Type='raw'
        Root='HKLM' Key='Software\Microsoft\Windows\CurrentVersion\Uninstall\MariaDB' Name='DisplayName' />
    </Property>
    <Condition
      Message=
      'Previous version of MariaDB was found, that used incompatible installer.&#xD;&#xA;Please remove &quot;[NSISINSTALLKEY]&quot; before you proceed with this installation.'
      >
      <![CDATA[ NOT(NSISINSTALLKEY << "MariaDB @MAJOR_VERSION@.@MINOR_VERSION@.") OR Installed]]>
    </Condition>
    <Condition Message=
       'Setting the ALLUSERS property is not allowed because [ProductName] is a per-machine application. Setup will now exit.'>
      <![CDATA[ALLUSERS = "1"]]>
    </Condition>
  </Fragment>
</Wix>