~ubuntu-branches/ubuntu/trusty/rasmol/trusty

« back to all changes in this revision

Viewing changes to src/mswin/raswin_install.nsi

  • Committer: Bazaar Package Importer
  • Author(s): Teemu Ikonen
  • Date: 2009-11-24 16:48:04 UTC
  • mfrom: (3.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091124164804-liuvywcs6l45ibl3
Tags: 2.7.5-1
* New upstream release
* Imakefile: Use Debian versions of library dependencies
* control:
  - Add build-deps to libcvector2-dev, libcqrlib2-dev, libneartree3-dev
  - Update to standards-version 3.8.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
; NSIS Script for RasMol RasWin 2.7.4 windows install
2
 
; H. J. Bernstein, yaya at bernstein-plus-sons dot com
3
 
;
4
 
 
5
 
; >>> Include the modern user interface
6
 
!include "MUI.nsh"
7
 
!include "Sections.nsh"
8
 
!include "LogicLib.nsh"
9
 
 
10
 
; >>> Name the package, file and default install directory
11
 
Name        "RasMol -- RasWin 2.7.4"
12
 
OutFile     "RasWin_2_7_4_Install.exe"
13
 
InstallDir  "$PROGRAMFILES\RasWin"
14
 
InstallDirRegKey HKLM "Software\RasWin" ""
15
 
 
16
 
!define     MUI_ABORTWARNING
17
 
!define     MUI_LANGDLL_REGISTRY_ROOT "HKLM" 
18
 
!define     MUI_LANGDLL_REGISTRY_KEY "Software\RasWin" 
19
 
!define     MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
20
 
!define     MUI_LANGDLL_ALWAYSSHOW
21
 
!define     MUI_COMPONENTSPAGE_SMALLDESC
22
 
 
23
 
 
24
 
 
25
 
; >>> insert the bits and pieces we want
26
 
!insertmacro MUI_PAGE_LICENSE "..\..\doc\Licenses.txt"
27
 
!insertmacro MUI_PAGE_COMPONENTS
28
 
!insertmacro MUI_PAGE_DIRECTORY
29
 
!insertmacro MUI_PAGE_INSTFILES
30
 
  
31
 
!insertmacro MUI_UNPAGE_CONFIRM
32
 
!insertmacro MUI_UNPAGE_INSTFILES
33
 
 
34
 
; >> set up the languages
35
 
  
36
 
!insertmacro MUI_LANGUAGE "English"
37
 
!insertmacro MUI_LANGUAGE "French"
38
 
!insertmacro MUI_LANGUAGE "German"
39
 
!insertmacro MUI_LANGUAGE "Italian"
40
 
!insertmacro MUI_LANGUAGE "Spanish"
41
 
!insertmacro MUI_LANGUAGE "Russian"
42
 
!insertmacro MUI_LANGUAGE "Bulgarian"
43
 
!insertmacro MUI_LANGUAGE "SimpChinese"
44
 
!insertmacro MUI_LANGUAGE "Japanese"
45
 
 
46
 
!insertmacro MUI_RESERVEFILE_LANGDLL
47
 
 
48
 
 
49
 
; >>> The actual installer
50
 
 
51
 
InstType "Typical"
52
 
InstType "Without .scr and .ras extensions"
53
 
InstType "Without rasmol.ini"
54
 
 
55
 
Section    "Install RasMol -- RasWin 2.7.4" SecInstRasWin
56
 
 
57
 
SectionIn 1 2 3
58
 
 
59
 
SetShellVarContext  all
60
 
SetOutPath "$INSTDIR"
61
 
File       "..\..\doc\RasMolReferenceCard.pdf"
62
 
File       "raswin.exe"
63
 
File       "..\..\doc\GPL.txt"
64
 
File       "..\..\doc\NOTICE.txt"
65
 
File       "..\..\doc\RASLIC.txt"
66
 
File       "..\..\doc\rasmol.hlp"
67
 
File       "..\..\doc\raswin.hlp"
68
 
File       "raswin.ico"
69
 
File       "raswin_doc.ico"
70
 
File       "raswin_scr.ico"
71
 
WriteRegStr SHCTX "Software\RasWin" "" $INSTDIR
72
 
WriteUninstaller "$INSTDIR\Uninstall.exe"
73
 
 
74
 
WriteRegStr SHCTX \
75
 
"Software\Microsoft\Windows\CurrentVersion\Uninstall\RasWin" \
76
 
"DisplayName" "RasWin (remove only)"
77
 
WriteRegStr SHCTX \
78
 
"Software\Microsoft\Windows\CurrentVersion\Uninstall\RasWin" \
79
 
"UninstallString" "$INSTDIR\Uninstall.exe"
80
 
 
81
 
; >>> start-menu items
82
 
SetShellVarContext  all
83
 
CreateDirectory    "$SMPROGRAMS\RasWin"
84
 
CreateShortCut     "$SMPROGRAMS\RasWin\Uninstall.lnk" \
85
 
"$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0
86
 
CreateShortCut     "$SMPROGRAMS\RasWin\RasWin.lnk" \
87
 
"$INSTDIR\RasWin.exe" "" "$INSTDIR\RasWin.exe" 0
88
 
 
89
 
 
90
 
; >>> environment variable
91
 
 
92
 
Push "RASMOLPATH"
93
 
Push "$INSTDIR"
94
 
Call WriteEnvStr
95
 
 
96
 
SectionEnd
97
 
 
98
 
Section    "Install G. A. Pozhvanov's INI for initial file display" SecInstINI
99
 
 
100
 
SectionIn 1 2
101
 
 
102
 
SetShellVarContext  all
103
 
SetOutPath "$INSTDIR"
104
 
File       "rasmol.ini"
105
 
 
106
 
SectionEnd
107
 
 
108
 
 
109
 
Section "Place RasWin Shortcut on Desktop" SecShortcut
110
 
 
111
 
SectionIn 1 2 3
112
 
 
113
 
SetShellVarContext  all
114
 
 
115
 
CreateShortCut "$DESKTOP\RasWin.lnk" "$INSTDIR\RasWin.exe" 
116
 
 
117
 
SectionEnd
118
 
 
119
 
SectionGroup "File Extensions" SecFileExt
120
 
 
121
 
Section "Register .pdb file extension" SecRegPDB
122
 
 
123
 
SectionIn 1 2 3
124
 
 
125
 
WriteRegStr HKCR ".pdb" "" "RasWin.Document"
126
 
SectionEnd
127
 
 
128
 
Section "Register .ent file extension" SecRegENT
129
 
 
130
 
SectionIn 1 2 3
131
 
 
132
 
WriteRegStr HKCR ".ent" "" "RasWin.Document"
133
 
SectionEnd
134
 
 
135
 
Section "Register .cif file extension" SecRegCIF
136
 
 
137
 
SectionIn 1 2 3
138
 
 
139
 
WriteRegStr HKCR ".cif" "" "RasWin.Document"
140
 
SectionEnd
141
 
 
142
 
Section "Register .scr file extension" SecRegSCR
143
 
 
144
 
SectionIn 1 3
145
 
 
146
 
WriteRegStr HKCR ".scr" "" "RasWin.Script"
147
 
SectionEnd
148
 
 
149
 
Section "Register .spt file extension" SecRegSPT
150
 
 
151
 
SectionIn 1 2 3
152
 
 
153
 
WriteRegStr HKCR ".spt" "" "RasWin.Script"
154
 
SectionEnd
155
 
 
156
 
Section "Register .rsm file extension" SecRegRSM
157
 
 
158
 
SectionIn 1 2 3
159
 
 
160
 
WriteRegStr HKCR ".rsm" "" "RasWin.Script"
161
 
SectionEnd
162
 
 
163
 
Section "Register .rsml file extension" SecRegRSML
164
 
 
165
 
SectionIn 1 2 3
166
 
 
167
 
WriteRegStr HKCR ".rsml" "" "RasWin.Script"
168
 
SectionEnd
169
 
 
170
 
Section  "Register .ras file extension" SecRegRAS
171
 
 
172
 
SectionIn 1 3
173
 
 
174
 
WriteRegStr HKCR ".ras" "" "RasWin.Script"
175
 
SectionEnd
176
 
 
177
 
 
178
 
Section "Define RasWin Document Type" SecDocType
179
 
 
180
 
SectionIn 1 2 3
181
 
 
182
 
WriteRegStr HKCR "RasWin.Document" "" "RasMol RasWin Document"
183
 
WriteRegStr HKCR "RasWin.Document\DefaultIcon" "" "$INSTDIR\raswin.exe,1"
184
 
ReadRegStr $R0 HKCR "RasWin.Document\shell\open\command" ""
185
 
StrCmp $R0 "" 0 no_rdocopen
186
 
  WriteRegStr HKCR "RasWin.Document\shell" "" "open"
187
 
  WriteRegStr HKCR "RasWin.Document\shell\open\command" "" '$INSTDIR\RasWin.exe "%1"'
188
 
no_rdocopen:
189
 
WriteRegStr HKCR "RasWin.Script" "" "RasMol RasWin Script"
190
 
WriteRegStr HKCR "RasWin.Script\DefaultIcon" "" "$INSTDIR\raswin.exe,2"
191
 
StrCmp $R0 "" 0 no_rscropen
192
 
  WriteRegStr HKCR "RasWin.Script\shell" "" "open"
193
 
  WriteRegStr HKCR "RasWin.Script\shell\open\command" "" '$INSTDIR\RasWin.exe -script "%1"'
194
 
no_rscropen:
195
 
SectionEnd
196
 
 
197
 
SectionGroupEnd
198
 
 
199
 
Section "Install Sample Data" SecSampData
200
 
 
201
 
SectionIn 1 2 3
202
 
 
203
 
CreateDirectory "$INSTDIR\Data"
204
 
SetOutPath "$INSTDIR\Data"
205
 
File       "..\..\data\1crn.pdb"
206
 
File       "..\..\data\3cro.pdb"
207
 
File       "..\..\data\4ins.CIF"
208
 
SectionEnd
209
 
 
210
 
 
211
 
 
212
 
; >>> Descriptions
213
 
 
214
 
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
215
 
  !insertmacro MUI_DESCRIPTION_TEXT ${SecInstRasWin} "Basic install of RasMol RasWin executable in $INSTDIR and start menu"
216
 
  !insertmacro MUI_DESCRIPTION_TEXT ${SecInstINI} "Install of Gregory A. Pozhvanov's rasmol.ini for initial display of files in $INSTDIR"
217
 
  !insertmacro MUI_DESCRIPTION_TEXT ${SecShortCut} "Put a RasWin Shortcut on the Desktop"
218
 
  !insertmacro MUI_DESCRIPTION_TEXT ${SecFileExt} "Define the .pdb, .ent, .cif, .scr, .spt, .rsm, .rsml and .ras file extensions and document types"
219
 
  !insertmacro MUI_DESCRIPTION_TEXT ${SecRegPDB} "Define .pdb file extension as RasWin.Document"
220
 
  !insertmacro MUI_DESCRIPTION_TEXT ${SecRegENT} "Define .ent file extension as RasWin.Document"
221
 
  !insertmacro MUI_DESCRIPTION_TEXT ${SecRegCIF} "Define .cif file extension as RasWin.Document"
222
 
  !insertmacro MUI_DESCRIPTION_TEXT ${SecRegSCR} "Define .scr file extension as RasWin.Script"
223
 
  !insertmacro MUI_DESCRIPTION_TEXT ${SecRegSPT} "Define .spt file extension as RasWin.Script"
224
 
  !insertmacro MUI_DESCRIPTION_TEXT ${SecRegRSM} "Define .rsm file extension as RasWin.Script"
225
 
  !insertmacro MUI_DESCRIPTION_TEXT ${SecRegRSML} "Define .rsml file extension as RasWin.Script"
226
 
  !insertmacro MUI_DESCRIPTION_TEXT ${SecRegRAS} "Define .ras file extension as RasWin.Script"
227
 
  !insertmacro MUI_DESCRIPTION_TEXT ${SecDoctype} "Define RasMol RasWin Document (RasWin.Document) and Script (RasWin.Script) types"
228
 
  !insertmacro MUI_DESCRIPTION_TEXT ${SecSampData} "Install sample data files in $INSTDIR\Data"
229
 
!insertmacro MUI_FUNCTION_DESCRIPTION_END
230
 
 
231
 
 
232
 
; >>> Installer Functions
233
 
 
234
 
Function .onInit
235
 
!insertmacro MUI_LANGDLL_DISPLAY
236
 
FunctionEnd
237
 
 
238
 
Function .onInstSuccess
239
 
MessageBox MB_OK "You have successfully installed RasWin."
240
 
FunctionEnd
241
 
 
242
 
 
243
 
 
244
 
 
245
 
 
246
 
; >>> Uninstaller Section
247
 
 
248
 
Section     "Uninstall"
249
 
SetShellVarContext  all
250
 
Delete      "$INSTDIR\RasMolReferenceCard.pdf"
251
 
Delete      "$INSTDIR\rasmol.ini"
252
 
Delete      "$INSTDIR\raswin.exe"
253
 
Delete      "$INSTDIR\GPL.txt"
254
 
Delete      "$INSTDIR\NOTICE.txt"
255
 
Delete      "$INSTDIR\RASLIC.txt"
256
 
Delete      "$INSTDIR\rasmol.hlp"
257
 
Delete      "$INSTDIR\raswin.hlp"
258
 
Delete      "$INSTDIR\raswin.ico"
259
 
Delete      "$INSTDIR\raswin_doc.ico"
260
 
Delete      "$INSTDIR\raswin_scr.ico"
261
 
Delete      "$DESKTOP\RasWin.lnk"
262
 
Delete      "$SMPROGRAMS\RasWin\*.*"
263
 
RmDir       "$SMPROGRAMS\RasWin"
264
 
Delete      "$INSTDIR\Data\1crn.pdb"
265
 
Delete      "$INSTDIR\Data\3cro.pdb"
266
 
Delete      "$INSTDIR\Data\4ins.CIF"
267
 
RmDir       "$INSTDIR\Data"
268
 
 
269
 
Delete      "$INSTDIR\Uninstall.exe"
270
 
RMDir       "$INSTDIR"
271
 
DeleteRegKey /ifempty SHCTX "Software\RasWin"
272
 
DeleteRegKey SHCTX "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\RasWin"
273
 
DeleteRegKey HKCR "RasWin.Document\shell\open\command"
274
 
DeleteRegKey HKCR "RasWin.Document\shell"
275
 
DeleteRegKey HKCR "RasWin.Document\DefaultIcon"
276
 
DeleteRegKey HKCR "RasWin.Document"
277
 
DeleteRegKey HKCR "RasWin.Script\shell\open\command"
278
 
DeleteRegKey HKCR "RasWin.Script\shell"
279
 
DeleteRegKey HKCR "RasWin.Script\DefaultIcon"
280
 
DeleteRegKey HKCR "RasWin.Script"
281
 
 
282
 
ReadRegStr $R0 HKCR ".pdb" ""
283
 
StrCmp $R0  "RasWin.Document" 0 +2
284
 
  DeleteRegKey HKCR ".pdb"
285
 
 
286
 
ReadRegStr $R0 HKCR ".ent" ""
287
 
StrCmp $R0  "RasWin.Document" 0 +2
288
 
  DeleteRegKey HKCR ".ent"
289
 
 
290
 
ReadRegStr $R0 HKCR ".cif" ""
291
 
StrCmp $R0  "RasWin.Document" 0 +2
292
 
  DeleteRegKey HKCR ".cif"
293
 
 
294
 
ReadRegStr $R0 HKCR ".scr" ""
295
 
StrCmp $R0  "RasWin.Script" 0 +2
296
 
  DeleteRegKey HKCR ".scr"
297
 
 
298
 
ReadRegStr $R0 HKCR ".spt" ""
299
 
StrCmp $R0  "RasWin.Script" 0 +2
300
 
  DeleteRegKey HKCR ".spt"
301
 
 
302
 
ReadRegStr $R0 HKCR ".rsm" ""
303
 
StrCmp $R0  "RasWin.Script" 0 +2
304
 
  DeleteRegKey HKCR ".rsm"
305
 
 
306
 
ReadRegStr $R0 HKCR ".rsml" ""
307
 
StrCmp $R0  "RasWin.Script" 0 +2
308
 
  DeleteRegKey HKCR ".rsml"
309
 
 
310
 
ReadRegStr $R0 HKCR ".ras" ""
311
 
StrCmp $R0  "RasWin.Script" 0 +2
312
 
  DeleteRegKey HKCR ".ras"
313
 
 
314
 
 
315
 
Push         "RASMOLPATH"
316
 
Call         un.DeleteEnvStr
317
 
 
318
 
SectionEnd
319
 
 
320
 
 
321
 
 
322
 
; >>> Uninstaller Functions
323
 
 
324
 
Function un.onInit
325
 
!insertmacro MUI_UNGETLANGUAGE
326
 
FunctionEnd
327
 
 
328
 
Function un.onUninstSuccess
329
 
MessageBox MB_OK "You have successfully uninstalled RasWin."
330
 
FunctionEnd
331
 
 
332
 
; >>> Environment Variables Functions
333
 
 
334
 
!define ALL_USERS
335
 
#
336
 
#  The following functions are from
337
 
#
338
 
#  http://nsis.sourceforge.net/Setting_Environment_Variables
339
 
#
340
 
!include WinMessages.nsh
341
 
 
342
 
!ifndef WriteEnvStr_RegKey
343
 
  !ifdef ALL_USERS
344
 
    !define WriteEnvStr_RegKey \
345
 
       'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
346
 
  !else
347
 
    !define WriteEnvStr_RegKey 'HKCU "Environment"'
348
 
  !endif
349
 
!endif
350
 
# WriteEnvStr - Writes an environment variable
351
 
# Note: Win9x systems requires reboot
352
 
#
353
 
# Example:
354
 
#  Push "HOMEDIR"           # name
355
 
#  Push "C:\New Home Dir\"  # value
356
 
#  Call WriteEnvStr
357
 
#
358
 
Function WriteEnvStr
359
 
  Exch $1 ; $1 has environment variable value
360
 
  Exch
361
 
  Exch $0 ; $0 has environment variable name
362
 
  Push $2
363
 
 
364
 
  Call IsNT
365
 
  Pop $2
366
 
  StrCmp $2 1 WriteEnvStr_NT
367
 
    ; Not on NT
368
 
    StrCpy $2 $WINDIR 2 ; Copy drive of windows (c:)
369
 
    FileOpen $2 "$2\autoexec.bat" a
370
 
    FileSeek $2 0 END
371
 
    FileWrite $2 "$\r$\nSET $0=$1$\r$\n"
372
 
    FileClose $2
373
 
    SetRebootFlag true
374
 
    Goto WriteEnvStr_done
375
 
 
376
 
  WriteEnvStr_NT:
377
 
      WriteRegExpandStr ${WriteEnvStr_RegKey} $0 $1
378
 
      SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} \
379
 
        0 "STR:Environment" /TIMEOUT=5000
380
 
 
381
 
  WriteEnvStr_done:
382
 
    Pop $2
383
 
    Pop $0
384
 
    Pop $1
385
 
FunctionEnd
386
 
 
387
 
#
388
 
# un.DeleteEnvStr - Removes an environment variable
389
 
# Note: Win9x systems requires reboot
390
 
#
391
 
# Example:
392
 
#  Push "HOMEDIR"           # name
393
 
#  Call un.DeleteEnvStr
394
 
#
395
 
Function un.DeleteEnvStr
396
 
  Exch $0 ; $0 now has the name of the variable
397
 
  Push $1
398
 
  Push $2
399
 
  Push $3
400
 
  Push $4
401
 
  Push $5
402
 
 
403
 
  Call un.IsNT
404
 
  Pop $1
405
 
  StrCmp $1 1 DeleteEnvStr_NT
406
 
    ; Not on NT
407
 
    StrCpy $1 $WINDIR 2
408
 
    FileOpen $1 "$1\autoexec.bat" r
409
 
    GetTempFileName $4
410
 
    FileOpen $2 $4 w
411
 
    StrCpy $0 "SET $0="
412
 
    SetRebootFlag true
413
 
 
414
 
    DeleteEnvStr_dosLoop:
415
 
      FileRead $1 $3
416
 
      StrLen $5 $0
417
 
      StrCpy $5 $3 $5
418
 
      StrCmp $5 $0 DeleteEnvStr_dosLoop
419
 
      StrCmp $5 "" DeleteEnvStr_dosLoopEnd
420
 
      FileWrite $2 $3
421
 
      Goto DeleteEnvStr_dosLoop
422
 
 
423
 
    DeleteEnvStr_dosLoopEnd:
424
 
      FileClose $2
425
 
      FileClose $1
426
 
      StrCpy $1 $WINDIR 2
427
 
      Delete "$1\autoexec.bat"
428
 
      CopyFiles /SILENT $4 "$1\autoexec.bat"
429
 
      Delete $4
430
 
      Goto DeleteEnvStr_done
431
 
 
432
 
  DeleteEnvStr_NT:
433
 
    DeleteRegValue ${WriteEnvStr_RegKey} $0
434
 
    SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} \
435
 
      0 "STR:Environment" /TIMEOUT=5000
436
 
 
437
 
  DeleteEnvStr_done:
438
 
    Pop $5
439
 
    Pop $4
440
 
    Pop $3
441
 
    Pop $2
442
 
    Pop $1
443
 
    Pop $0
444
 
FunctionEnd
445
 
 
446
 
!ifndef IsNT_KiCHiK
447
 
!define IsNT_KiCHiK
448
 
 
449
 
#
450
 
# [un.]IsNT - Pushes 1 if running on NT, 0 if not
451
 
#
452
 
# Example:
453
 
#   Call IsNT
454
 
#   Pop $0
455
 
#   StrCmp $0 1 +3
456
 
#     MessageBox MB_OK "Not running on NT!"
457
 
#     Goto +2
458
 
#     MessageBox MB_OK "Running on NT!"
459
 
#
460
 
!macro IsNT UN
461
 
Function ${UN}IsNT
462
 
  Push $0
463
 
  ReadRegStr $0 HKLM \
464
 
    "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
465
 
  StrCmp $0 "" 0 IsNT_yes
466
 
  ; we are not NT.
467
 
  Pop $0
468
 
  Push 0
469
 
  Return
470
 
 
471
 
  IsNT_yes:
472
 
    ; NT!!!
473
 
    Pop $0
474
 
    Push 1
475
 
FunctionEnd
476
 
!macroend
477
 
!insertmacro IsNT ""
478
 
!insertmacro IsNT "un."
479
 
 
480
 
!endif ; IsNT_KiCHiK
481
 
 
482
 
 
 
 
b'\\ No newline at end of file'
 
1
; NSIS Script for RasMol RasWin 2.7.5 windows install
 
2
; H. J. Bernstein, yaya at bernstein-plus-sons dot com
 
3
;
 
4
 
 
5
; >>> Include the modern user interface
 
6
!include "MUI.nsh"
 
7
!include "Sections.nsh"
 
8
!include "LogicLib.nsh"
 
9
 
 
10
; >>> Name the package, file and default install directory
 
11
Name        "RasMol -- RasWin 2.7.5"
 
12
OutFile     "RasWin_2_7_5_Install.exe"
 
13
InstallDir  "$PROGRAMFILES\RasWin"
 
14
InstallDirRegKey HKLM "Software\RasWin" ""
 
15
 
 
16
!define     MUI_ABORTWARNING
 
17
!define     MUI_LANGDLL_REGISTRY_ROOT "HKLM" 
 
18
!define     MUI_LANGDLL_REGISTRY_KEY "Software\RasWin" 
 
19
!define     MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
 
20
!define     MUI_LANGDLL_ALWAYSSHOW
 
21
!define     MUI_COMPONENTSPAGE_SMALLDESC
 
22
 
 
23
 
 
24
 
 
25
; >>> insert the bits and pieces we want
 
26
!insertmacro MUI_PAGE_LICENSE "..\..\doc\Licenses.txt"
 
27
!insertmacro MUI_PAGE_COMPONENTS
 
28
!insertmacro MUI_PAGE_DIRECTORY
 
29
!insertmacro MUI_PAGE_INSTFILES
 
30
  
 
31
!insertmacro MUI_UNPAGE_CONFIRM
 
32
!insertmacro MUI_UNPAGE_INSTFILES
 
33
 
 
34
; >> set up the languages
 
35
  
 
36
!insertmacro MUI_LANGUAGE "English"
 
37
!insertmacro MUI_LANGUAGE "French"
 
38
!insertmacro MUI_LANGUAGE "German"
 
39
!insertmacro MUI_LANGUAGE "Italian"
 
40
!insertmacro MUI_LANGUAGE "Spanish"
 
41
!insertmacro MUI_LANGUAGE "Russian"
 
42
!insertmacro MUI_LANGUAGE "Bulgarian"
 
43
!insertmacro MUI_LANGUAGE "SimpChinese"
 
44
!insertmacro MUI_LANGUAGE "Japanese"
 
45
 
 
46
!insertmacro MUI_RESERVEFILE_LANGDLL
 
47
 
 
48
 
 
49
; >>> The actual installer
 
50
 
 
51
InstType "Typical"
 
52
InstType "Without .scr and .ras extensions"
 
53
InstType "Without rasmol.ini"
 
54
 
 
55
Section    "Install RasMol -- RasWin 2.7.5" SecInstRasWin
 
56
 
 
57
SectionIn 1 2 3
 
58
 
 
59
SetShellVarContext  all
 
60
SetOutPath "$INSTDIR"
 
61
File       "..\..\doc\RasMolReferenceCard.pdf"
 
62
File       "raswin.exe"
 
63
File       "..\..\doc\GPL.txt"
 
64
File       "..\..\doc\NOTICE.txt"
 
65
File       "..\..\doc\RASLIC.txt"
 
66
File       "..\..\doc\rasmol.hlp"
 
67
File       "..\..\doc\raswin.hlp"
 
68
File       "raswin.ico"
 
69
File       "raswin_doc.ico"
 
70
File       "raswin_scr.ico"
 
71
WriteRegStr SHCTX "Software\RasWin" "" $INSTDIR
 
72
WriteUninstaller "$INSTDIR\Uninstall.exe"
 
73
 
 
74
WriteRegStr SHCTX \
 
75
"Software\Microsoft\Windows\CurrentVersion\Uninstall\RasWin" \
 
76
"DisplayName" "RasWin (remove only)"
 
77
WriteRegStr SHCTX \
 
78
"Software\Microsoft\Windows\CurrentVersion\Uninstall\RasWin" \
 
79
"UninstallString" "$INSTDIR\Uninstall.exe"
 
80
 
 
81
; >>> start-menu items
 
82
SetShellVarContext  all
 
83
CreateDirectory    "$SMPROGRAMS\RasWin"
 
84
CreateShortCut     "$SMPROGRAMS\RasWin\Uninstall.lnk" \
 
85
"$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0
 
86
CreateShortCut     "$SMPROGRAMS\RasWin\RasWin.lnk" \
 
87
"$INSTDIR\RasWin.exe" "" "$INSTDIR\RasWin.exe" 0
 
88
 
 
89
 
 
90
; >>> environment variable
 
91
 
 
92
Push "RASMOLPATH"
 
93
Push "$INSTDIR"
 
94
Call WriteEnvStr
 
95
 
 
96
SectionEnd
 
97
 
 
98
Section    "Install G. A. Pozhvanov's INI for initial file display" SecInstINI
 
99
 
 
100
SectionIn 1 2
 
101
 
 
102
SetShellVarContext  all
 
103
SetOutPath "$INSTDIR"
 
104
File       "rasmol.ini"
 
105
 
 
106
SectionEnd
 
107
 
 
108
 
 
109
Section "Place RasWin Shortcut on Desktop" SecShortcut
 
110
 
 
111
SectionIn 1 2 3
 
112
 
 
113
SetShellVarContext  all
 
114
 
 
115
CreateShortCut "$DESKTOP\RasWin.lnk" "$INSTDIR\RasWin.exe" 
 
116
 
 
117
SectionEnd
 
118
 
 
119
SectionGroup "File Extensions" SecFileExt
 
120
 
 
121
Section "Register .pdb file extension" SecRegPDB
 
122
 
 
123
SectionIn 1 2 3
 
124
 
 
125
WriteRegStr HKCR ".pdb" "" "RasWin.Document"
 
126
SectionEnd
 
127
 
 
128
Section "Register .ent file extension" SecRegENT
 
129
 
 
130
SectionIn 1 2 3
 
131
 
 
132
WriteRegStr HKCR ".ent" "" "RasWin.Document"
 
133
SectionEnd
 
134
 
 
135
Section "Register .cif file extension" SecRegCIF
 
136
 
 
137
SectionIn 1 2 3
 
138
 
 
139
WriteRegStr HKCR ".cif" "" "RasWin.Document"
 
140
SectionEnd
 
141
 
 
142
Section "Register .scr file extension" SecRegSCR
 
143
 
 
144
SectionIn 1 3
 
145
 
 
146
WriteRegStr HKCR ".scr" "" "RasWin.Script"
 
147
SectionEnd
 
148
 
 
149
Section "Register .spt file extension" SecRegSPT
 
150
 
 
151
SectionIn 1 2 3
 
152
 
 
153
WriteRegStr HKCR ".spt" "" "RasWin.Script"
 
154
SectionEnd
 
155
 
 
156
Section "Register .rsm file extension" SecRegRSM
 
157
 
 
158
SectionIn 1 2 3
 
159
 
 
160
WriteRegStr HKCR ".rsm" "" "RasWin.Script"
 
161
SectionEnd
 
162
 
 
163
Section "Register .rsml file extension" SecRegRSML
 
164
 
 
165
SectionIn 1 2 3
 
166
 
 
167
WriteRegStr HKCR ".rsml" "" "RasWin.Script"
 
168
SectionEnd
 
169
 
 
170
Section  "Register .ras file extension" SecRegRAS
 
171
 
 
172
SectionIn 1 3
 
173
 
 
174
WriteRegStr HKCR ".ras" "" "RasWin.Script"
 
175
SectionEnd
 
176
 
 
177
 
 
178
Section "Define RasWin Document Type" SecDocType
 
179
 
 
180
SectionIn 1 2 3
 
181
 
 
182
WriteRegStr HKCR "RasWin.Document" "" "RasMol RasWin Document"
 
183
WriteRegStr HKCR "RasWin.Document\DefaultIcon" "" "$INSTDIR\raswin.exe,1"
 
184
ReadRegStr $R0 HKCR "RasWin.Document\shell\open\command" ""
 
185
StrCmp $R0 "" 0 no_rdocopen
 
186
  WriteRegStr HKCR "RasWin.Document\shell" "" "open"
 
187
  WriteRegStr HKCR "RasWin.Document\shell\open\command" "" '$INSTDIR\RasWin.exe "%1"'
 
188
no_rdocopen:
 
189
WriteRegStr HKCR "RasWin.Script" "" "RasMol RasWin Script"
 
190
WriteRegStr HKCR "RasWin.Script\DefaultIcon" "" "$INSTDIR\raswin.exe,2"
 
191
StrCmp $R0 "" 0 no_rscropen
 
192
  WriteRegStr HKCR "RasWin.Script\shell" "" "open"
 
193
  WriteRegStr HKCR "RasWin.Script\shell\open\command" "" '$INSTDIR\RasWin.exe -script "%1"'
 
194
no_rscropen:
 
195
SectionEnd
 
196
 
 
197
SectionGroupEnd
 
198
 
 
199
Section "Install Sample Data" SecSampData
 
200
 
 
201
SectionIn 1 2 3
 
202
 
 
203
CreateDirectory "$INSTDIR\Data"
 
204
SetOutPath "$INSTDIR\Data"
 
205
File       "..\..\data\1crn.pdb"
 
206
File       "..\..\data\3cro.pdb"
 
207
File       "..\..\data\4ins.CIF"
 
208
SectionEnd
 
209
 
 
210
 
 
211
 
 
212
; >>> Descriptions
 
213
 
 
214
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
 
215
  !insertmacro MUI_DESCRIPTION_TEXT ${SecInstRasWin} "Basic install of RasMol RasWin executable in $INSTDIR and start menu"
 
216
  !insertmacro MUI_DESCRIPTION_TEXT ${SecInstINI} "Install of Gregory A. Pozhvanov's rasmol.ini for initial display of files in $INSTDIR"
 
217
  !insertmacro MUI_DESCRIPTION_TEXT ${SecShortCut} "Put a RasWin Shortcut on the Desktop"
 
218
  !insertmacro MUI_DESCRIPTION_TEXT ${SecFileExt} "Define the .pdb, .ent, .cif, .scr, .spt, .rsm, .rsml and .ras file extensions and document types"
 
219
  !insertmacro MUI_DESCRIPTION_TEXT ${SecRegPDB} "Define .pdb file extension as RasWin.Document"
 
220
  !insertmacro MUI_DESCRIPTION_TEXT ${SecRegENT} "Define .ent file extension as RasWin.Document"
 
221
  !insertmacro MUI_DESCRIPTION_TEXT ${SecRegCIF} "Define .cif file extension as RasWin.Document"
 
222
  !insertmacro MUI_DESCRIPTION_TEXT ${SecRegSCR} "Define .scr file extension as RasWin.Script"
 
223
  !insertmacro MUI_DESCRIPTION_TEXT ${SecRegSPT} "Define .spt file extension as RasWin.Script"
 
224
  !insertmacro MUI_DESCRIPTION_TEXT ${SecRegRSM} "Define .rsm file extension as RasWin.Script"
 
225
  !insertmacro MUI_DESCRIPTION_TEXT ${SecRegRSML} "Define .rsml file extension as RasWin.Script"
 
226
  !insertmacro MUI_DESCRIPTION_TEXT ${SecRegRAS} "Define .ras file extension as RasWin.Script"
 
227
  !insertmacro MUI_DESCRIPTION_TEXT ${SecDoctype} "Define RasMol RasWin Document (RasWin.Document) and Script (RasWin.Script) types"
 
228
  !insertmacro MUI_DESCRIPTION_TEXT ${SecSampData} "Install sample data files in $INSTDIR\Data"
 
229
!insertmacro MUI_FUNCTION_DESCRIPTION_END
 
230
 
 
231
 
 
232
; >>> Installer Functions
 
233
 
 
234
Function .onInit
 
235
!insertmacro MUI_LANGDLL_DISPLAY
 
236
FunctionEnd
 
237
 
 
238
Function .onInstSuccess
 
239
MessageBox MB_OK "You have successfully installed RasWin."
 
240
FunctionEnd
 
241
 
 
242
 
 
243
 
 
244
 
 
245
 
 
246
; >>> Uninstaller Section
 
247
 
 
248
Section     "Uninstall"
 
249
SetShellVarContext  all
 
250
Delete      "$INSTDIR\RasMolReferenceCard.pdf"
 
251
Delete      "$INSTDIR\rasmol.ini"
 
252
Delete      "$INSTDIR\raswin.exe"
 
253
Delete      "$INSTDIR\GPL.txt"
 
254
Delete      "$INSTDIR\NOTICE.txt"
 
255
Delete      "$INSTDIR\RASLIC.txt"
 
256
Delete      "$INSTDIR\rasmol.hlp"
 
257
Delete      "$INSTDIR\raswin.hlp"
 
258
Delete      "$INSTDIR\raswin.ico"
 
259
Delete      "$INSTDIR\raswin_doc.ico"
 
260
Delete      "$INSTDIR\raswin_scr.ico"
 
261
Delete      "$DESKTOP\RasWin.lnk"
 
262
Delete      "$SMPROGRAMS\RasWin\*.*"
 
263
RmDir       "$SMPROGRAMS\RasWin"
 
264
Delete      "$INSTDIR\Data\1crn.pdb"
 
265
Delete      "$INSTDIR\Data\3cro.pdb"
 
266
Delete      "$INSTDIR\Data\4ins.CIF"
 
267
RmDir       "$INSTDIR\Data"
 
268
 
 
269
Delete      "$INSTDIR\Uninstall.exe"
 
270
RMDir       "$INSTDIR"
 
271
DeleteRegKey /ifempty SHCTX "Software\RasWin"
 
272
DeleteRegKey SHCTX "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\RasWin"
 
273
DeleteRegKey HKCR "RasWin.Document\shell\open\command"
 
274
DeleteRegKey HKCR "RasWin.Document\shell"
 
275
DeleteRegKey HKCR "RasWin.Document\DefaultIcon"
 
276
DeleteRegKey HKCR "RasWin.Document"
 
277
DeleteRegKey HKCR "RasWin.Script\shell\open\command"
 
278
DeleteRegKey HKCR "RasWin.Script\shell"
 
279
DeleteRegKey HKCR "RasWin.Script\DefaultIcon"
 
280
DeleteRegKey HKCR "RasWin.Script"
 
281
 
 
282
ReadRegStr $R0 HKCR ".pdb" ""
 
283
StrCmp $R0  "RasWin.Document" 0 +2
 
284
  DeleteRegKey HKCR ".pdb"
 
285
 
 
286
ReadRegStr $R0 HKCR ".ent" ""
 
287
StrCmp $R0  "RasWin.Document" 0 +2
 
288
  DeleteRegKey HKCR ".ent"
 
289
 
 
290
ReadRegStr $R0 HKCR ".cif" ""
 
291
StrCmp $R0  "RasWin.Document" 0 +2
 
292
  DeleteRegKey HKCR ".cif"
 
293
 
 
294
ReadRegStr $R0 HKCR ".scr" ""
 
295
StrCmp $R0  "RasWin.Script" 0 +2
 
296
  DeleteRegKey HKCR ".scr"
 
297
 
 
298
ReadRegStr $R0 HKCR ".spt" ""
 
299
StrCmp $R0  "RasWin.Script" 0 +2
 
300
  DeleteRegKey HKCR ".spt"
 
301
 
 
302
ReadRegStr $R0 HKCR ".rsm" ""
 
303
StrCmp $R0  "RasWin.Script" 0 +2
 
304
  DeleteRegKey HKCR ".rsm"
 
305
 
 
306
ReadRegStr $R0 HKCR ".rsml" ""
 
307
StrCmp $R0  "RasWin.Script" 0 +2
 
308
  DeleteRegKey HKCR ".rsml"
 
309
 
 
310
ReadRegStr $R0 HKCR ".ras" ""
 
311
StrCmp $R0  "RasWin.Script" 0 +2
 
312
  DeleteRegKey HKCR ".ras"
 
313
 
 
314
 
 
315
Push         "RASMOLPATH"
 
316
Call         un.DeleteEnvStr
 
317
 
 
318
SectionEnd
 
319
 
 
320
 
 
321
 
 
322
; >>> Uninstaller Functions
 
323
 
 
324
Function un.onInit
 
325
!insertmacro MUI_UNGETLANGUAGE
 
326
FunctionEnd
 
327
 
 
328
Function un.onUninstSuccess
 
329
MessageBox MB_OK "You have successfully uninstalled RasWin."
 
330
FunctionEnd
 
331
 
 
332
; >>> Environment Variables Functions
 
333
 
 
334
!define ALL_USERS
 
335
#
 
336
#  The following functions are from
 
337
#
 
338
#  http://nsis.sourceforge.net/Setting_Environment_Variables
 
339
#
 
340
!include WinMessages.nsh
 
341
 
 
342
!ifndef WriteEnvStr_RegKey
 
343
  !ifdef ALL_USERS
 
344
    !define WriteEnvStr_RegKey \
 
345
       'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
 
346
  !else
 
347
    !define WriteEnvStr_RegKey 'HKCU "Environment"'
 
348
  !endif
 
349
!endif
 
350
# WriteEnvStr - Writes an environment variable
 
351
# Note: Win9x systems requires reboot
 
352
#
 
353
# Example:
 
354
#  Push "HOMEDIR"           # name
 
355
#  Push "C:\New Home Dir\"  # value
 
356
#  Call WriteEnvStr
 
357
#
 
358
Function WriteEnvStr
 
359
  Exch $1 ; $1 has environment variable value
 
360
  Exch
 
361
  Exch $0 ; $0 has environment variable name
 
362
  Push $2
 
363
 
 
364
  Call IsNT
 
365
  Pop $2
 
366
  StrCmp $2 1 WriteEnvStr_NT
 
367
    ; Not on NT
 
368
    StrCpy $2 $WINDIR 2 ; Copy drive of windows (c:)
 
369
    FileOpen $2 "$2\autoexec.bat" a
 
370
    FileSeek $2 0 END
 
371
    FileWrite $2 "$\r$\nSET $0=$1$\r$\n"
 
372
    FileClose $2
 
373
    SetRebootFlag true
 
374
    Goto WriteEnvStr_done
 
375
 
 
376
  WriteEnvStr_NT:
 
377
      WriteRegExpandStr ${WriteEnvStr_RegKey} $0 $1
 
378
      SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} \
 
379
        0 "STR:Environment" /TIMEOUT=5000
 
380
 
 
381
  WriteEnvStr_done:
 
382
    Pop $2
 
383
    Pop $0
 
384
    Pop $1
 
385
FunctionEnd
 
386
 
 
387
#
 
388
# un.DeleteEnvStr - Removes an environment variable
 
389
# Note: Win9x systems requires reboot
 
390
#
 
391
# Example:
 
392
#  Push "HOMEDIR"           # name
 
393
#  Call un.DeleteEnvStr
 
394
#
 
395
Function un.DeleteEnvStr
 
396
  Exch $0 ; $0 now has the name of the variable
 
397
  Push $1
 
398
  Push $2
 
399
  Push $3
 
400
  Push $4
 
401
  Push $5
 
402
 
 
403
  Call un.IsNT
 
404
  Pop $1
 
405
  StrCmp $1 1 DeleteEnvStr_NT
 
406
    ; Not on NT
 
407
    StrCpy $1 $WINDIR 2
 
408
    FileOpen $1 "$1\autoexec.bat" r
 
409
    GetTempFileName $4
 
410
    FileOpen $2 $4 w
 
411
    StrCpy $0 "SET $0="
 
412
    SetRebootFlag true
 
413
 
 
414
    DeleteEnvStr_dosLoop:
 
415
      FileRead $1 $3
 
416
      StrLen $5 $0
 
417
      StrCpy $5 $3 $5
 
418
      StrCmp $5 $0 DeleteEnvStr_dosLoop
 
419
      StrCmp $5 "" DeleteEnvStr_dosLoopEnd
 
420
      FileWrite $2 $3
 
421
      Goto DeleteEnvStr_dosLoop
 
422
 
 
423
    DeleteEnvStr_dosLoopEnd:
 
424
      FileClose $2
 
425
      FileClose $1
 
426
      StrCpy $1 $WINDIR 2
 
427
      Delete "$1\autoexec.bat"
 
428
      CopyFiles /SILENT $4 "$1\autoexec.bat"
 
429
      Delete $4
 
430
      Goto DeleteEnvStr_done
 
431
 
 
432
  DeleteEnvStr_NT:
 
433
    DeleteRegValue ${WriteEnvStr_RegKey} $0
 
434
    SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} \
 
435
      0 "STR:Environment" /TIMEOUT=5000
 
436
 
 
437
  DeleteEnvStr_done:
 
438
    Pop $5
 
439
    Pop $4
 
440
    Pop $3
 
441
    Pop $2
 
442
    Pop $1
 
443
    Pop $0
 
444
FunctionEnd
 
445
 
 
446
!ifndef IsNT_KiCHiK
 
447
!define IsNT_KiCHiK
 
448
 
 
449
#
 
450
# [un.]IsNT - Pushes 1 if running on NT, 0 if not
 
451
#
 
452
# Example:
 
453
#   Call IsNT
 
454
#   Pop $0
 
455
#   StrCmp $0 1 +3
 
456
#     MessageBox MB_OK "Not running on NT!"
 
457
#     Goto +2
 
458
#     MessageBox MB_OK "Running on NT!"
 
459
#
 
460
!macro IsNT UN
 
461
Function ${UN}IsNT
 
462
  Push $0
 
463
  ReadRegStr $0 HKLM \
 
464
    "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
 
465
  StrCmp $0 "" 0 IsNT_yes
 
466
  ; we are not NT.
 
467
  Pop $0
 
468
  Push 0
 
469
  Return
 
470
 
 
471
  IsNT_yes:
 
472
    ; NT!!!
 
473
    Pop $0
 
474
    Push 1
 
475
FunctionEnd
 
476
!macroend
 
477
!insertmacro IsNT ""
 
478
!insertmacro IsNT "un."
 
479
 
 
480
!endif ; IsNT_KiCHiK
 
481
 
 
482