source: osc-snovis/head/obuild/DOS/this.iss @ 13

Last change on this file since 13 was 13, checked in by barrand, 17 years ago
  • Property svn:executable set to *
File size: 12.4 KB
Line 
1;
2; File produced by the obuild tool version 1.0
3; for the package osc-snovis with version v1r0.
4;
5; Input file for the Inno Setup tool to create an install wizard.
6;
7; Usage :
8; ( DOS> set PATH to access the Inno Setup Compil32 program )
9;   DOS> cd <path>\osc-snovis\v1r0\obuild
10;   DOS> Compil32 DOS\this.iss
11; Click on Build to create the :
12;   osc-snovis-v1r0-WindowsXP-VC71.exe
13; file.
14;
15
16[LangOptions]
17LanguageName=English
18LanguageID=$0409
19DialogFontName=MS Shell Dlg
20DialogFontSize=10
21TitleFontName=Arial
22TitleFontSize=29
23WelcomeFontName=Verdana
24WelcomeFontSize=14
25CopyrightFontName=Arial
26CopyrightFontSize=10
27
28[Setup]
29AppName=osc-snovis
30AppId=osc-snovis
31AppVerName=osc-snovis v1r0
32AppCopyright=Copyright (C) 2001-2005 Guy Barrand
33AppPublisher=LAL, Universite Paris-Sud, Batiment 200, 91898 Orsay cedex, France
34AppPublisherURL=http://OpenScientist.lal.in2p3.fr
35AppVersion=v1r0
36UsePreviousAppDir=1
37UsePreviousGroup=1
38DefaultDirName={pf}\osc-snovis\v1r0
39DefaultGroupName=osc-snovis
40BackColor=$FF0000
41BackColor2=$0F0F00
42BackColorDirection=toptobottom
43WindowShowCaption=yes
44WindowStartMaximized=no
45WindowVisible=1
46WindowResizable=1
47UninstallDisplayName=osc-snovis v1r0
48UninstallLogMode=Append
49DirExistsWarning=auto
50CreateUninstallRegKey=1
51UninstallFilesDir={app}\uninst_exe
52DisableDirPage=0
53DisableStartupPrompt=1
54CreateAppDir=1
55DisableProgramGroupPage=0
56Uninstallable=1
57UninstallDisplayIcon={app}\icon\uninlandaq.ico
58ReserveBytes=0
59UseSetupLdr=1
60; SourceDir is relative to where the .iss is.
61SourceDir=..
62OutputDir=.
63OutputBaseFilename=osc-snovis-v1r0-WindowsXP-VC71
64InfoBeforeFile=.\release\InnoSetup\info_before.txt
65RestartIfNeededByRun=yes
66
67[Types]
68Name: Run_Time_Kit; Description: Typical installation
69
70[Components]
71Name: RTK; Description: The run time kit; Types: Run_Time_Kit ; Flags : fixed
72
73
74[Files]
75; Applications, DLLS, Python modules :
76Source:..\Windows_NT_obuild\osc-snovis\v1r0\bin\*.exe;DestDir:{app}\bin;Components:RTK
77Source:..\Windows_NT_obuild\osc-snovis\v1r0\bin\*.dll;DestDir:{app}\bin;Components:RTK
78Source:..\Windows_NT_obuild\osc-snovis\v1r0\bin\*.pyd;DestDir:{app}\bin;Components:RTK
79; Libraries :
80Source:..\Windows_NT_obuild\osc-snovis\v1r0\lib\*.lib;DestDir:{app}\lib;Components:RTK
81; Resources :
82Source:..\Windows_NT_obuild\osc-snovis\v1r0\Resources\*.*;DestDir:{app}\Resources;Components:RTK;Flags:recursesubdirs
83; Else :
84Source:..\Windows_NT_obuild\osc-snovis\v1r0\README;DestDir:{app};Components:RTK
85Source:..\Windows_NT_obuild\osc-snovis\v1r0\License;DestDir:{app};Components:RTK
86Source:..\Windows_NT_obuild\osc-snovis\v1r0\*.bat;DestDir:{app};Components:RTK
87Source:..\Windows_NT_obuild\osc-snovis\v1r0\bin\*.save;DestDir:{app}\bin;Components:RTK
88
89[_ISTool]
90EnableISX=true
91UseAbsolutePaths=false
92Use7zip=false
93
94[Code]
95// -----------------------------------------------------------------
96//                    code for changing PATH
97// -----------------------------------------------------------------
98
99//
100// Inno Setup Extensions Knowledge Base
101// Article 44 - Native ISX procedures for PATH modification
102// http://www13.brinkster.com/vincenzog/isxart.asp?idart=44
103// Author: Thomas Vedel
104//
105
106// Version log:
107// 03/31/2003: Initial release (thv@lr.dk)
108
109const
110  // Modification method
111  pmAddToBeginning = $1;      // Add dir to beginning of Path
112  pmAddToEnd = $2;            // Add dir to end of Path
113  pmAddAllways = $4;          // Add also if specified dir is already included in existing path
114  pmAddOnlyIfDirExists = $8;  // Add only if specified dir actually exists
115  pmRemove = $10;             // Remove dir from path
116  pmRemoveSubdirsAlso = $20;  // Remove dir and all subdirs from path
117
118  // Scope
119  psCurrentUser = 1;          // Modify path for current user
120  psAllUsers = 2;             // Modify path for all users
121
122  // Error results
123  mpOK = 0;                   // No errors
124  mpMissingRights = -1;       // User has insufficient rights
125  mpAutoexecNoWriteacc = -2;  // Autoexec can not be written (may be readonly)
126  mpBothAddAndRemove = -3;    // User has specified that dir should both be removed from and added to path
127
128
129{ Helper procedure: Split a path environment variable into individual dirnames }
130procedure SplitPath(Path: string; var Dirs: TStringList);
131var
132  pos: integer;
133  s: string;
134begin
135  Dirs.Clear;
136  s := '';
137  pos := 1;
138  while (pos<=Length(Path)) do
139  begin
140    if (Path[pos]<>';') then
141      s := s + Path[pos];
142    if ((Path[pos]=';') or (pos=Length(Path))) then
143    begin
144      s := Trim(s);
145      s := RemoveQuotes(s);
146      s := Trim(s);
147      if (s <> '') then
148        Dirs.Add(s);
149      s := '';
150    end;
151    Pos := Pos + 1;
152  end;
153end; // procedure SplitPath
154
155
156{ Helper procedure: Concatenate individual dirnames into a path environment variable }
157procedure ConcatPath(Dirs: TStringList; Quotes: boolean; var Path: string);
158var
159  Index, MaxIndex: integer;
160  s: string;
161begin
162  MaxIndex := Dirs.Count-1;
163  Path := '';
164  for Index := 0 to MaxIndex do
165  begin
166    s := Dirs.Strings[Index];
167    if ((Quotes) and (pos(' ',s) > 0)) then
168      s := AddQuotes(s);
169    Path := Path + s;
170    if (Index < MaxIndex) then
171      Path := Path + ';'
172  end;
173end; // procedure ConcatPath
174
175
176{ Helper function: Modifies path environment string }
177procedure ModifyPathString(OldPath, DirName: string; Method: integer; Quotes: boolean; var ResultPath: string);
178var
179  Dirs: TStringList;
180  DirNotInPath: Boolean;
181  i: integer;
182begin
183  // Create Dirs variable
184  Dirs := TStringList.Create;
185
186  // Remove quotes form DirName
187  DirName := Trim(DirName);
188  DirName := RemoveQuotes(DirName);
189  DirName := Trim(DirName);
190
191  // Split old path in individual directory names
192  SplitPath(OldPath, Dirs);
193
194  // Check if dir is allready in path
195  DirNotInPath := True;
196  for i:=Dirs.Count-1 downto 0 do
197  begin
198    if (uppercase(Dirs.Strings[i]) = uppercase(DirName)) then
199      DirNotInPath := False;
200  end;
201
202  // Should dir be removed from existing Path?
203  if ((Method and (pmRemove or pmRemoveSubdirsAlso)) > 0) then
204  begin
205    for i:=Dirs.Count-1 downto 0 do
206    begin
207      if (((Method and pmRemoveSubdirsAlso) > 0) and (pos(uppercase(DirName)+'\', uppercase(Dirs.Strings[i])) = 1)) or
208         (((Method and (pmRemove) or (pmRemoveSubdirsAlso)) > 0) and (uppercase(DirName) = uppercase(Dirs.Strings[i])))
209      then
210        Dirs.Delete(i);
211    end;
212  end;
213
214  // Should dir be added to existing Path?
215  if ((Method and (pmAddToBeginning or pmAddToEnd)) > 0) then
216  begin
217    // Add dir to path
218    if (((Method and pmAddAllways) > 0) or DirNotInPath) then
219    begin
220      // Dir is not in path allready or should be added anyway
221      if (((Method and pmAddOnlyIfDirExists) = 0) or (DirExists(DirName))) then
222      begin
223        // Dir actually exsists or should be added anyway
224        if ((Method and pmAddToBeginning) > 0) then
225          Dirs.Insert(0, DirName)
226        else
227          Dirs.Append(DirName);
228      end;
229    end;
230  end;
231
232  // Concatenate directory names into one single path variable
233  ConcatPath(Dirs, Quotes, ResultPath);
234  // Finally free Dirs object
235  Dirs.Free;
236end; // ModifyPathString
237
238
239{ Helper function: Modify path on Windows 9x }
240function ModifyPath9x(DirName: string; Method: integer): integer;
241var
242  AutoexecLines: TStringList;
243  ActualLine: String;
244  PathLineNos: TStringList;
245  FirstPathLineNo: Integer;
246  OldPath, ResultPath: String;
247  LineNo, CharNo, Index: integer;
248
249  TempString: String;
250begin
251  // Expect everything to be OK
252  result := mpOK;
253
254  // Create stringslists
255  AutoexecLines := TStringList.Create;
256  PathLineNos := TStringList.Create;
257
258  // Read existing path
259  OldPath := '';
260  LoadStringFromFile('c:\Autoexec.bat', TempString);
261  AutoexecLines.Text := TempString;
262  PathLineNos.Clear;
263  // Read Autoexec line by line
264  for LineNo := 0 to AutoexecLines.Count - 1 do begin
265    ActualLine := AutoexecLines.Strings[LineNo];
266    // Check if line starts with "PATH=" after first stripping spaces and other "fill-chars"
267    if Pos('=', ActualLine) > 0 then
268    begin
269      for CharNo := Pos('=', ActualLine)-1 downto 1 do
270        if (ActualLine[CharNo]=' ') or (ActualLine[CharNo]=#9) then
271          Delete(ActualLine, CharNo, 1);
272      if Pos('@', ActualLine) = 1 then
273        Delete(ActualLine, 1, 1);
274      if (Pos('PATH=', uppercase(ActualLine))=1) or (Pos('SETPATH=', uppercase(ActualLine))=1) then
275      begin
276        // Remove 'PATH=' and add path to "OldPath" variable
277        Delete(ActualLine, 1, pos('=', ActualLine));
278        // Check if an earlier PATH variable is referenced, but there has been no previous PATH defined in Autoexec
279        if (pos('%PATH%',uppercase(ActualLine))>0) and (PathLineNos.Count=0) then
280          OldPath := ExpandConstant('{win}') + ';' + ExpandConstant('{win}')+'\COMMAND';
281        if (pos('%PATH%',uppercase(ActualLine))>0) then
282        begin
283          ActualLine := Copy(ActualLine, 1, pos('%PATH%',uppercase(ActualLine))-1) +
284                        OldPath +
285                        Copy(ActualLine, pos('%PATH%',uppercase(ActualLine))+6, Length(ActualLine));
286        end;
287        OldPath := ActualLine;
288
289        // Update list of line numbers holding path variables
290        PathLineNos.Add(IntToStr(LineNo));
291      end;
292    end;
293  end;
294
295  // Save first line number in Autoexec.bat which modifies path environment variable
296  if PathLineNos.Count > 0 then
297    FirstPathLineNo := StrToInt(PathLineNos.Strings[0])
298  else
299    FirstPathLineNo := 0;
300
301  // Modify path
302  ModifyPathString(OldPath, DirName, Method, True, ResultPath);
303
304  // Write Modified path back to Autoexec.bat
305  // First delete all existing path references from Autoexec.bat
306  Index := PathLineNos.Count-1;
307  while (Index>=0) do
308  begin
309    AutoexecLines.Delete(StrToInt(PathLineNos.Strings[Index]));
310    Index := Index-1;
311  end;
312  // Then insert new path variable into Autoexec.bat
313  AutoexecLines.Insert(FirstPathLineNo, '@PATH='+ResultPath);
314  // Delete old Autoexec.bat from disk
315  if not DeleteFile('c:\Autoexec.bat') then
316    result := mpAutoexecNoWriteAcc;
317  Sleep(500);
318  // And finally write Autoexec.bat back to disk
319  if not (result=mpAutoexecNoWriteAcc) then
320    SaveStringToFile('c:\Autoexec.bat', AutoexecLines.Text, false);
321
322  // Free stringlists
323  PathLineNos.Free;
324  AutoexecLines.Free;
325end; // ModifyPath9x
326
327
328{ Helper function: Modify path on Windows NT, 2000 and XP }
329function ModifyPathNT(DirName: string; Method, Scope: integer): integer;
330var
331  RegRootKey: integer;
332  RegSubKeyName: string;
333  RegValueName: string;
334  OldPath, ResultPath: string;
335  OK: boolean;
336begin
337  // Expect everything to be OK
338  result := mpOK;
339
340  // Initialize registry key and value names to reflect if changes should be global or local to current user only
341  case Scope of
342    psCurrentUser:
343      begin
344        RegRootKey := HKEY_CURRENT_USER;
345        RegSubKeyName := 'Environment';
346        RegValueName := 'Path';
347      end;
348    psAllUsers:
349      begin
350        RegRootKey := HKEY_LOCAL_MACHINE;
351        RegSubKeyName := 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment';
352        RegValueName := 'Path';
353      end;
354  end;
355
356  // Read current path value from registry
357  OK := RegQueryStringValue(RegRootKey, RegSubKeyName, RegValueName, OldPath);
358  if not OK then
359  begin
360    result := mpMissingRights;
361    Exit;
362  end;
363
364  // Modify path
365  ModifyPathString(OldPath, DirName, Method, False, ResultPath);
366
367  // Write new path value to registry
368  if not RegWriteStringValue(RegRootKey, RegSubKeyName, RegValueName, ResultPath) then
369  begin
370    result := mpMissingRights;
371    Exit;
372
373  end;
374end; // ModifyPathNT
375
376
377{ Main function: Modify path }
378function ModifyPath(Path: string; Method, Scope: integer): integer;
379begin
380  // Check if both add and remove has been specified (= error!)
381  if (Method and (pmAddToBeginning or pmAddToEnd) and (pmRemove or pmRemoveSubdirsAlso)) > 0 then
382  begin
383    result := mpBothAddAndRemove;
384    Exit;
385  end;
386
387  // Perform directory constant expansion
388  Path := ExpandConstantEx(Path, ' ', ' ');
389
390  // Test if Win9x
391  if InstallOnThisVersion('4,0','0,0') = irInstall then
392    ModifyPath9x(Path, Method);
393
394  // Test if WinNT, 2000 or XP
395  if InstallOnThisVersion('0,4','0,0') = irInstall then
396    ModifyPathNT(Path, Method, Scope);
397end; // ModifyPath
398
399
400
401
402// -----------------------------------------------------------------
403//                     install script hooks
404// -----------------------------------------------------------------
405
406procedure SetupPATH;
407var
408  p : string;
409  scope : integer;
410begin
411  p:= ExpandConstant('{app}\bin');
412  if IsAdminLoggedOn then
413    scope:= psAllUsers
414  else
415    scope:= psCurrentUser;
416  ModifyPath(p, pmAddToEnd, scope);
417end;
418
419procedure InstallSetupPath;
420begin
421//    if ShouldProcessEntry('', 'addpath') = srYes then
422                SetupPATH;
423end;
Note: See TracBrowser for help on using the repository browser.