forked from VerySleepy/verysleepy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
installer.iss
148 lines (123 loc) · 8.13 KB
/
installer.iss
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
; Very Sleepy install script, for Inno Setup
#include "src/appinfo.h"
#include "src/version.h"
[Setup]
AppName={#APPNAME}
AppVersion={#VERSION}
VersionInfoVersion={#VERSION_MAJOR}.{#VERSION_MINOR}.{#VERSION_PATCH}.{#VERSION_DIRTY}
; AppId is used to identify the program in the registry.
AppId={#APPNAME}
AppPublisher={#VENDOR}
AppPublisherURL=http://{#VENDOR}/
AppSupportURL={#APPURL}
DefaultDirName={pf}\{#APPNAME}
DefaultGroupName={#APPNAME}
AllowNoIcons=yes
LicenseFile=license.rtf
OutputBaseFilename=setup
SetupIconFile=src\res\sleepy.ico
Compression=lzma
SolidCompression=yes
OutputDir=.
ArchitecturesInstallIn64BitMode=x64
UninstallDisplayIcon={app}\sleepy.exe
DisableWelcomePage=no
#ifdef SIGN
SignTool=sleepy /d "{#APPNAME} v{#VERSION} installer" /du "{#APPURL}"
#endif
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Files]
; 32-bit version
Source: "obj\Win32\Release\sleepy.exe" ; DestDir: "{app}" ; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "src\crashback\crashreport\bin\Win32\Release\crashreport.exe"; DestDir: "{app}" ; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "dbghelp_x86\dbghelpms.dll" ; DestDir: "{app}" ; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "dbghelp_x86\dbghelpms6.dll" ; DestDir: "{app}" ; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "dbghelp_x86\symsrv.dll" ; DestDir: "{app}" ; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "dbghelp_x86\srcsrv.dll" ; DestDir: "{app}" ; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "dbghelp_x86\symsrv.yes" ; DestDir: "{app}" ; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "obj\Win32\Release\dbghelpw.dll" ; DestDir: "{app}" ; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "obj\Win32\Release\dbghelpdr.dll" ; DestDir: "{app}" ; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "obj\Win32\Release\msvcr120.dll" ; DestDir: "{app}" ; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "obj\Win32\Release\msvcp120.dll" ; DestDir: "{app}" ; Flags: ignoreversion; Check: not Is64BitInstallMode
; 64-bit version
Source: "obj\x64\Release\sleepy.exe" ; DestDir: "{app}" ; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "src\crashback\crashreport\bin\x64\Release\crashreport.exe" ; DestDir: "{app}" ; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "dbghelp_x64\dbghelpms.dll" ; DestDir: "{app}" ; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "dbghelp_x64\dbghelpms6.dll" ; DestDir: "{app}" ; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "dbghelp_x64\symsrv.dll" ; DestDir: "{app}" ; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "dbghelp_x64\srcsrv.dll" ; DestDir: "{app}" ; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "dbghelp_x64\symsrv.yes" ; DestDir: "{app}" ; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "obj\x64\Release\dbghelpw.dll" ; DestDir: "{app}" ; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "obj\x64\Release\dbghelpw_wow64.dll" ; DestDir: "{app}" ; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "obj\x64\Release\dbghelpdr.dll" ; DestDir: "{app}" ; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "obj\x64\Release\msvcr120.dll" ; DestDir: "{app}" ; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "obj\x64\Release\msvcp120.dll" ; DestDir: "{app}" ; Flags: ignoreversion; Check: Is64BitInstallMode
; 32-bit version for 64-bit systems
Source: "obj\Win32\Release\sleepy.exe" ; DestDir: "{app}\32"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "src\crashback\crashreport\bin\Win32\Release\crashreport.exe"; DestDir: "{app}\32"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "dbghelp_x86\dbghelpms.dll" ; DestDir: "{app}\32"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "dbghelp_x86\dbghelpms6.dll" ; DestDir: "{app}\32"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "dbghelp_x86\symsrv.dll" ; DestDir: "{app}\32"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "dbghelp_x86\srcsrv.dll" ; DestDir: "{app}\32"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "dbghelp_x86\symsrv.yes" ; DestDir: "{app}\32"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "obj\Win32\Release\dbghelpw.dll" ; DestDir: "{app}\32"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "obj\Win32\Release\dbghelpdr.dll" ; DestDir: "{app}\32"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "obj\Win32\Release\msvcr120.dll" ; DestDir: "{app}\32"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "obj\Win32\Release\msvcp120.dll" ; DestDir: "{app}\32"; Flags: ignoreversion; Check: Is64BitInstallMode
; Other bits
Source: "keywords.txt"; DestDir: "{app}"; Flags: ignoreversion
Source: "license.txt"; DestDir: "{app}"; Flags: ignoreversion
Source: "osfunctions.txt"; DestDir: "{app}"; Flags: ignoreversion
Source: "osmodules.txt"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[InstallDelete]
; Delete dbghelp.dll installed by older versions
Type: files; Name: "{app}\dbghelp.dll"
Type: files; Name: "{app}\32\dbghelp.dll"
[Icons]
Name: "{group}\{#APPNAME}"; Filename: "{app}\sleepy.exe"
Name: "{group}\{#APPNAME} (32-bit)"; Filename: "{app}\32\sleepy.exe"; Check: Is64BitInstallMode
[Run]
Filename: "{app}\sleepy.exe"; Description: "{cm:LaunchProgram,{#APPNAME}}"; Flags: nowait postinstall skipifsilent
[Code]
const
MsiDir = 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{49CCD620-07C3-48B3-9B53-D1E104DC47D0}';
MsiUninstall = '/uninstall {49CCD620-07C3-48B3-9B53-D1E104DC47D0} /passive';
var
MsiExists: Boolean;
MsiPage: TInputOptionWizardPage;
procedure InitializeWizard();
begin
MsiExists := False;
// Prompt to remove version 0.6 if it exists
if RegKeyExists( HKLM, MsiDir ) then
begin
MsiExists := True;
MsiPage := CreateInputOptionPage(wpWelcome,
'Previous Version', 'An older version was detected.',
'Would you like to first remove the older version of {#APPNAME}?',
True, False);
MsiPage.Add('Uninstall the older version first.');
MsiPage.Add('Leave it where it is.');
MsiPage.Values[0] := True;
end;
end;
function NextButtonClick(CurPageID: Integer): Boolean;
var
ResultCode: Integer;
begin
Result := True;
// Remove the old version right here, before we prompt to pick a new directory.
if MsiExists then
begin
if (CurPageID = MsiPage.ID) and (MsiPage.Values[0]) then
begin
if not Exec('MsiExec.exe', MsiUninstall, '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
begin
MsgBox('The previous version could not be uninstalled. Please uninstall it manually.', mbError, MB_OK);
Result := False;
end;
end;
end;
end;