1 |
; example2.nsi |
2 |
; |
3 |
; This script is based on example1.nsi, but it remembers the directory, |
4 |
; has uninstall support and (optionally) installs start menu shortcuts. |
5 |
; |
6 |
; It will install example2.nsi into a directory that the user selects, |
7 |
|
8 |
;-------------------------------- |
9 |
|
10 |
; The name of the installer |
11 |
Name "ASCEND" |
12 |
|
13 |
; The file to write |
14 |
!ifdef OUTFILE |
15 |
OutFile ${OUTFILE}.exe |
16 |
!else |
17 |
OutFile ascend-setup.exe |
18 |
!endif |
19 |
|
20 |
|
21 |
SetCompressor /SOLID lzma |
22 |
|
23 |
; The default installation directory |
24 |
InstallDir $PROGRAMFILES\ASCEND |
25 |
|
26 |
; Registry key to check for directory (so if you install again, it will |
27 |
; overwrite the old one automatically) |
28 |
InstallDirRegKey HKLM "Software\ASCEND" "Install_Dir" |
29 |
|
30 |
;-------------------------------- |
31 |
|
32 |
; Pages |
33 |
|
34 |
Page components |
35 |
Page directory |
36 |
Page instfiles |
37 |
|
38 |
UninstPage uninstConfirm |
39 |
UninstPage instfiles |
40 |
|
41 |
;-------------------------------- |
42 |
|
43 |
; The stuff to install |
44 |
Section "ASCEND (required)" |
45 |
|
46 |
SectionIn RO |
47 |
|
48 |
; Set output path to the installation directory. |
49 |
SetOutPath $INSTDIR |
50 |
|
51 |
; Python interface |
52 |
File "_ascpy.dll" |
53 |
File "..\ascend.dll" |
54 |
File "config.py" |
55 |
File "*.py" |
56 |
SetOutPath $INSTDIR\glade |
57 |
File "glade\*.glade" |
58 |
File "glade\*.png" |
59 |
|
60 |
; Model Library |
61 |
SetOutPath $INSTDIR\models |
62 |
File /r /x .svn "..\models\*.a4*" |
63 |
File /r /x .svn "..\models\*.bz2" |
64 |
File /r /x .svn "..\models\*.tcl" |
65 |
File /r /x .svn "..\models\*.dll" ; extension modules |
66 |
|
67 |
; Tcl/Tk interface |
68 |
SetOutPath $INSTDIR\tcltk |
69 |
File /r /x .svn "..\tcltk\TK\*" |
70 |
SetOutPath $INSTDIR |
71 |
File "..\tcltk\generic\interface\ascendtcl.dll" |
72 |
File "..\tcltk\generic\interface\ascend4.exe" |
73 |
|
74 |
SetOutPath $INSTDIR |
75 |
File "Makefile.bt" |
76 |
File "ascend.syn" |
77 |
|
78 |
; Set 'librarypath' in .ascend.ini |
79 |
WriteINIstr $APPDATA\.ascend.ini Directories librarypath "$DOCUMENTS\ascdata;$INSTDIR\models" |
80 |
|
81 |
; Create 'ascend.bat' launcher for PyGTK interface |
82 |
ClearErrors |
83 |
FileOpen $0 $INSTDIR\ascend.bat w |
84 |
IfErrors done |
85 |
FileWrite $0 "@echo off" |
86 |
FileWriteByte $0 "13" |
87 |
FileWriteByte $0 "10" |
88 |
FileWrite $0 "set PATH=c:\Python24;c:\GTK\bin" |
89 |
FileWriteByte $0 "13" |
90 |
FileWriteByte $0 "10" |
91 |
FileWrite $0 "cd " |
92 |
FileWrite $0 $INSTDIR |
93 |
FileWriteByte $0 "13" |
94 |
FileWriteByte $0 "10" |
95 |
FileWrite $0 "c:\Python24\python gtkbrowser.py %1 %2 %3 %4 %5 %6 %7 %8" |
96 |
FileWriteByte $0 "13" |
97 |
FileWriteByte $0 "10" |
98 |
|
99 |
FileClose $0 |
100 |
done: |
101 |
|
102 |
; Write the installation path into the registry |
103 |
WriteRegStr HKLM SOFTWARE\ASCEND "Install_Dir" "$INSTDIR" |
104 |
|
105 |
; Write the uninstall keys for Windows |
106 |
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ASCEND" "DisplayName" "ASCEND Simulation Environment" |
107 |
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ASCEND" "UninstallString" '"$INSTDIR\uninstall.exe"' |
108 |
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ASCEND" "NoModify" 1 |
109 |
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ASCEND" "NoRepair" 1 |
110 |
WriteUninstaller "uninstall.exe" |
111 |
|
112 |
SectionEnd |
113 |
|
114 |
; Optional section (can be disabled by the user) |
115 |
Section "Start Menu Shortcuts" |
116 |
|
117 |
CreateDirectory "$SMPROGRAMS\ASCEND" |
118 |
CreateShortCut "$SMPROGRAMS\ASCEND\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0 |
119 |
CreateShortCut "$SMPROGRAMS\ASCEND\ASCEND.lnk" "$INSTDIR\ascend.bat" "" "$INSTDIR\ascend.bat" 0 |
120 |
CreateShortCut "$SMPROGRAMS\ASCEND\ASCEND Tcl/Tk.lnk" "$INSTDIR\ascend4.exe" "" "$INSTDIR\ascend4.exe" 0 |
121 |
|
122 |
SectionEnd |
123 |
|
124 |
;-------------------------------- |
125 |
|
126 |
; Uninstaller |
127 |
|
128 |
Section "Uninstall" |
129 |
|
130 |
; Remove registry keys |
131 |
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ASCEND" |
132 |
DeleteRegKey HKLM SOFTWARE\ASCEND |
133 |
|
134 |
; Remove files and uninstaller |
135 |
Delete $INSTDIR\_ascpy.dll |
136 |
Delete $INSTDIR\ascendtcl.dll |
137 |
Delete $INSTDIR\ascend.dll |
138 |
Delete $INSTDIR\ascend.bat |
139 |
Delete $INSTDIR\*.py |
140 |
Delete $INSTDIR\glade\* |
141 |
Delete $INSTDIR\Makefile.bt |
142 |
Delete $INSTDIR\ascend.syn |
143 |
Delete $INSTDIR\models\* |
144 |
Delete $INSTDIR\models\johnpye\* |
145 |
RMDir /r $INSTDIR\tcltk |
146 |
RMDir $INSTDIR\models\johnpye |
147 |
RMDIR $INSTDIR\models |
148 |
|
149 |
; Remove shortcuts, if any |
150 |
Delete "$SMPROGRAMS\ASCEND\*.*" |
151 |
|
152 |
; Remove directories used |
153 |
RMDir "$SMPROGRAMS\ASCEND" |
154 |
RMDir "$INSTDIR" |
155 |
|
156 |
SectionEnd |