This repository has been archived by the owner on Dec 8, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
OpenMS_installer.nsi
855 lines (680 loc) · 32.4 KB
/
OpenMS_installer.nsi
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
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
Name "OpenMS"
############################################
## see README before running this script! ##
############################################
## useful resources:
# http://abarinoff-dev.blogspot.com/2010/04/passing-parameters-and-retrieving.html
# http://nsis.sourceforge.net/UAC_plug-in
# http://nsis.sourceforge.net/Inetc_plug-in
#
## using the UAC-plugin the installer is run in elevated mode my default (inner instance). If you want to
## do some user specific action (e.g. Start-Menu entries) you need to use the UAC's wrappers and calls
##################
### config ###
##################
### edit the below files to suit your system
# - Cfg_Version.nsh
# - Cfg_Settings.nsh
# set to "0" for deployment!!! use "1" to build the executable fast (for script debugging)
!define DEBUG_BUILD 0
# set to "0" for deployment!!! use "1" to skip packaging of *.html files (takes ages)
!define DEBUG_SKIP_DOCU 0
# marks a section as off. Already defined in an include
##!define SECTION_OFF 0xFFFFFFFE
##################
### SCRIPT ###
##################
# contains the OpenMS version
!ifndef VERSION
!include Cfg_Version.nsh
!endif
# set OpenMS paths and other stuff (if not already set by parent script)
!ifndef VS_REDISTRIBUTABLE_EXE
!include Cfg_Settings.nsh
!endif
!ifndef PLATFORM
!define PLATFORM 32
!endif
# pwiz needs alternative VS runtime libraries (32bit for Agilent libraries)
!define VS_PWIZ_REDISTRIBUTABLE_EXE "vcredist2010_x86_sp1.exe"
# additional pwiz redistributables
!if ${PLATFORM} == 32
!define VS_PWIZ_ADD1_REDISTRIBUTABLE_EXE "vcredist2012_x86_upd4.exe"
!define VS_PWIZ_ADD2_REDISTRIBUTABLE_EXE "vcredist2013_x86_upd2.exe"
!else
!define VS_PWIZ_ADD1_REDISTRIBUTABLE_EXE "vcredist2012_x64_upd4.exe"
!define VS_PWIZ_ADD2_REDISTRIBUTABLE_EXE "vcredist2013_x64_upd2.exe"
!endif
!ifndef THIRDPARTYDIR
!warning "Variable THIRDPARTYDIR not set. Will deactivate installation of Thirdparty binaries."
## TODO SetSectionFlag not defined??
##!insertmacro SetSectionFlag ${SEC_ThirdParty} ${SECTION_OFF}
!endif
# which extensions to connect to TOPPView and TOPPAS
!macro OpenMSGUIExtensions _action
!insertmacro ${_action} ".mzData" "TOPPView"
!insertmacro ${_action} ".mzXML" "TOPPView"
!insertmacro ${_action} ".mzML" "TOPPView"
!insertmacro ${_action} ".dta" "TOPPView"
!insertmacro ${_action} ".dta2D" "TOPPView"
!insertmacro ${_action} ".cdf" "TOPPView"
!insertmacro ${_action} ".idXML" "TOPPView"
!insertmacro ${_action} ".featureXML" "TOPPView"
!insertmacro ${_action} ".consensusXML" "TOPPView"
!insertmacro ${_action} ".toppas" "TOPPAS"
!macroend
# Defines
!define REGKEY "SOFTWARE\$(^Name)"
!define COMPANY "OpenMS Developer Team"
!define URL http://www.OpenMS.de
!define APPNAME "OpenMS"
## UAC plugin requires us to use normal user privileges
##, it will launch an admin process within the user process automatically
RequestExecutionLevel user /* RequestExecutionLevel REQUIRED! */
# Included files
# MUI2 somehow crashes with NSIS3.0 release/stable. Switched to UMUI that seems better supported and has legacy option.
#!include MUI2.nsh
!include MUIEx.nsh
!include Sections.nsh
!include Library.nsh
!include FileFunc.nsh
!include UAC.nsh
#!define ALL_USERS
!include IncludeScript_Misc.nsh
!include IncludeScript_FileLogging.nsh
!include EnvVarUpdate.nsh
!include x64.nsh
!include LogicLib.nsh
# Reserved Files
!insertmacro MUI_RESERVEFILE_LANGDLL
# Modify the next line to adapt to the plugin for other NSIS versions (currently 3.0 release)
# e.g. NSIS 2.x does not have the subfolders x86-unicode or x86-ansi, so remove them.
ReserveFile "${NSISDIR}\Plugins\x86-unicode\advsplash.dll"
;--------------------------------
;Interface Configuration
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP ".\images\header.bmp" ; optional
!define MUI_HEADERIMAGE_UNBITMAP ".\images\header-uninstall.bmp" ; optional
!define MUI_HEADERIMAGE_RIGHT
!define MUI_ABORTWARNING
!define MUI_WELCOMEFINISHPAGE_BITMAP ".\images\wizard.bmp" ; optional
!define MUI_UNWELCOMEFINISHPAGE_BITMAP ".\images\wizard-uninstall.bmp" ; optional
!insertmacro RefreshShellIcons
!insertmacro un.RefreshShellIcons
!insertmacro DirState
!insertmacro GetFileName
# Variables
Var StartMenuGroup
# MUI defines
#!define MUI_ICON OpenMS.ico
!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_STARTMENUPAGE_REGISTRY_ROOT HKLM
!define MUI_STARTMENUPAGE_REGISTRY_KEY ${REGKEY}
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME StartMenuGroup
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "OpenMS"
!define MUI_LICENSEPAGE_RADIOBUTTONS
!define MUI_FINISHPAGE_SHOWREADME $INSTDIR\ReleaseNotes.txt
!define MUI_UNFINISHPAGE_NOAUTOCLOSE
!define MUI_LANGDLL_REGISTRY_ROOT HKLM
!define MUI_LANGDLL_REGISTRY_KEY ${REGKEY}
!define MUI_LANGDLL_REGISTRY_VALUENAME InstallerLanguage
# Installer pages
!insertmacro MUI_PAGE_WELCOME
!define MUI_PAGE_CUSTOMFUNCTION_SHOW licpageshow
!insertmacro MUI_PAGE_LICENSE ${OPENMSDIRSRC}\License.txt
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuGroup
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
#!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
# Installer languages
!insertmacro MUI_LANGUAGE German
!insertmacro MUI_LANGUAGE English
!insertmacro MUI_LANGUAGE French
# Installer Language Strings
LangString ^UninstallLink ${LANG_GERMAN} "Uninstall $(^Name)"
LangString ^UninstallLink ${LANG_ENGLISH} "Uninstall $(^Name)"
LangString ^UninstallLink ${LANG_FRENCH} "Uninstall $(^Name)"
# Custom MUI Function to set font of license display page
# to a mono spaced one.
# from http://stackoverflow.com/questions/8424172/nsis-display-license-with-a-monospace-font
Function licpageshow
FindWindow $0 "#32770" "" $HWNDPARENT
CreateFont $1 "Consolas" "8"
GetDlgItem $0 $0 1000
SendMessage $0 ${WM_SETFONT} $1 1
FunctionEnd
# predefined installation modes
InstType "Recommended" #1
InstType "Minimum" #2
InstType "Full" #3
# Installer attributes
!if ${PLATFORM} == 32
OutFile OpenMS-${VERSION}_Win32_setup.exe
InstallDir "$PROGRAMFILES32\OpenMS-${VERSION}"
!else
OutFile OpenMS-${VERSION}_Win64_setup.exe
InstallDir "$PROGRAMFILES64\OpenMS-${VERSION}"
!endif
CRCCheck on
XPStyle on
ShowInstDetails hide
VIProductVersion ${VERSION_LONG}
VIAddVersionKey /LANG=${LANG_GERMAN} ProductName "OpenMS"
VIAddVersionKey /LANG=${LANG_GERMAN} ProductVersion "${VERSION}"
VIAddVersionKey /LANG=${LANG_GERMAN} CompanyName "${COMPANY}"
VIAddVersionKey /LANG=${LANG_GERMAN} CompanyWebsite "${URL}"
VIAddVersionKey /LANG=${LANG_GERMAN} FileVersion "${VERSION}"
VIAddVersionKey /LANG=${LANG_GERMAN} FileDescription ""
VIAddVersionKey /LANG=${LANG_GERMAN} LegalCopyright ""
InstallDirRegKey HKLM "${REGKEY}" Path
ShowUninstDetails hide
; HKLM (all users) vs HKCU (current user) defines
!define env_hklm 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
!define env_hkcu 'HKCU "Environment"'
!macro CREATE_SMGROUP_SHORTCUT NAME PATH
Push "${NAME}"
Push "${PATH}"
Call CreateSMGroupShortcut
!macroend
Function CreateSMGroupShortcut
Exch $R0 ;PATH
Exch
Exch $R1 ;NAME
Push $R2
StrCpy $R2 $StartMenuGroup 1
StrCmp $R2 ">" no_smgroup
SetOutPath $SMPROGRAMS\$StartMenuGroup
StrCpy $OUTDIR "$INSTDIR" # execute link target in $OUTDIR
CreateDirectory "$SMPROGRAMS\${APPNAME}"
CreateShortcut "$SMPROGRAMS\${APPNAME}\$R1.lnk" $R0
## TODO (currently the start menu entry is in admin space)
#UAC::StackPush "$SMPROGRAMS\$StartMenuGroup\$R1.lnk"
#UAC::StackPush $R0
#GetFunctionAddress $1 CreateShortcut
#UAC::ExecCodeSegment $1
no_smgroup:
Pop $R2
Pop $R1
Pop $R0
FunctionEnd
; Section "-hidden TESTING"
; System::Alloc 32
; Pop $1
; System::Call "Kernel32::GlobalMemoryStatus(i) v (r1)"
; System::Call "*$1(&i4 .r2, &i4 .r3, &i4 .r4, &i4 .r5, \
; &i4 .r6, &i4.r7, &i4 .r8, &i4 .r9)"
; System::Free $1
; DetailPrint "Structure size (useless): $2 Bytes"
; DetailPrint "Memory load: $3%"
; DetailPrint "Total physical memory: $4 Bytes"
; ## do something with that!!
; DetailPrint "Free physical memory: $5 Bytes"
; DetailPrint "Total page file: $6 Bytes"
; DetailPrint "Free page file: $7 Bytes"
; DetailPrint "Total virtual: $8 Bytes"
; DetailPrint "Free virtual: $9 Bytes"
; SectionEnd
# Installer sections
Section "OpenMS Library" SEC_Lib
SectionIn 1 2 3 RO
# we need to install add dll´s together with the binaries
# to ensure the dynamic linking uses the correct dll´s
# (putting dll´s in another path makes it prone to
# invalid PATH settings)
SetOutPath $INSTDIR\bin
SetOverwrite on
# open log file
!insertmacro OpenUninstallLog
# install file (with logging)
!insertmacro InstallFile "${CONTRIBDIR}\lib\xerces-c_3_1.dll"
!insertmacro InstallFile "${CONTRIBDIR}\lib\sqlite3.dll"
!insertmacro InstallFile "${OPENMSDIR}\bin\Release\OpenMS.dll"
!insertmacro InstallFile "${OPENMSDIR}\bin\Release\OpenMS_GUI.dll"
!insertmacro InstallFile "${OPENMSDIR}\bin\Release\OpenSwathAlgo.dll"
!insertmacro InstallFile "${OPENMSDIR}\bin\Release\SuperHirn.dll"
!if ${DEBUG_BUILD} == 0
!insertmacro InstallFile "${QTLIBDIR}\QtCore4.dll"
!insertmacro InstallFile "${QTLIBDIR}\QtGui4.dll"
!insertmacro InstallFile "${QTLIBDIR}\QtNetwork4.dll"
!insertmacro InstallFile "${QTLIBDIR}\QtOpenGL4.dll"
!insertmacro InstallFile "${QTLIBDIR}\QtSql4.dll"
!insertmacro InstallFile "${QTLIBDIR}\QtSvg4.dll"
!insertmacro InstallFile "${QTLIBDIR}\QtWebKit4.dll"
!insertmacro InstallFile "${QTLIBDIR}\phonon4.dll" ## WebKit4 depends on it
!endif
SetOutPath $INSTDIR\share
SetOverwrite on
!if ${DEBUG_BUILD} == 0
!insertmacro InstallFolder "${OPENMSDIRSRC}\share\*.*" ".svn\"
!endif
# icon for *files* associated with TOPPView
!insertmacro InstallFile "OpenMS_TOPPView.ico"
!insertmacro InstallFile "OpenMS_TOPPAS.ico"
!insertmacro CloseUninstallLog
SectionEnd
Section "TOPP tools" SEC_TOPP
SectionIn 1 2 3 RO
#open log file
!insertmacro OpenUninstallLog
SetOutPath $INSTDIR\bin
SetOverwrite on
!if ${DEBUG_BUILD} == 0
!insertmacro InstallFile "${OPENMSDIR}\bin\Release\*.exe"
!endif
!insertmacro CloseUninstallLog
SectionEnd
Section "Documentation" SEC_Doc
SectionIn 1 3
#open log file
!insertmacro OpenUninstallLog
SetOverwrite on
## html docu
!if ${DEBUG_SKIP_DOCU} == 0
SetOutPath $INSTDIR\doc\html
!insertmacro InstallFolder "${OPENMSDOCDIR}\html\*.*" ".svn\"
SetOutPath $INSTDIR\doc
!insertmacro InstallFile "${OPENMSDOCDIR}\TOPP_tutorial.pdf"
!insertmacro InstallFile "${OPENMSDOCDIR}\OpenMS_tutorial.pdf"
!endif
!insertmacro CloseUninstallLog
SectionEnd
## Third party libs
SectionGroup "ThirdParty" SEC_ThirdParty
!if ${DEBUG_BUILD} == 0
Section "Proteowizard"
SectionIn 1 3
!insertmacro OpenUninstallLog
SetOverwrite on
CreateDirectory "$INSTDIR\share\OpenMS\THIRDPARTY\pwiz-bin"
SetOutPath "$INSTDIR\share\OpenMS\THIRDPARTY\pwiz-bin"
!insertmacro InstallFolder "${THIRDPARTYDIR}\pwiz-bin\*.*" ".git\"
## download .NET 3.5 and 4.0 (required by pwiz)
MessageBox MB_YESNO "Proteowizard requires both .NET 3.5 SP1 and .NET 4.0 installed. The installer will now download 'Microsoft .NET 3.5 SP1'. \
If you already have 'Microsoft .NET 3.5 SP1' installed you can skip this step. Do you wish to download it?" \
IDNO net35_install_success
inetc::get /BANNER "Getting .NET 3.5 SP1 installer." \
"http://www.microsoft.com/downloads/info.aspx?na=41&SrcFamilyId=AB99342F-5D1A-413D-8319-81DA479AB0D7&SrcDisplayLang=en&u=http%3a%2f%2fdownload.microsoft.com%2fdownload%2f0%2f6%2f1%2f061F001C-8752-4600-A198-53214C69B51F%2fdotnetfx35setup.exe" \
"$EXEDIR\NET3.5_SP1_installer.exe"
Pop $0
StrCmp $0 "OK" dl35ok
MessageBox MB_OK|MB_ICONEXCLAMATION "Downloading 'Microsoft .NET 3.5 SP1' failed. You must download and install it manually in order for Proteowizard to work!"
dl35ok:
ClearErrors
ExecWait '"$EXEDIR\NET3.5_SP1_installer.exe"' $0
StrCmp $0 0 net35_install_success
MessageBox MB_OK "The installation of the Microsoft .NET 3.5 SP1' package failed! You must download and install it manually in order for Proteowizard to work!"
net35_install_success:
## .NET 3.5 installed, yeah!
MessageBox MB_YESNO "The installer will now download 'Microsoft .NET 4.0', which is required by Proteowizard. \
If you already have 'Microsoft .NET 4.0' installed you can skip this step. Do you wish to download it?" \
IDNO net40_install_success
inetc::get /BANNER "Getting .NET 4.0 installer." \
"http://www.microsoft.com/downloads/info.aspx?na=41&SrcFamilyId=AB99342F-5D1A-413D-8319-81DA479AB0D7&SrcDisplayLang=en&u=http%3a%2f%2fdownload.microsoft.com%2fdownload%2f9%2f5%2fA%2f95A9616B-7A37-4AF6-BC36-D6EA96C8DAAE%2fdotNetFx40_Full_x86_x64.exe" \
"$EXEDIR\NET4.0_installer.exe"
Pop $0
StrCmp $0 "OK" dl40ok
MessageBox MB_OK|MB_ICONEXCLAMATION "Downloading 'Microsoft .NET 4.0' failed. You must download and install it manually in order for Proteowizard to work!"
dl40ok:
ClearErrors
ExecWait '"$EXEDIR\NET4.0_installer.exe"' $0
StrCmp $0 0 net40_install_success
MessageBox MB_OK "The installation of the Microsoft .NET 4.0' package failed! You must download and install it manually in order for Proteowizard to work!"
net40_install_success:
## .NET 4.0 installed, yeah!
## pwiz now requires vs 2010 32bit (!) runtime libraries installed (Agilent libraries)
SetOutPath $TEMP
SetOverwrite on
!insertmacro InstallFile ${VS_PWIZ_REDISTRIBUTABLE_EXE}
ClearErrors
ExecWait '$TEMP\${VS_PWIZ_REDISTRIBUTABLE_EXE} /q' $0
StrCmp $0 0 vs_pwiz_install_success
MessageBox MB_OK "The installation of the Visual Studio redistributable package '${VS_PWIZ_REDISTRIBUTABLE_EXE}' failed! Proteowizard will not work unless this package is installed! The package is located at '$TEMP\${VS_PWIZ_REDISTRIBUTABLE_EXE}'. Try to execute it as administrator - there will likely be an error which you can blame Microsoft for. If you cannot fix it contact the OpenMS developers!"
## reasons why the install might fail:
## see doc\doxygen\install\install-win-bin.doxygen --> FAQ
vs_pwiz_install_success:
!insertmacro InstallFile ${VS_PWIZ_ADD1_REDISTRIBUTABLE_EXE}
ClearErrors
ExecWait '$TEMP\${VS_PWIZ_ADD1_REDISTRIBUTABLE_EXE} /q' $0
StrCmp $0 0 vs_pwiz_add1_install_success
MessageBox MB_OK "The installation of the Visual Studio redistributable package '${VS_PWIZ_ADD1_REDISTRIBUTABLE_EXE}' failed! Proteowizard will not work unless this package is installed! The package is located at '$TEMP\${VS_PWIZ_ADD1_REDISTRIBUTABLE_EXE}'. Try to execute it as administrator - there will likely be an error which you can blame Microsoft for. If you cannot fix it contact the OpenMS developers!"
vs_pwiz_add1_install_success:
!insertmacro InstallFile ${VS_PWIZ_ADD2_REDISTRIBUTABLE_EXE}
ClearErrors
ExecWait '$TEMP\${VS_PWIZ_ADD2_REDISTRIBUTABLE_EXE} /q' $0
StrCmp $0 0 vs_pwiz_add2_install_success
MessageBox MB_OK "The installation of the Visual Studio redistributable package '${VS_PWIZ_ADD2_REDISTRIBUTABLE_EXE}' failed! Proteowizard will not work unless this package is installed! The package is located at '$TEMP\${VS_PWIZ_ADD2_REDISTRIBUTABLE_EXE}'. Try to execute it as administrator - there will likely be an error which you can blame Microsoft for. If you cannot fix it contact the OpenMS developers!"
vs_pwiz_add2_install_success:
!insertmacro CloseUninstallLog
SectionEnd
## Install everything in the given (flattened) THIRDPARTY folder.
!tempfile filelist
!system 'FOR /D %A IN ("${THIRDPARTYDIR}\*") DO @( IF NOT "%~nA" == "pwiz-bin" ((echo Section "%~nA" & echo SectionIn 1 3 & echo !insertmacro OpenUninstallLog & echo SetOverwrite on & echo CreateDirectory "$INSTDIR\share\OpenMS\THIRDPARTY\%~nA" & echo SetOutPath "$INSTDIR\share\OpenMS\THIRDPARTY\%~nA" & echo !insertmacro InstallFolder "%~A\*.*" ".git\" & echo Var /GLOBAL %~nAInstalled & echo StrCpy $%~nAInstalled "1" & echo !insertmacro CloseUninstallLog & echo SectionEnd) >> "${filelist}"))'
!include "${filelist}"
!delfile "${filelist}"
!endif
SectionGroupEnd
Section "-License" SEC_License
SectionIn 1 2 3
#open log file
!insertmacro OpenUninstallLog
SetOutPath $INSTDIR
SetOverwrite on
#!insertmacro InstallFile "${OPENMSDIR}\License.gpl-2.0.txt"
#!insertmacro InstallFile "${OPENMSDIR}\License.lgpl-2.1.txt"
#!insertmacro InstallFile "${OPENMSDIR}\License.libSVM.txt"
#!insertmacro InstallFile "${OPENMSDIR}\License.NetCDF.txt"
!insertmacro InstallFile "ReleaseNotes.txt"
!insertmacro CloseUninstallLog
SectionEnd
Function CreateShortcuts
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
## warning: create shortcuts only AFTER installing files, OR renew SetOutPath
## otherwise all files will be installed to the default install directory
!insertmacro CREATE_SMGROUP_SHORTCUT "OpenMS Documentation (html)" $INSTDIR\doc\html\index.html
!insertmacro CREATE_SMGROUP_SHORTCUT "TOPP and TOPPView tutorial (pdf)" $INSTDIR\doc\TOPP_tutorial.pdf
!insertmacro CREATE_SMGROUP_SHORTCUT "OpenMS Tutorial (pdf)" $INSTDIR\doc\OpenMS_tutorial.pdf
!insertmacro CREATE_SMGROUP_SHORTCUT TOPPView $INSTDIR\bin\TOPPView.exe
!insertmacro CREATE_SMGROUP_SHORTCUT TOPPAS $INSTDIR\bin\TOPPAS.exe
!insertmacro CREATE_SMGROUP_SHORTCUT INIFileEditor $INSTDIR\bin\INIFileEditor.exe
!insertmacro CREATE_SMGROUP_SHORTCUT "OpenMS Homepage" http://www.OpenMS.de/
!insertmacro CREATE_SMGROUP_SHORTCUT "TOPP command line" "$INSTDIR\bin\command.bat"
SetOutPath $SMPROGRAMS\${APPNAME}
CreateShortcut "$SMPROGRAMS\${APPNAME}\$(^UninstallLink).lnk" $INSTDIR\uninstall.exe
!insertmacro MUI_STARTMENU_WRITE_END
FunctionEnd
Section "-Create_StartMenu" SEC_StartMenuCreate
GetFunctionAddress $0 CreateShortcuts
UAC::ExecCodeSegment $0
SectionEnd
Section "-Create_command_bat" SEC_CmdBat
SectionIn 1 2 3
#open log file
!insertmacro OpenUninstallLog
## create a command bat
push $R0
push $0
StrCpy $R0 $INSTDIR 2
fileOpen $0 "$INSTDIR\bin\command.bat" w
fileWrite $0 "$SYSDIR\cmd.exe /k $\"$R0 && cd $INSTDIR\bin && cls && echo on && echo Welcome to the OpenMS TOPP tools command line && echo type 'dir *.exe' to see available commands && echo on $\""
fileClose $0
pop $0
pop $R0
FileWrite $UninstallLog "$INSTDIR\bin\command.bat$\r$\n"
!insertmacro CloseUninstallLog
SectionEnd
Section "-PathInst" SEC_PathRegister
SectionIn 1 2 3
# no logging required, as we do not install files in this section
## HINT: do not forget to also add/modify the un.EnvVarUpdate in the uninstall section!
# OpenMS binary path
${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$INSTDIR\bin"
IfErrors 0 +2
MessageBox MB_OK "Unable to add '$INSTDIR\bin' to PATH environment. Add manually if required. See 'details' for details."
# Third Party library paths
${If} ${FileExists} "$INSTDIR\share\OpenMS\THIRDPARTY\Fido\*.*"
${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$INSTDIR\share\OpenMS\THIRDPARTY\Fido"
IfErrors 0 +2
MessageBox MB_OK "Unable to add '$INSTDIR\share\OpenMS\THIRDPARTY\Fido' to PATH environment. Add manually if required. See 'details' for details."
${EndIf}
${If} ${FileExists} "$INSTDIR\share\OpenMS\THIRDPARTY\MyriMatch\*.*"
${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$INSTDIR\share\OpenMS\THIRDPARTY\MyriMatch"
IfErrors 0 +2
MessageBox MB_OK "Unable to add '$INSTDIR\share\OpenMS\THIRDPARTY\MyriMatch' to PATH environment. Add manually if required. See 'details' for details."
${EndIf}
${If} ${FileExists} "$INSTDIR\share\OpenMS\THIRDPARTY\XTandem\*.*"
${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$INSTDIR\share\OpenMS\THIRDPARTY\XTandem"
IfErrors 0 +2
MessageBox MB_OK "Unable to add '$INSTDIR\share\OpenMS\THIRDPARTY\XTandem' to PATH environment. Add manually if required. See 'details' for details."
${EndIf}
${If} ${FileExists} "$INSTDIR\share\OpenMS\THIRDPARTY\MSGFPlus\*.*"
${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$INSTDIR\share\OpenMS\THIRDPARTY\MSGFPlus"
IfErrors 0 +2
MessageBox MB_OK "Unable to add '$INSTDIR\share\OpenMS\THIRDPARTY\MSGFPlus' to PATH environment. Add manually if required. See 'details' for details."
${EndIf}
${If} ${FileExists} "$INSTDIR\share\OpenMS\THIRDPARTY\OMSSA\*.*"
${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$INSTDIR\share\OpenMS\THIRDPARTY\OMSSA"
IfErrors 0 +2
MessageBox MB_OK "Unable to add '$INSTDIR\share\OpenMS\THIRDPARTY\OMSSA' to PATH environment. Add manually if required. See 'details' for details."
${EndIf}
${If} ${FileExists} "$INSTDIR\share\OpenMS\THIRDPARTY\LuciPHOr2\*.*"
${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$INSTDIR\share\OpenMS\THIRDPARTY\LuciPHOr2"
IfErrors 0 +2
MessageBox MB_OK "Unable to add '$INSTDIR\share\OpenMS\THIRDPARTY\LuciPHOr2' to PATH environment. Add manually if required. See 'details' for details."
${EndIf}
#create OPENMS_DATA_PATH environment variable (for shared xml files etc)
; set variable
WriteRegExpandStr ${env_hklm} "OPENMS_DATA_PATH" "$INSTDIR\share\OpenMS"
; make sure windows knows about the change
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
SectionEnd
SectionGroup "Register File Extensions" SEC_RegisterExt
# no logging required, as we do not install files in this section
# windows registry info: http://support.microsoft.com/kb/256986
!insertmacro OpenMSGUIExtensions RegisterExtensionSection
Section "-RegFileRefreshInternal" SEC_RegFileRefreshInternal
SectionIn 1 2 3
${RefreshShellIcons}
SectionEnd
SectionGroupEnd
Section "-hidden VSRuntime"
# this requires admin privileges (which we should have, due to UAC plug-in)!
## TODO (when bored)
#install the visual studio runtime
#NSISdl::download http://www.domain.com/file localfile.exe
#Pop $R0 ;Get the return value
# StrCmp $R0 "success" +3
# MessageBox MB_OK "The download of the Visual Studio redistributable failed!\nP"
# Quit
SetOutPath $TEMP
SetOverwrite on
!insertmacro InstallFile ${VS_REDISTRIBUTABLE_EXE}
ClearErrors
ExecWait '$TEMP\${VS_REDISTRIBUTABLE_EXE} /q' $0
StrCmp $0 0 vs_install_success
MessageBox MB_OK "The installation of the Visual Studio redistributable package '${VS_REDISTRIBUTABLE_EXE}' failed! OpenMS will not work unless this package is installed! The package is located at '$TEMP\${VS_REDISTRIBUTABLE_EXE}'. Try to execute it as administrator - there will likely be an error which you can blame Microsoft for. If you cannot fix it contact the OpenMS developers!"
## reasons why the install might fail:
## see doc\doxygen\install\install-win-bin.doxygen --> FAQ
vs_install_success:
SectionEnd
Section -post SEC0008
WriteRegStr HKLM "${REGKEY}" Path $INSTDIR
WriteRegStr HKLM "${REGKEY}" "UninstallString" "$INSTDIR\uninstall.exe"
SetOutPath $INSTDIR
WriteUninstaller $INSTDIR\uninstall.exe
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayName "$(^Name)"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayVersion "${VERSION}"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" Publisher "OpenMS Developer Team"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" URLInfoAbout "${URL}"
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayIcon $INSTDIR\uninstall.exe
WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" UninstallString $INSTDIR\uninstall.exe
WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoModify 1
WriteRegDWORD HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoRepair 1
SectionEnd
# Installer functions
; Attempt to give the UAC plug-in a user process and an admin process.
Function .onInit
## UAC init:
## copied from http://nsis.sourceforge.net/UAC_plug-in
UAC_Elevate:
UAC::RunElevated
StrCmp 1223 $0 UAC_ElevationAborted ; UAC dialog aborted by user?
StrCmp 0 $0 0 UAC_Err ; Error?
StrCmp 1 $1 0 UAC_Success ;Are we the real deal or just the wrapper?
Quit
UAC_Err:
MessageBox mb_iconstop "Unable to elevate, error $0"
Abort
UAC_ElevationAborted:
# elevation was aborted, run as normal?
MessageBox mb_iconstop "This installer requires administrative rights, aborting!"
Abort
UAC_Success:
StrCmp 1 $3 +4 ;Admin?
StrCmp 3 $1 0 UAC_ElevationAborted ;Try again?
MessageBox mb_iconstop "This installer requires administrative rights, try again"
goto UAC_Elevate
## now our own code:
# show splash screen
InitPluginsDir
Push $R1
File /oname=$PLUGINSDIR\spltmp.bmp OpenMS_splash.bmp
advsplash::show 1000 600 400 -1 $PLUGINSDIR\spltmp
Pop $R1
Pop $R1
## deny starting of x64 installer on an x86 system (will not run)
!if ${PLATFORM} == 64
${If} ${RunningX64}
${else}
MessageBox mb_iconstop "You are running a 32bit operating system. The executables of this setup are 64bit, and thus cannot be run after installation. Use a 64bit OS, or use the 32bit setup of OpenMS."
Abort
${EndIf}
!endif
# check for previous versions
#on install we did: WriteRegStr HKLM "${REGKEY}" "Path" "$INSTDIR"
ReadRegStr $R0 HKLM "${REGKEY}" "Path"
StrCmp $R0 "" virgin_install
## store, if the old-installer is present ($R8 should be empty then)
ReadRegStr $R8 HKLM "${REGKEY}" "UninstallString"
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
"OpenMS has already been installed. $\nThe old version will be removed automatically. \
Please close all OpenMS applications before continuing!" \
IDCANCEL quit_installer
;Run the uninstaller
ClearErrors
ExecWait '$R0\uninstall.exe _?=$R0';; Do not execute the copy of uninstaller (ExecWait won´t work)
Delete "$R0\uninstall.exe" # delete installer manually
push $R9
${DirState} "$R0" $R9
StrCmp $R9 1 0 virgin_install
pop $R9
# look for the very first (and buggy) version of the installer
StrCmp $R8 "" 0 new_installer
# we found the old installer:
## delete the licenses, share other stuff
RmDir /REBOOTOK "$R0\GUI"
RmDir /REBOOTOK /r "$R0\share"
Delete /REBOOTOK "$R0\*.txt"
## correct Path settings (they were not properly reset)
${EnvVarUpdate} $0 "PATH" "R" "HKLM" "$R0\lib"
${EnvVarUpdate} $0 "PATH" "R" "HKLM" "$R0\TOPP"
; delete variable
DeleteRegValue ${env_hklm} "OPENMS_DATA_PATH"
; make sure windows knows about the change
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
#${EnvVarUpdate} $0 "OPENMS_DATA_PATH" "R" "HKLM" "$R0\lib"
new_installer:
## check that all *.dll´s and *.exe files are gone (userfiles are ok)! otherwise force reboot
!insertmacro REBOOT_ON_INCOMPLETE_DELETION $R0
virgin_install:
!insertmacro MUI_LANGDLL_DISPLAY
return
quit_installer:
quit
FunctionEnd
Function .OnInstFailed
UAC::Unload ;Must call unload!
FunctionEnd
Function .OnInstSuccess
UAC::Unload ;Must call unload!
FunctionEnd
# set the component descriptions after the Sections have been defined!
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_Lib} "The core libraries of OpenMS"
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_TOPP} "TOPP (The OpenMS Proteomics Pipeline) - chainable tools for data analysis"
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_Doc} "Documentation/Tutorials for TOPP, TOPPView and the OpenMS library itself."
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_ThirdParty} "Install third party libraries (e.g. ProteoWizard)."
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_RegisterExt} "Register certain file types (e.g. '.mzML') with TOPPView.exe"
!insertmacro MUI_FUNCTION_DESCRIPTION_END
################
## UNINSTALL ###
################
# Uninstaller sections
Section "Uninstall"
ReadRegStr $INSTDIR HKLM "${REGKEY}" Path
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuGroup
!insertmacro MUI_UNGETLANGUAGE
## undo changes to PATH
# OpenMS binary path
${un.EnvVarUpdate} $0 "PATH" "R" "HKLM" "$INSTDIR\bin"
# Third Party library paths
${If} ${FileExists} "$INSTDIR\share\OpenMS\THIRDPARTY\Fido\*.*"
${un.EnvVarUpdate} $0 "PATH" "R" "HKLM" "$INSTDIR\share\OpenMS\THIRDPARTY\Fido"
${EndIf}
${If} ${FileExists} "$INSTDIR\share\OpenMS\THIRDPARTY\MyriMatch\*.*"
${un.EnvVarUpdate} $0 "PATH" "R" "HKLM" "$INSTDIR\share\OpenMS\THIRDPARTY\MyriMatch"
${EndIf}
${If} ${FileExists} "$INSTDIR\share\OpenMS\THIRDPARTY\XTandem\*.*"
${un.EnvVarUpdate} $0 "PATH" "R" "HKLM" "$INSTDIR\share\OpenMS\THIRDPARTY\XTandem"
${EndIf}
${If} ${FileExists} "$INSTDIR\share\OpenMS\THIRDPARTY\MSGFPlus\*.*"
${un.EnvVarUpdate} $0 "PATH" "R" "HKLM" "$INSTDIR\share\OpenMS\THIRDPARTY\MSGFPlus"
${EndIf}
${If} ${FileExists} "$INSTDIR\share\OpenMS\THIRDPARTY\OMSSA\*.*"
${un.EnvVarUpdate} $0 "PATH" "R" "HKLM" "$INSTDIR\share\OpenMS\THIRDPARTY\OMSSA"
${EndIf}
${If} ${FileExists} "$INSTDIR\share\OpenMS\THIRDPARTY\LuciPHOr2\*.*"
${un.EnvVarUpdate} $0 "PATH" "R" "HKLM" "$INSTDIR\share\OpenMS\THIRDPARTY\LuciPHOr2"
${EndIf}
## remove OPENMS_DATA_PATH
${un.EnvVarUpdate} $0 "OPENMS_DATA_PATH" "R" "HKLM" "$INSTDIR\share\OpenMS"
# remove extension-links to TOPPView
!insertmacro OpenMSGUIExtensions UnRegisterExtensionSection
${un.RefreshShellIcons}
## delete all installed files
FileOpen $UninstallLog "$INSTDIR\uninstall.log" r
UninstallLoop:
ClearErrors
FileRead $UninstallLog $R0
IfErrors UninstallEnd
Push $R0
Call un.TrimNewLines
Pop $R0
Delete $R0
Goto UninstallLoop
UninstallEnd:
FileClose $UninstallLog
Delete "$INSTDIR\uninstall.log"
Delete "$INSTDIR\uninstall.exe"
# remove directories which are now empty
Push "\"
Call un.RemoveEmptyDirs
## clean up the registry
DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)"
# delete /Software/OpenMS (with all its content)
DeleteRegKey HKLM "${REGKEY}"
RmDir /REBOOTOK $INSTDIR
## delete start menu entries (via user process to find the correct $SMPROGRAMS directory)
GetFunctionAddress $0 un.clearStartMenu
UAC::ExecCodeSegment $0
SectionEnd
Function un.clearStartMenu
# delete Startmenu-Entry
RmDir /r /REBOOTOK $SMPROGRAMS\${APPNAME}
FunctionEnd
# Installer functions
; Attempt to give the UAC plug-in a user process and an admin process.
Function un.onInit
## UAC init:
## copied from http://nsis.sourceforge.net/UAC_plug-in
UAC_Elevate:
UAC::RunElevated
StrCmp 1223 $0 UAC_ElevationAborted ; UAC dialog aborted by user?
StrCmp 0 $0 0 UAC_Err ; Error?
StrCmp 1 $1 0 UAC_Success ;Are we the real deal or just the wrapper?
Quit
UAC_Err:
MessageBox mb_iconstop "Unable to elevate, error $0"
Abort
UAC_ElevationAborted:
# elevation was aborted, run as normal?
MessageBox mb_iconstop "This installer requires administrative rights, aborting!"
Abort
UAC_Success:
StrCmp 1 $3 +4 ;Admin?
StrCmp 3 $1 0 UAC_ElevationAborted ;Try again?
MessageBox mb_iconstop "This installer requires administrative rights, try again"
goto UAC_Elevate
FunctionEnd