-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFitplot Windows x64 Setup.nsi
129 lines (90 loc) · 3.32 KB
/
Fitplot Windows x64 Setup.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
;Fitplot Setup
;Written by Craig S. Prevallet
;based on NSIS Modern User Interface
;NSIS Modern User Interface
;Welcome/Finish Page Example Script
;Written by Joost Verburg
;--------------------------------
;Include LogicLib to check we
; are admin
!include LogicLib.nsh
Function .onInit
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}
FunctionEnd
;--------------------------------
;Include Modern UI
!include "MUI2.nsh"
;--------------------------------
;General
;Name and file
Name "Fitplot"
OutFile "Fitplot Windows x64 Setup.exe"
;Default installation folder
;InstallDir "$LOCALAPPDATA\Fitplot"
InstallDir "$PROGRAMFILES64\Fitplot"
;Get installation folder from registry if available
InstallDirRegKey HKCU "Software\Fitplot" ""
;Request application privileges for Windows Vista
RequestExecutionLevel admin
;--------------------------------
;Variables
Var StartMenuFolder
;--------------------------------
;Interface Settings
!define MUI_ABORTWARNING
;--------------------------------
;Pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "fitplot\nw.package\LICENSE.txt"
!insertmacro MUI_PAGE_DIRECTORY
;Start Menu Folder Page Configuration
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\Fitplot"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
;Installer Sections
Section "Components" Components
CreateDirectory "$INSTDIR"
SetOutPath "$INSTDIR"
;Create an environmental variable for the static (help) file locations.
;setx available Win Vista and later.
nsExec::Exec 'setx STATIC_FILES "$INSTDIR\nw.package\static"'
;Install all files under fitplot directory
File /r "fitplot\"
;Store installation folder
WriteRegStr HKCU "Software\Fitplot" "" $INSTDIR
;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
;Create shortcuts
CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\nw.exe" 1 SW_SHOWNORMAL
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Fitplot.lnk" "$INSTDIR\nw.exe" .\nw.package "$INSTDIR\nw.exe" 1 SW_SHOWNORMAL
!insertmacro MUI_STARTMENU_WRITE_END
SectionEnd
;Uninstaller Section
Section "Uninstall"
RMDir /r "$INSTDIR"
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
Delete "$SMPROGRAMS\$StartMenuFolder\Fitplot.lnk"
Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk"
RMDir "$SMPROGRAMS\$StartMenuFolder"
nsExec::Exec 'set STATIC_FILES ""'
DeleteRegKey /ifempty HKCU "Software\Fitplot"
SectionEnd