/
jenkins.wxs
165 lines (134 loc) · 8.48 KB
/
jenkins.wxs
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
<?xml version="1.0"?>
<!--
This file gets processed twice. Once by shell on the release machine, then
once more by WiX toolkit on Windows build box.
WiX variables are supposed to look like <DOLLAR>(var.VARNAME), which means
it has to be written like <BACKSLASH><DOLLAR>(var.VARNAME) to survive the first processing
-->
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'
xmlns:fire="http://schemas.microsoft.com/wix/FirewallExtension">
<Product Name='${PRODUCTNAME} ${VERSION}' Id='*' UpgradeCode='${MSI_PRODUCTCODE}'
Language='1033' Codepage='1252' Version='0.${encodedv}' Manufacturer='${VENDOR}'>
<Package Id='*' Keywords='Installer' Description="${PRODUCTNAME}"
Comments='${SUMMARY}' InstallScope="perMachine"
InstallerVersion='100' Compressed='yes' SummaryCodepage='1252' />
<Media Id='1' Cabinet='${ARTIFACTNAME}.cab' EmbedCab='yes'/>
<Directory Id='TARGETDIR' Name='SourceDir'>
<Directory Id='ProgramFilesFolder' Name='PFiles'>
<Directory Id='JENKINSDIR' Name='${CAMELARTIFACTNAME}' FileSource=".">
<Directory Id='JreDir' Name='jre'/>
<Component Id='Main' Guid='e4a652bf-c210-4a45-95c4-5dc875b4880b'>
<File Name="jenkins.exe" Source='tmp/jenkins.exe' KeyPath='yes' Id="JenkinsExe"/>
<fire:FirewallException Id="FwEx" File="\$(var.JavaExeId)" Name="Jenkins" Scope="any" IgnoreFailure="yes" />
<File Name="jenkins.xml" Source='tmp/jenkins.xml' DiskId='1' />
<File Name="jenkins.exe.config" Source='jenkins.exe.config' DiskId='1' />
<File Name="${ARTIFACTNAME}.war" Source='\$(var.WAR)' DiskId='1' />
<ServiceInstall Id="${CAMELARTIFACTNAME}Service"
Name="${CAMELARTIFACTNAME}"
DisplayName="${PRODUCTNAME}"
Type="ownProcess"
Start="auto"
ErrorControl="normal"
Description="${SUMMARY}"
Account="[SERVICEACCOUNT]"
Password="[SERVICEPASSWORD]" />
<ServiceControl Id="Control${CAMELARTIFACTNAME}Service" Name="${CAMELARTIFACTNAME}" Start="install" Stop="both" Wait="yes" Remove="uninstall"/>
</Component>
</Directory>
</Directory>
</Directory>
<Upgrade Id="${MSI_PRODUCTCODE}">
<UpgradeVersion Minimum="0.0.0" Maximum="99.99.99" Property="PREVIOUSVERSIONINSTALLED" />
</Upgrade>
<CustomAction Id="BackupJenkinsXmlFile" Script="vbscript">
<![CDATA[
On Error Resume Next
Err.Clear
jenkinsDirPath = session.Property("JENKINSDIR")
Set fsObj = CreateObject("Scripting.FileSystemObject")
If fsObj.FolderExists(jenkinsDirPath) Then
srcPath = jenkinsDirPath & "jenkins.xml"
If fsObj.FileExists(srcPath) Then
dstPath = jenkinsDirPath & "jenkins.xml.backup"
If fsObj.FileExists(dstPath) Then
suffix = 1
While fsObj.FileExists(dstPath & "_" & suffix)
suffix = suffix + 1
Wend
dstPath = dstPath & "_" & suffix
End If
fsObj.CopyFile srcPath, dstPath, True
Err.Clear
On Error Goto 0
End If
End If
]]>
</CustomAction>
<InstallExecuteSequence>
<!--
Earlier I suffered a problem where after an upgrade, all the JRE files are removed
(if I then repair the installation, it'll work, so it's not the missing definitions in the msi file.)
I'm still new to MSI/WiX to be able to really understand what's going on, but
http://www.mail-archive.com/wix-users@lists.sourceforge.net/msg32537.html seems to explain the problem,
(as caused by the interaction between deferred removal), and the take away from this thread
as a whole seems to be that for auto-generated wxs files (from heat), it's just not possible
to get the file updates done right (WTF?!).
The InstallInitialize seems to work. My naive hypothesis is that this stops the service and
deletes all the files before new ones are added (OTOH, I still get a dialog that some files
are in use and I need to reboot, so I could be all wrong, or maybe the installer is showing
this dialog incorrectly as a precaution, as alluded in http://www.mail-archive.com/wix-users@lists.sourceforge.net/msg06878.html)
I remember seeing another e-mail on the wix-users list about <ServiceControl> not actually
waiting until the full termination of the service, and if so, this still might not work.
In any case, noting my experiments so that future changes to this value will be done very carefully.
-->
<Custom Action="BackupJenkinsXmlFile" After='InstallInitialize' />
<RemoveExistingProducts After="BackupJenkinsXmlFile"/>
</InstallExecuteSequence>
<Feature Id='Complete' Level='1'>
<ComponentRef Id='Main' />
<ComponentGroupRef Id='JreComponents' />
</Feature>
<UI>
<UIRef Id="WixUI_Common" />
<!-- WixUI_InstallDir + launch app at the end -->
<TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
<TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
<TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />
<Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
<Property Id="WixUI_Mode" Value="InstallDir" />
<DialogRef Id="BrowseDlg" />
<DialogRef Id="DiskCostDlg" />
<DialogRef Id="ErrorDlg" />
<DialogRef Id="FatalError" />
<DialogRef Id="FilesInUse" />
<DialogRef Id="MsiRMFilesInUse" />
<DialogRef Id="PrepareDlg" />
<DialogRef Id="ProgressDlg" />
<DialogRef Id="ResumeDlg" />
<DialogRef Id="UserExit" />
<Publish Dialog="BrowseDlg" Control="OK" Event="DoAction" Value="WixUIValidatePath" Order="3">1</Publish>
<Publish Dialog="BrowseDlg" Control="OK" Event="SpawnDialog" Value="InvalidDirDlg" Order="4"><![CDATA[WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>
<Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg">1</Publish>
<Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
<Publish Dialog="InstallDirDlg" Control="Next" Event="SetTargetPath" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
<Publish Dialog="InstallDirDlg" Control="Next" Event="DoAction" Value="WixUIValidatePath" Order="2">NOT WIXUI_DONTVALIDATEPATH</Publish>
<Publish Dialog="InstallDirDlg" Control="Next" Event="SpawnDialog" Value="InvalidDirDlg" Order="3"><![CDATA[NOT WIXUI_DONTVALIDATEPATH AND WIXUI_INSTALLDIR_VALID<>"1"]]></Publish>
<Publish Dialog="InstallDirDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="4">WIXUI_DONTVALIDATEPATH OR WIXUI_INSTALLDIR_VALID="1"</Publish>
<Publish Dialog="InstallDirDlg" Control="ChangeFolder" Property="_BrowseProperty" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
<Publish Dialog="InstallDirDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="InstallDirDlg" Order="1">NOT Installed</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2">Installed</Publish>
<Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish>
<Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
<Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
<Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg">1</Publish>
<Property Id="ARPNOMODIFY" Value="1" />
<Publish Dialog="ExitDialog" Control="Finish" Event="DoAction" Value="LaunchApplication">NOT installed</Publish>
</UI>
<!-- launch a browser at the end of the installation -->
<Property Id="WixShellExecTarget" Value="http://localhost:${PORT}/"/>
<CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />
<Property Id="WIXUI_INSTALLDIR" Value="JENKINSDIR" />
</Product>
</Wix>