-
Notifications
You must be signed in to change notification settings - Fork 2
/
dwimperl.iss
216 lines (180 loc) · 7.49 KB
/
dwimperl.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
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
; -- dwimperl.iss --
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING .ISS SCRIPT FILES!
; using ISC 5.4.2(a)
; TODO: Restrict the installation path to have no non-ascii characters in the path
; TODO: do we need to set Environment variable other than Path ? e.g. file extension mapping?
; TODO: Add alot more menu items that the original Strawberry also adds
; TODO: Add desktop icon for Padre (ask user?)
; TODO: add License
; TODO: add README
; TODO: check for other perl installations (eg. in the Path variable) and warn or even abort if there is another one
[Setup]
AppName=DwimPerl
AppVersion=0.07
DefaultDirName=\Dwimperl
DefaultGroupName=DWIM Perl
; UninstallDisplayIcon={app}\MyProg.exe
Compression=lzma2
SolidCompression=yes
SourceDir=c:\strawberry
OutputDir=c:\output
OutputBaseFilename=dwimperl
;AppComments=
AppContact=http://dwimperl.com/
; AppCopyright=
AppId=dwimperl
; AppMutex= TODO!
AppPublisherURL=http://dwimperl.com/
ChangesAssociations=yes
ChangesEnvironment=yes
;InfoAfterFile=README_FIRST.txt
[Run]
Filename: "{app}\relocation.pl.bat";
[Registry]
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; \
ValueName: "Path"; ValueType: expandsz; ValueData: "{olddata};{code:getPath}"; \
Check: NeedsAddPath('\perl\site\bin');
; TODO: don't add the leading semi-colon to the Path if there is already a trailing one
[Files]
Source: "*"; DestDir: "{app}"; Flags: "recursesubdirs"; Excludes: "\cpan\cpan_sqlite_log.*,\cpan\build,\cpan\sources,\cpan\Bundle";
; Use the following to play with the packaging with only a few files
; In production, comment out these lines an enable the one above
; Source: "README.txt"; DestDir: "{app}"
; Source: "perl\site\bin\padre.exe"; DestDir: "{app}\perl\site\bin\"
; Source: "relocation.pl.bat"; DestDir: "{app}"
; Source: "win32\*"; DestDir: "{app}\win32\";
[Icons]
Name: "{group}\Padre, the Perl IDE"; Filename: "{app}\perl\site\bin\padre.exe"
Name: "{group}\Strawberry Perl README"; Filename: "{app}\README.txt"
Name: "{group}\DWIM Perl README"; Filename: "{app}\DWIM.txt"
Name: "{group}\Perl (command line)"; \
Filename: "C:\WINDOWS\system32\cmd.exe"; \
Comment: "Quick way to get to the command line in order to use Perl."
; WorkingDir: "C:\Documents and Settings\Gabor Szabo\My Documents\"
Name: "{group}\Strawberry Perl Release Notest"; \
Filename: "{app}\win32\Strawberry Perl Release Notes.url"; \
IconFilename: "{app}\win32\strawberry.ico";
Name: "{group}\Uninstall"; Filename: "{app}\unins000.exe"
;Name: "{group}\Related Websites\Beginning Perl (online book)"; \
; Filename: "{app}\win32\Beginning Perl (online book).url"; \
; IconFilename: "{app}\win32\perlhelp.ico"; \
; WorkingDir: "{app}\win32"; \
; Comment: "Beginning Perl (online book)";
;Name: "{group}\Related Websites\learn.perl.org (tutorials, links)"; \
; Filename: "{app}\win32\learn.perl.org (tutorials, links).url"; \
; IconFilename: "{app}\win32\perlhelp.ico"; \
; WorkingDir: "{app}\win32"; \
; Comment: "learn.perl.org (tutorials, links)";
Name: "{group}\Related Websites\Strawberry Perl Website"; \
Filename: "{app}\win32\Strawberry Perl Website.url"; \
IconFilename: "{app}\win32\strawberry.ico"; \
WorkingDir: "{app}\win32"; \
Comment: "Strawberry Perl Website";
Name: "{group}\Related Websites\CPAN Module Search"; \
Filename: "{app}\win32\CPAN Module Search.url"; \
IconFilename: "{app}\win32\cpan.ico"; \
WorkingDir: "{app}\win32"; \
Comment: "CPAN Module Search";
Name: "{group}\Related Websites\Live Support"; \
Filename: "{app}\win32\Live Support.url"; \
IconFilename: "{app}\win32\perldoc.ico"; \
WorkingDir: "{app}\win32"; \
Comment: "Live Support";
Name: "{group}\Related Websites\Padre Website"; \
Filename: "{app}\win32\Padre Website.url"; \
IconFilename: "{app}\win32\padre.ico"; \
WorkingDir: "{app}\win32"; \
Comment: "Padre Website";
Name: "{group}\Tools\Check installed versions of modules"; \
Filename: "{app}\perl\bin\module-version.bat"; \
WorkingDir: "{app}\perl\bin\"; \
IconFilename: "{app}\win32\strawberry.ico";
Name: "{group}\Tools\Create local library areas"; \
Filename: "{app}\perl\bin\llw32helper.bat"; \
WorkingDir: "{app}\perl\bin\"; \
IconFilename: "{app}\win32\strawberry.ico";
Name: "{group}\Tools\CPAN client"; \
Filename: "{app}\perl\bin\cpan.bat"; \
WorkingDir: "{app}\perl\bin\"; \
IconFilename: "{app}\win32\cpan.ico";
;Name: "{group}\Games\Zumbis"; \
; Filename: "{app}\perl\site\bin\zumbis.bat"; \
; IconFilename: "{app}\win32\zumbis.ico";
;Name: "{group}\Games\Frozen Bubble"; \
; Filename: "{app}\perl\site\bin\frozen-bubble.bat"; \
; IconFilename: "{app}\win32\frozen-bubble.ico";
;Name: "{group}\Games\SDL Perl Website"; \
; Filename: "{app}\win32\SDL Perl Website.url"; \
; WorkingDir: "{app}\win32"; \
; Comment: "SDL Perl Website"; \
; IconFilename: "{app}\win32\sdl-perl.ico";
; copy file from Padre\win32\padre.ico to c:\strawberry\win32
; copy file from tools\strawberry\Padre Website.url to c:\strawberry\win32
[Code]
function getPath(Param: String): string;
begin
Result := ExpandConstant('{app}') + '\perl\bin;' + ExpandConstant('{app}') + '\perl\site\bin;' + ExpandConstant('{app}') + '\c\bin;'
end;
// From http://stackoverflow.com/questions/3304463/how-do-i-modify-the-path-environment-variable-when-running-an-inno-setup-installe
function NeedsAddPath(Param: string): boolean;
var
OrigPath: string;
begin
if not RegQueryStringValue(HKEY_LOCAL_MACHINE,
'SYSTEM\CurrentControlSet\Control\Session Manager\Environment',
'Path', OrigPath)
then begin
Result := True;
exit;
end;
// look for the path with leading and trailing semicolon
// Pos() returns 0 if not found
//Result := Pos(';' + ExpandConstant('{app}') + Param + ';', OrigPath) = 0;
Result := Pos(getPath(''), OrigPath) = 0;
end;
function RemovePath(): boolean;
var
OrigPath: string;
start_pos: Longint;
end_pos: Longint;
new_str: string;
begin
if not RegQueryStringValue(HKEY_LOCAL_MACHINE,
'SYSTEM\CurrentControlSet\Control\Session Manager\Environment',
'Path', OrigPath)
then begin
Result := True;
exit;
end;
start_pos := Pos(getPath(''), OrigPath);
end_pos := start_pos + Length(getPath(''));
new_str := Copy(OrigPath, 0, start_pos-1) + Copy(OrigPath, end_pos, Length(OrigPath));
RegWriteExpandStringValue(HKEY_LOCAL_MACHINE,
'SYSTEM\CurrentControlSet\Control\Session Manager\Environment',
'Path', new_str);
Result := True;
end;
function InitializeUninstall(): Boolean;
begin
Result := True;
// Result := MsgBox('InitializeUninstall:' #13#13 'Uninstall is initializing. Do you really want to start Uninstall?', mbConfirmation, MB_YESNO) = idYes;
// if Result = False then
// MsgBox('InitializeUninstall:' #13#13 'Ok, bye bye.', mbInformation, MB_OK);
RemovePath();
end;
// C:\Program Files\CollabNet\Subversion Client;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\strawberry\c\bin;C:\strawberry\perl\site\bin;C:\strawberry\perl\bin;;C:\Str\perl\bin;C:\Str\perl\site\bin;C:\Str\c\bin;d:\;
// Restrict the installation path to have no space
function NextButtonClick(CurPageID: Integer): Boolean;
begin
Result :=True;
case CurPageID of
wpSelectDir :
begin
if Pos(' ', ExpandConstant('{app}') ) <> 0 then
begin
MsgBox('You cannot install to a path containing spaces. Please select a different path.', mbError, mb_Ok);
Result := False;
end;
end;
end;
end;