Skip to content
Browse files

[JENKINS-44738] Detect if jenkins.xml file exists on installation dir…

… and perform a backup if it does.
  • Loading branch information
varyvol committed Jun 7, 2017
1 parent 724f231 commit 934d66d006d97095f45053f0e89850c4da31d032
Showing with 24 additions and 5 deletions.
  1. +24 −5 msi/jenkins.wxs
@@ -43,28 +43,47 @@
<Upgrade Id="${MSI_PRODUCTCODE}">
<UpgradeVersion Minimum="0.0.0" Maximum="99.99.99" Property="PREVIOUSVERSIONINSTALLED" />

<CustomAction Id="BackupJenkinsXmlFile" Script="vbscript">
jenkinsDirPath = session.Property("JENKINSDIR")
Set fsObj = CreateObject("Scripting.FileSystemObject")
If fsObj.FolderExists(jenkinsDirPath) Then
jenkinsXmlPath = jenkinsDirPath + "jenkins.xml"
If fsObj.FileExists(jenkinsXmlPath) Then
Set shellObj = CreateObject("WScript.Shell")
cmdToExecute = "cmd.exe /C copy """ + jenkinsXmlPath + """ """ + jenkinsXmlPath + ".backup"" /Y"
End If
End If

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 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
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.
<RemoveExistingProducts After="InstallInitialize"/>
<Custom Action="BackupJenkinsXmlFile" After='InstallInitialize' />
<RemoveExistingProducts After="BackupJenkinsXmlFile"/>

<Feature Id='Complete' Level='1'>

0 comments on commit 934d66d

Please sign in to comment.
You can’t perform that action at this time.