1 | ; NSIS installer script for MAVA Logger X
|
---|
2 |
|
---|
3 | ;--------------------------------
|
---|
4 | ;Include Modern UI
|
---|
5 |
|
---|
6 | !include "MUI.nsh"
|
---|
7 | !include "nsDialogs.nsh"
|
---|
8 | !include "TextFunc.nsh"
|
---|
9 | !include "mlx-common.nsh"
|
---|
10 |
|
---|
11 | ;--------------------------------
|
---|
12 | ;General
|
---|
13 |
|
---|
14 | Var ApplicationName
|
---|
15 |
|
---|
16 | Function .onInit
|
---|
17 | StrCpy $ApplicationName "Mava Logger X"
|
---|
18 | FunctionEnd
|
---|
19 |
|
---|
20 | ;Name and file
|
---|
21 | Name "MAVA Logger X"
|
---|
22 | Caption "MAVA Logger X ${MLX_VERSION} Setup"
|
---|
23 | OutFile "MAVA Logger X-${MLX_VERSION}-Setup.exe"
|
---|
24 |
|
---|
25 | ;Default installation folder
|
---|
26 | InstallDir "$PROGRAMFILES\MAVA Logger X"
|
---|
27 |
|
---|
28 | ;Vista redirects $SMPROGRAMS to all users without this
|
---|
29 | RequestExecutionLevel admin
|
---|
30 |
|
---|
31 | ;--------------------------------
|
---|
32 | ;Variables
|
---|
33 |
|
---|
34 | Var MUI_TEMP
|
---|
35 | Var STARTMENU_FOLDER
|
---|
36 | Var Variable
|
---|
37 | Var Secondary
|
---|
38 | Var Secondary_State
|
---|
39 | Var LinkName
|
---|
40 | Var Parameters
|
---|
41 |
|
---|
42 | ;--------------------------------
|
---|
43 | ;Interface Settings
|
---|
44 |
|
---|
45 | !define MUI_ICON "logo.ico"
|
---|
46 | !define MUI_UNICON "logo_uninst.ico"
|
---|
47 | !define MUI_ABORTWARNING
|
---|
48 |
|
---|
49 | ;--------------------------------
|
---|
50 | ;Pages
|
---|
51 |
|
---|
52 | !insertmacro MUI_PAGE_LICENSE "license.txt"
|
---|
53 | Page custom optionsPage ;optionsPageLeave
|
---|
54 | !insertmacro MUI_PAGE_COMPONENTS
|
---|
55 | !insertmacro MUI_PAGE_DIRECTORY
|
---|
56 |
|
---|
57 | ;Start Menu Folder Page Configuration
|
---|
58 | ;!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"
|
---|
59 | ;!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\MAVA Logger X"
|
---|
60 | ;!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
|
---|
61 |
|
---|
62 | !insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
|
---|
63 |
|
---|
64 | !insertmacro MUI_PAGE_INSTFILES
|
---|
65 |
|
---|
66 | !insertmacro MUI_UNPAGE_CONFIRM
|
---|
67 | !insertmacro MUI_UNPAGE_INSTFILES
|
---|
68 |
|
---|
69 | Function optionsPage
|
---|
70 | !insertmacro MUI_HEADER_TEXT $(InstallOpts_Title) $(InstallOpts_SubTitle)
|
---|
71 |
|
---|
72 | nsDialogs::Create 1018
|
---|
73 | Pop $Variable
|
---|
74 |
|
---|
75 | ${If} $Variable == error
|
---|
76 | Abort
|
---|
77 | ${Endif}
|
---|
78 |
|
---|
79 | ${NSD_CreateLabel} 0 0 100% 32u $(InstallOpts_SecondaryExpl)
|
---|
80 | Pop $Variable
|
---|
81 |
|
---|
82 | ${NSD_CreateCheckBox} 12 62 100% 12u $(InstallOpts_Secondary)
|
---|
83 | Pop $Secondary
|
---|
84 | ${NSD_SetState} $Secondary $Secondary_State
|
---|
85 | GetFunctionAddress $Variable onSecondaryClicked
|
---|
86 | nsDialogs::onClick $Secondary $Variable
|
---|
87 |
|
---|
88 | nsDialogs::Show
|
---|
89 | FunctionEnd
|
---|
90 |
|
---|
91 | Function onSecondaryClicked
|
---|
92 | Pop $Secondary
|
---|
93 | ${NSD_GetState} $Secondary $Secondary_State
|
---|
94 | ${If} $Secondary_State == ${BST_CHECKED}
|
---|
95 | StrCpy $INSTDIR "$PROGRAMFILES\MAVA Logger X (Secondary)"
|
---|
96 | StrCpy $STARTMENU_FOLDER "MAVA Logger X (Secondary)"
|
---|
97 | ${Else}
|
---|
98 | StrCpy $INSTDIR "$PROGRAMFILES\MAVA Logger X"
|
---|
99 | StrCpy $STARTMENU_FOLDER "MAVA Logger X"
|
---|
100 | ${EndIf}
|
---|
101 | FunctionEnd
|
---|
102 |
|
---|
103 | ;--------------------------------
|
---|
104 | ;Languages
|
---|
105 |
|
---|
106 | !insertmacro MUI_LANGUAGE "English"
|
---|
107 | !insertmacro MUI_LANGUAGE "Hungarian"
|
---|
108 |
|
---|
109 | ;--------------------------------
|
---|
110 | ;Installer Sections
|
---|
111 |
|
---|
112 | Section "MAVA Logger X" SecMLX
|
---|
113 |
|
---|
114 | SetOutPath "$INSTDIR"
|
---|
115 |
|
---|
116 | ${If} $Secondary_State == ${BST_CHECKED}
|
---|
117 | StrCpy $LinkName "MAVA Logger X (Secondary)"
|
---|
118 | StrCpy $Parameters "secondary"
|
---|
119 | ${Else}
|
---|
120 | StrCpy $LinkName "MAVA Logger X"
|
---|
121 | StrCpy $Parameters ""
|
---|
122 | ${EndIf}
|
---|
123 |
|
---|
124 | ;ADD YOUR OWN FILES HERE...
|
---|
125 | File /r dist\*.*
|
---|
126 |
|
---|
127 | ;Create the uninstaller config file
|
---|
128 | ${ConfigWrite} "$INSTDIR\Uninstall.conf" "StartMenuFolder=" "$STARTMENU_FOLDER" $Variable
|
---|
129 | ${ConfigWrite} "$INSTDIR\Uninstall.conf" "LinkName=" "$LinkName" $Variable
|
---|
130 |
|
---|
131 | ;Create uninstaller
|
---|
132 |
|
---|
133 | WriteUninstaller "$INSTDIR\Uninstall.exe"
|
---|
134 |
|
---|
135 | !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
|
---|
136 | ;Create shortcuts
|
---|
137 | CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
|
---|
138 | CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\MAVA Logger X.lnk" "$INSTDIR\runmlx.exe" "$Parameters"
|
---|
139 | CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
|
---|
140 | CreateShortCut "$DESKTOP\$LinkName.lnk" "$INSTDIR\runmlx.exe" "$Parameters"
|
---|
141 | !insertmacro MUI_STARTMENU_WRITE_END
|
---|
142 | SectionEnd
|
---|
143 |
|
---|
144 | ;--------------------------------
|
---|
145 | ;Descriptions
|
---|
146 |
|
---|
147 | ;Language strings
|
---|
148 | LangString DESC_SecMLX ${LANG_ENGLISH} "The MAVA Logger X application itself."
|
---|
149 | LangString DESC_SecMLX ${LANG_HUNGARIAN} "Maga a MAVA Logger X alkalmazás."
|
---|
150 |
|
---|
151 | ;Assign language strings to sections
|
---|
152 | !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
---|
153 | !insertmacro MUI_DESCRIPTION_TEXT ${SecMLX} $(DESC_SecMLX)
|
---|
154 | !insertmacro MUI_FUNCTION_DESCRIPTION_END
|
---|
155 |
|
---|
156 | LangString InstallOpts_Title ${LANG_ENGLISH} "Installation Options"
|
---|
157 | LangString InstallOpts_Title ${LANG_HUNGARIAN} "Telepítési beállítások"
|
---|
158 |
|
---|
159 | LangString InstallOpts_SubTitle ${LANG_ENGLISH} "Choose the options for the installation"
|
---|
160 | LangString InstallOpts_SubTitle ${LANG_HUNGARIAN} "Válassza ki a telepítés beállításait"
|
---|
161 |
|
---|
162 | LangString InstallOpts_SecondaryExpl ${LANG_ENGLISH} "If you select the option below, the program will be installed in a way that it can be used besides another, already existing installation. Its default configuration will be such that it does not conflict with another logger running as a primary one. Normally, you should leave this unchecked."
|
---|
163 | LangString InstallOpts_SecondaryExpl ${LANG_HUNGARIAN} "Az alábbi opció kijelölésével a programot úgy fogjuk telepíteni, hogy azt egy másik mellett, azzal egyidejûen lehessen használni. Az alapértelmezett konfigurációja elkerüli a másik futó loggerrel való ütközést. Általában azonban ezt az opciót nem kell kijelölni."
|
---|
164 |
|
---|
165 | LangString InstallOpts_Secondary ${LANG_ENGLISH} "Install as a secondary copy"
|
---|
166 | LangString InstallOpts_Secondary ${LANG_HUNGARIAN} "Telepítés másodlagos példányként"
|
---|
167 |
|
---|
168 | ;--------------------------------
|
---|
169 | ;Uninstaller Section
|
---|
170 |
|
---|
171 | Section "Uninstall"
|
---|
172 |
|
---|
173 | ;Read the uninstaller config file
|
---|
174 | ${ConfigRead} "$INSTDIR\Uninstall.conf" "StartMenuFolder=" $MUI_TEMP
|
---|
175 | ${ConfigRead} "$INSTDIR\Uninstall.conf" "LinkName=" $LinkName
|
---|
176 |
|
---|
177 | RMDir /r "$INSTDIR"
|
---|
178 |
|
---|
179 | Delete "$DESKTOP\$LinkName.lnk"
|
---|
180 | Delete "$SMPROGRAMS\$MUI_TEMP\MAVA Logger X.lnk"
|
---|
181 | Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
|
---|
182 |
|
---|
183 | ;Delete empty start menu parent diretories
|
---|
184 | StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
|
---|
185 |
|
---|
186 | startMenuDeleteLoop:
|
---|
187 | ClearErrors
|
---|
188 | RMDir $MUI_TEMP
|
---|
189 | GetFullPathName $MUI_TEMP "$MUI_TEMP\.."
|
---|
190 |
|
---|
191 | IfErrors startMenuDeleteLoopDone
|
---|
192 |
|
---|
193 | StrCmp $MUI_TEMP $SMPROGRAMS startMenuDeleteLoopDone startMenuDeleteLoop
|
---|
194 | startMenuDeleteLoopDone:
|
---|
195 | SectionEnd
|
---|