-
Notifications
You must be signed in to change notification settings - Fork 0
/
Common.UninstallOldPackage.wxi
90 lines (79 loc) · 2.7 KB
/
Common.UninstallOldPackage.wxi
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
<?xml version="1.0" encoding="UTF-8"?>
<Include
xmlns="http://wixtoolset.org/schemas/v4/wxs"
>
<?ifndef OldPackageProperty?>
<?define OldPackageProperty="ORIGINAL$(var.OldPackageId)PACKAGEUNINSTALLER"?>
<?endif?>
<?ifndef OldPackageUninstallAction?>
<?define OldPackageUninstallAction="UninstallOriginal$(var.OldPackageId)Package"?>
<?endif?>
<?ifndef OldPackageUninstallerArgs?>
<?define OldPackageUninstallerArgs="/SILENT /NORESTART /SUPPRESSMSGBOXES"?>
<?endif?>
<?define OldPackageUninstallActionCondition="($(var.OldPackageProperty)) And (Not REMOVE) And (Not DONTUNINSTALLORIGINALPACKAGE)"?>
<Property Id="$(var.OldPackageProperty)">
<?ifdef OldPackageUninstallerFileName?>
<RegistrySearch
Id="Original$(var.OldPackageId)PackageUninstaller"
Root="HKLM"
Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(var.OldPackageUninstallerId)"
Name="UninstallString"
Type="file"
>
<FileSearch Name="$(var.OldPackageUninstallerFileName)"/>
</RegistrySearch>
<?else?>
<RegistrySearch
Id="Original$(var.OldPackageId)PackageUninstaller"
Root="HKLM"
Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(var.OldPackageUninstallerId)"
Name="UninstallString"
Type="raw"
>
</RegistrySearch>
<?endif?>
</Property>
<CustomAction
Id="$(var.OldPackageUninstallAction)"
Property="$(var.OldPackageProperty)"
ExeCommand="$(var.OldPackageUninstallerArgs)"
Impersonate="no"
Execute="deferred"
Return="ignore"
/>
<UI>
<ProgressText Action="$(var.OldPackageUninstallAction)">!(loc.UninstallOriginalPackage)</ProgressText>
</UI>
<PropertyRef Id="DONTUNINSTALLORIGINALPACKAGE"/>
<InstallExecuteSequence>
<Custom
Action="$(var.OldPackageUninstallAction)"
After="InstallInitialize"
><![CDATA[$(var.OldPackageUninstallActionCondition)]]></Custom>
</InstallExecuteSequence>
<?ifdef OldPackageUninstallerPause?>
<!-- для Inno Setup требуется пауза между деинсталляторами. Вставляем паузу. -->
<CustomAction
Id="SleepAfter$(var.OldPackageUninstallAction)"
Script="jscript"
Impersonate="no"
Execute="deferred"
Return="ignore"
>
<![CDATA[
var wshShell = new ActiveXObject( "WScript.Shell" );
wshShell.Run( "\"%COMSPEC%\" /c ping -n $(var.OldPackageUninstallerPause) localhost ", 0, 1 )
]]>
</CustomAction>
<UI>
<ProgressText Action="SleepAfter$(var.OldPackageUninstallAction)">!(loc.UninstallOriginalPackage)</ProgressText>
</UI>
<InstallExecuteSequence>
<Custom
Action="SleepAfter$(var.OldPackageUninstallAction)"
After="$(var.OldPackageUninstallAction)"
><![CDATA[$(var.OldPackageUninstallActionCondition)]]></Custom>
</InstallExecuteSequence>
<?endif?>
</Include>