-
Notifications
You must be signed in to change notification settings - Fork 69
/
fmbt.nsis.in
312 lines (249 loc) · 10.9 KB
/
fmbt.nsis.in
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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
# This file is based on example:
# http://nsis.sourceforge.net/A_simple_installer_with_start_menu_shortcut_and_uninstaller
!define APPNAME "fMBT"
!define COMPANYNAME "Intel"
!define DESCRIPTION "free Model-Based Testing tool @FMBT_VERSION@@FMBTBUILDINFO@"
# These three must be integers
!define VERSIONMAJOR 0
!define VERSIONMINOR 43
!define VERSIONBUILD 0
# These will be displayed by the "Click here for support information"
# link in "Add/Remove Programs" It is possible to use "mailto:" links
# in here to open the email client
!define HELPURL "https://01.org/fmbt" # "Support Information" link
!define UPDATEURL "https://01.org/fmbt/downloads" # "Product Updates" link
!define ABOUTURL "https://01.org/fmbt/about" # "Publisher" link
# This is the size (in kB) of all the files copied into
# "Program Files"
!define INSTALLSIZE 87233
Var PYTHONDIR
Var GRAPHVIZDIR
Var GNUPLOTDIR
RequestExecutionLevel admin ;Require admin rights on NT6+ (When UAC is turned on)
InstallDir "$PROGRAMFILES@PROGRAMFILES_SUFFIX@\${APPNAME}"
# rtf or txt file - remember if it is txt, it must be in the DOS text format (\r\n)
LicenseData "license.rtf"
# This will be in the installer/uninstaller's title bar
Name "${COMPANYNAME} - ${APPNAME}"
Icon "fmbt.ico"
outFile "fMBT-installer-@[email protected]"
!include LogicLib.nsh
!define addToPath "!insertmacro addToPath"
!macro addToPath DIRECTORY
# Appends DIRECTORY to the PATH in the registry (HKLM\SYSTEM\...\Environment)
ExecWait '"$PYTHONDIR\python.exe" -c "import _winreg as r,sys,ctypes;d=sys.argv[1];k=r.OpenKey(r.HKEY_LOCAL_MACHINE,r\"SYSTEM\CurrentControlSet\Control\Session Manager\Environment\",0,r.KEY_ALL_ACCESS);v,_=r.QueryValueEx(k,\"PATH\");(r.SetValueEx(k,\"PATH\",0,r.REG_EXPAND_SZ,d+\";\"+v),r.CloseKey(k),ctypes.windll.user32.SendMessageW(0xffff,0x001a,0,u\"Environment\")) if not d in v.split(\";\") else 0" "${DIRECTORY}"'
!macroend
# Just three pages - license agreement, install location, and installation
page license
page directory
Page instfiles
Section -Prerequisites
StrCpy $PYTHONDIR "C:\Python27"
StrCpy $GRAPHVIZDIR "$PROGRAMFILES\Graphviz2.38\bin"
StrCpy $GNUPLOTDIR "$PROGRAMFILES\gnuplot\bin"
SetOutPath $INSTDIR\Prerequisites
MessageBox MB_YESNO "Install Python 2.7.11?" /SD IDYES IDNO endPython
SetCompress off
file "python-2.7.11@[email protected]"
ExecWait '"msiexec" /i "$INSTDIR\Prerequisites\python-2.7.11@[email protected]"'
endPython:
MessageBox MB_YESNO "Install PySide?" /SD IDYES IDNO endPySide
SetCompress off
File "PySide-1.2.2.win@[email protected]"
ExecWait "$INSTDIR\Prerequisites\PySide-1.2.2.win@[email protected]"
endPySide:
MessageBox MB_YESNO "Install Graphviz 2.38?" /SD IDYES IDNO endGraphviz
SetCompress off
file "graphviz-2.38.msi"
ExecWait '"msiexec" /i "$INSTDIR\Prerequisites\graphviz-2.38.msi"'
endGraphviz:
MessageBox MB_YESNO "Install GNUPlot 4.66?" /SD IDYES IDNO endGNUplot
SetCompress off
file "gp466-win32-setup.exe"
ExecWait "$INSTDIR\Prerequisites\gp466-@[email protected]"
endGNUplot:
MessageBox MB_YESNO "Install Tesseract 3.02.02?" /SD IDYES IDNO endtesseract
SetCompress off
file "tesseract-ocr-setup-3.02.02.exe"
ExecWait "$INSTDIR\Prerequisites\tesseract-ocr-setup-3.02.02.exe"
endtesseract:
SectionEnd
!macro VerifyUserIsAdmin
UserInfo::GetAccountType
pop $0
${If} $0 != "admin" ;Require admin rights on NT4+
messageBox mb_iconstop "Administrator rights required!"
setErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
quit
${EndIf}
!macroend
function .onInit
setShellVarContext all
!insertmacro VerifyUserIsAdmin
functionEnd
section "install"
# Files for the install directory - to build the installer, these should be in the same directory as the install script (this file)
setOutPath $INSTDIR
# Files added here should be removed by the uninstaller (see section "uninstall")
SetCompress force
file "src/.libs/fmbt-aalc.exe"
file "src/.libs/fmbt-aalp.exe"
file "src/.libs/fmbt.exe"
# I don't know any sane method to handle dependencies. So hard-code.
file "@bindir@/gspawn-@[email protected]"
file /oname=gspawn-@[email protected] "@bindir@/gspawn-@[email protected]"
file /oname=IMconvert.exe "convert.exe"
file "@bindir@/iconv.dll"
file "@bindir@/libMagick++-6.Q16*.dll"
file "@bindir@/libMagickCore-6.Q16*.dll"
file "@bindir@/libMagickWand-6.Q16*.dll"
file "@bindir@/libboost_regex.dll"
file "@bindir@/libbz2-1.dll"
file "@bindir@/libgcc_s*.dll"
file "@bindir@/libglib-2.0-0.dll"
file "@bindir@/libintl-8.dll"
file "@bindir@/libpng16-16.dll"
file "@bindir@/libstdc++-6.dll"
file "@bindir@/libstdc++-6.dll"
file "@bindir@/libwinpthread-1.dll"
file "@bindir@/libxml2-2.dll"
file "@bindir@/zlib1.dll"
file "utils/.libs/eye4graphics.dll"
# parts implemented in python
file "utils/remote_pyaal"
file ".libs/remote_pyaal.exe"
file "utils/fmbt-view"
file ".libs/fmbt-view.exe"
file "utils/fmbt-scripter"
file ".libs/fmbt-scripter.exe"
file "utils/fmbt-editor"
file ".libs/fmbt-editor.exe"
file "utils/fmbt-stats"
file ".libs/fmbt-stats.exe"
file "utils/lsts2dot"
file ".libs/lsts2dot.exe"
file "utils/fmbt-log"
file ".libs/fmbt-log.exe"
file "utils/fmbt-debug"
file ".libs/fmbt-debug.exe"
file "utils/fmbt-trace-share"
file ".libs/fmbt-trace-share.exe"
file "fmbt.ico"
# python libraries.
setOutPath "$PYTHONDIR\lib\"
file "utils/aalmodel.py"
file "utils/eyenfinger.py"
file "utils/fmbtandroid.py"
file "utils/fmbtchromiumos.py"
file "utils/fmbt_config.py"
file "utils/fmbtgti.py"
file "utils/fmbtlogger.py"
file "utils/fmbtpng.py"
file "utils/fmbt.py"
file "utils/fmbttizen-agent.py"
file "utils/fmbttizen.py"
file "utils/fmbtuinput.py"
file "utils/fmbtvnc.py"
file "utils/fmbtweb.py"
file "utils/fmbtwindows_agent.py"
file "utils/fmbtwindows.py"
file "utils/fmbtx11_conn.py"
file "utils/fmbtx11.py"
file "utils/lsts.py"
file "utils/pycosh.py"
setOutPath "$PYTHONDIR\Lib\pythonshare\"
file "pythonshare/__init__.py"
file "pythonshare/client.py"
file "pythonshare/messages.py"
file "pythonshare/server.py"
setOutPath "$PYTHONDIR\Scripts\"
file "pythonshare/pythonshare-client"
file "pythonshare/pythonshare-server"
# Add any other files for the install directory (license files, app data, etc) here
# Uninstaller - See function un.onInit and section "uninstall" for configuration
writeUninstaller "$INSTDIR\uninstall.exe"
# Start Menu
createDirectory "$SMPROGRAMS\${COMPANYNAME}"
createShortCut "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}.lnk" "$INSTDIR\fmbt-editor.exe" "" "$INSTDIR\fmbt.ico"
# Registry information for add/remove programs
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayName" "${COMPANYNAME} - ${APPNAME} - ${DESCRIPTION}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "InstallLocation" "$\"$INSTDIR$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayIcon" "$\"$INSTDIR\fmbt.ico$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "Publisher" "$\"${COMPANYNAME}$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "HelpLink" "$\"${HELPURL}$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "URLUpdateInfo" "$\"${UPDATEURL}$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "URLInfoAbout" "$\"${ABOUTURL}$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayVersion" "$\"${VERSIONMAJOR}.${VERSIONMINOR}.${VERSIONBUILD}$\""
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "VersionMajor" ${VERSIONMAJOR}
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "VersionMinor" ${VERSIONMINOR}
# There is no option for modifying or repairing the install
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "NoRepair" 1
# Set the INSTALLSIZE constant (!defined at the top of this script) so Add/Remove Programs can accurately report the size
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "EstimatedSize" ${INSTALLSIZE}
# PATH
MessageBox MB_YESNO "Add following directories to PATH?$\r$\n- $INSTDIR$\r$\n- $PYTHONDIR$\r$\n- $GRAPHVIZDIR$\r$\n- $GNUPLOTDIR" /SD IDYES IDNO skip_addpath
${addToPath} "$PYTHONDIR"
${addToPath} "$GRAPHVIZDIR"
${addToPath} "$GNUPLOTDIR"
${addToPath} "$INSTDIR"
skip_addpath:
sectionEnd
# Uninstaller
function un.onInit
SetShellVarContext all
#Verify the uninstaller - last chance to back out
MessageBox MB_OKCANCEL "Permanantly remove ${APPNAME}?" IDOK next
Abort
next:
!insertmacro VerifyUserIsAdmin
functionEnd
section "uninstall"
# Remove Start Menu launcher
delete "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}.lnk"
# Try to remove the Start Menu folder - this will only happen if it is empty
rmDir "$SMPROGRAMS\${COMPANYNAME}"
# Remove files
delete $INSTDIR\fmbt-aalc.exe
delete $INSTDIR\fmbt-aalp.exe
delete $INSTDIR\fmbt.exe
delete $INSTDIR\gspawn-win32-helper-console.exe
delete $INSTDIR\gspawn-win32-helper.exe
delete $INSTDIR\fmbt.ico
delete $INSTDIR\aalmodel.py
delete $INSTDIR\eyenfinger.py
delete $INSTDIR\fmbtandroid.py
delete $INSTDIR\fmbt_config.py
delete $INSTDIR\fmbtgti.py
delete $INSTDIR\fmbtlogger.py
delete $INSTDIR\fmbt.py
delete $INSTDIR\fmbttizen.py
delete $INSTDIR\fmbtweb.py
delete $INSTDIR\fmbtx11.py
delete $INSTDIR\lsts.py
delete $INSTDIR\pycosh.py
delete $INSTDIR\fmbt-editor
delete $INSTDIR\fmbt-editor.exe
delete $INSTDIR\eye4graphics.dll
delete $INSTDIR\libMagickCore-6.Q16*.dll
delete $INSTDIR\remote_pyaal
delete $INSTDIR\remote_pyaal.exe
delete $INSTDIR\fmbt-view
delete $INSTDIR\fmbt-view.exe
delete $INSTDIR\fmbt-scripter
delete $INSTDIR\fmbt-scripter.exe
delete $INSTDIR\fmbt-log
delete $INSTDIR\fmbt-log.exe
delete $INSTDIR\fmbt-debug
delete $INSTDIR\fmbt-debug.exe
delete $INSTDIR\fmbt-trace-share
delete $INSTDIR\fmbt-trace-share.exe
# Always delete uninstaller as the last action
delete $INSTDIR\uninstall.exe
# Try to remove the install directory - this will only happen if it is empty
rmDir $INSTDIR
# Remove uninstaller information from the registry
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}"
sectionEnd