]> git.lyx.org Git - lyx.git/blob - development/Win32/packaging/installer/LyXWinInstaller/LyXInstaller-small.nsi
Changed comment character from ';' to '#*
[lyx.git] / development / Win32 / packaging / installer / LyXWinInstaller / LyXInstaller-small.nsi
1 # Lyx for Windows, NSIS v2 series installer script
2
3 # File LyXInstaller-small.nsi
4 # This file is part of LyX, the document processor.
5 # http://www.lyx.org/
6 # Licence details can be found in the file COPYING or copy at
7 # http://www.lyx.org/about/license.php3
8
9 # Author Uwe Stöhr based on the work of Angus Leeming and Joost Verburg
10 # Full author contact details are available in file CREDITS or copy at
11 # http://www.lyx.org/about/credits.php
12
13 # This script requires NSIS 2.25 and newer
14 # http://nsis.sourceforge.net/
15 #--------------------------------
16
17 # Do a Cyclic Redundancy Check to make sure the installer
18 # was not corrupted by the download.
19 CRCCheck force
20
21 # Make the installer as small as possible.
22 #SetCompressor lzma
23
24 #--------------------------------
25 # You should need to change only these macros...
26
27 !define INSTALLER_VERSION "Small"
28 !define INSTALLER2_VERSION "Complete"
29 !define INSTALLER3_VERSION "Update"
30
31 # load the settings
32 !include "Settings.nsh"
33
34 #--------------------------------
35 # variables only used in this installer version
36
37 Var DelPythonFiles
38 Var GhostscriptPath
39 Var AiksaurusPath
40 Var AspellPath
41 Var Acrobat
42 Var PSVPath
43 Var EditorPath
44 Var ImageEditorPath
45 Var BibTeXEditorPath
46 Var LangEncoding
47 Var LangSysEncoding
48 Var MissedProg
49 Var LaTeXName
50 Var MiKTeXVersion
51 Var MiKTeXUser
52 Var State
53 # Variables used by all installer versions
54 Var AspellInstallYes
55 Var AspellBaseReg
56 Var AspellMessage
57 Var ImageMagickPath
58 Var JabRefInstalled
59 Var JabRefVersionVar
60 Var LatexPath
61 Var MiKTeXInstalled
62 Var MiKTeXVersionVar
63 Var PythonPath
64 Var Answer
65 Var AppPre
66 Var AppSuff
67 Var AppPath
68 Var CreateDesktopIcon
69 Var CreateFileAssociations
70 Var DictCode
71 Var FileName
72 Var LangCode
73 Var LangCodeSys
74 Var LangName
75 Var LangNameSys
76 Var NewString
77 Var OldString
78 Var PathPrefix
79 Var Pointer
80 Var ProductRootKey
81 Var RunNumber
82 Var StartmenuFolder
83 Var String
84 Var Search
85 Var UserList
86 Var UserName
87
88 #--------------------------------
89 # load some NSIS libraries
90 !include "MUI.nsh"
91 !include "LogicLib.nsh"
92 !include "FileFunc.nsh"
93 !include "StrFunc.nsh"
94 !include "TextFunc.nsh"
95 !insertmacro LineFind
96 !include "WordFunc.nsh"
97 !insertmacro WordReplace
98
99 # Set of various macros and functions
100 !include "LyXUtils.nsh"
101
102 # Functions to check and configure the LaTeX-system
103 !include "LaTeX.nsh"
104
105 # Function to check if needed programs are missing or not
106 !include "MissingPrograms.nsh"
107
108 # Function for page to manually select LaTeX's installation folder
109 !include "LaTeXFolder.nsh"
110
111 # Functions for page to set installer language
112 # and LyX's menu language
113 !include "LanguageSettings.nsh"
114
115 # Function to configure LyX
116 !include "ConfigLyX.nsh"
117
118 # Function for page to install Aspell dictionaries
119 !include "Aspell.nsh"
120
121 #--------------------------------
122 # Remember the installer language
123 !define MUI_LANGDLL_REGISTRY_ROOT "HKCU"
124 !define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
125 !define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
126
127 !define MUI_ABORTWARNING
128 !define MUI_HEADERIMAGE
129 !define MUI_HEADERIMAGE_BITMAP "${PRODUCT_DIR}\icons\lyx_logo_hi.bmp"
130 !define MUI_ICON "${PRODUCT_DIR}\icons\lyx.ico"
131 !define MUI_UNICON "${PRODUCT_DIR}\icons\lyx.ico"
132 !define MUI_WELCOMEFINISHPAGE_BITMAP "${VERSION_BITMAP}"
133
134 # Welcome page
135 !define MUI_WELCOMEPAGE_TEXT "$(WelcomePageText)"
136 !insertmacro MUI_PAGE_WELCOME
137
138 # Show the license.
139 !insertmacro MUI_PAGE_LICENSE "${PRODUCT_LICENSE_FILE}"
140
141 # Specify the installation directory.
142 !insertmacro MUI_PAGE_DIRECTORY
143
144 # Specify LyX's menu language.
145 Page custom SelectMenuLanguage SelectMenuLanguage_LeaveFunction
146
147 # Define which components to install.
148 !insertmacro MUI_PAGE_COMPONENTS
149
150 # Specify where to install program shortcuts.
151 !define MUI_STARTMENUPAGE_REGISTRY_ROOT "${PRODUCT_ROOT_KEY}"
152 !define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
153 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
154 !define MUI_STARTMENUPAGE_DEFAULTFOLDER "LyX ${PRODUCT_VERSION}"
155 !insertmacro MUI_PAGE_STARTMENU ${PRODUCT_NAME} $StartmenuFolder
156
157 # Select latex.exe manually
158 Page custom LatexFolder LatexFolder_LeaveFunction
159
160 # Check for needed programs
161 Page custom MissingProgramsPage MissingProgramsPage_LeaveFunction
162
163 # Watch the components being installed.
164 !insertmacro MUI_PAGE_INSTFILES
165
166 # Finish page
167 !define MUI_FINISHPAGE_RUN 
168 !define MUI_FINISHPAGE_TEXT "$(FinishPageMessage)"
169 !define MUI_FINISHPAGE_RUN_TEXT "$(FinishPageRun)"
170 !define MUI_FINISHPAGE_RUN_FUNCTION "LaunchProduct"
171 !insertmacro MUI_PAGE_FINISH
172
173 # The uninstaller.
174 !insertmacro MUI_UNPAGE_COMPONENTS
175 !insertmacro MUI_UNPAGE_INSTFILES
176
177 #--------------------------------
178 # Languages
179
180 !insertmacro MUI_LANGUAGE "English" # first language is the default language
181 !insertmacro MUI_LANGUAGE "Danish"
182 !insertmacro MUI_LANGUAGE "Dutch"
183 !insertmacro MUI_LANGUAGE "French"
184 !insertmacro MUI_LANGUAGE "German"
185 !insertmacro MUI_LANGUAGE "Galician"
186 !insertmacro MUI_LANGUAGE "Hungarian"
187 !insertmacro MUI_LANGUAGE "Italian"
188 !insertmacro MUI_LANGUAGE "Norwegian"
189 !insertmacro MUI_LANGUAGE "Polish"
190 !insertmacro MUI_LANGUAGE "Portuguese"
191 !insertmacro MUI_LANGUAGE "Slovak"
192 !insertmacro MUI_LANGUAGE "Spanish"
193 !insertmacro MUI_LANGUAGE "Swedish"
194 !insertmacro MUI_LANGUAGE "Turkish"
195
196 !include "lyx_languages\english.nsh"
197 !include "lyx_languages\danish.nsh"
198 !include "lyx_languages\dutch.nsh"
199 !include "lyx_languages\french.nsh"
200 !include "lyx_languages\german.nsh"
201 !include "lyx_languages\galician.nsh"
202 !include "lyx_languages\hungarian.nsh"
203 !include "lyx_languages\italian.nsh"
204 !include "lyx_languages\norwegian.nsh"
205 !include "lyx_languages\polish.nsh"
206 !include "lyx_languages\portuguese.nsh"
207 !include "lyx_languages\slovak.nsh"
208 !include "lyx_languages\spanish.nsh"
209 !include "lyx_languages\swedish.nsh"
210 !include "lyx_languages\turkish.nsh"
211
212 LicenseData "$(LyXLicenseData)"
213
214 #--------------------------------
215 # Reserve Files
216
217 # These files are inserted before other files in the data block
218 !insertmacro MUI_RESERVEFILE_LANGDLL
219 ReserveFile "io_ui_language.ini"
220 !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
221
222 #--------------------------------
223 # Installer sections
224
225 Section "!${PRODUCT_NAME}" SecCore
226   SectionIn RO
227 SectionEnd
228 Section "$(SecAllUsersTitle)" SecAllUsers
229   SetShellVarContext all
230   StrCpy $ProductRootKey "HKLM"
231 SectionEnd
232 Section "$(SecFileAssocTitle)" SecFileAssoc
233   StrCpy $CreateFileAssociations "true"
234 SectionEnd
235 Section "$(SecDesktopTitle)" SecDesktop
236   StrCpy $CreateDesktopIcon "true"
237 SectionEnd
238
239 # Section descriptions
240 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
241 !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} "$(SecCoreDescription)"
242 !insertmacro MUI_DESCRIPTION_TEXT ${SecAllUsers} "$(SecAllUsersDescription)"
243 !insertmacro MUI_DESCRIPTION_TEXT ${SecFileAssoc} "$(SecFileAssocDescription)"
244 !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} "$(SecDesktopDescription)"
245 !insertmacro MUI_FUNCTION_DESCRIPTION_END
246
247 # the installation section
248 !include "InstallActions-small.nsh"
249
250 #--------------------------------
251 # This hook function is called internally by NSIS on installer startup
252 Function .onInit
253
254   # set the installer language to the Windows locale language
255   System::Call "kernel32::GetUserDefaultLangID()i.a"
256
257   # check that the installer is not currently running
258   System::Call 'kernel32::CreateMutexA(i 0, i 0, t "${INSTALLER_EXE}.Instance") i .r1 ?e'
259   Pop $R0
260   ${if} $R0 != "0"
261    MessageBox MB_OK|MB_ICONSTOP "$(InstallRunning)"
262    Abort
263   ${endif}
264   FindProcDLL::FindProc "${INSTALLER2_EXE}"
265   ${if} $R0 == "1"
266    MessageBox MB_OK|MB_ICONSTOP "$(InstallRunning)"
267    Abort
268   ${endif}
269
270   # check if LyX is already installed
271   ReadRegStr $0 HKLM "${PRODUCT_UNINST_KEY}" "Publisher"
272   ${if} $0 != ""
273    MessageBox MB_OK|MB_ICONSTOP "$(StillInstalled)"
274    Abort
275   ${endif}
276
277   # default settings
278   # these can be reset to "all" in section SecAllUsers
279   SetShellVarContext current
280   StrCpy $ProductRootKey "HKCU"
281
282   # this can be reset to "true" in section SecDesktop
283   StrCpy $CreateDesktopIcon "false"
284   StrCpy $CreateFileAssociations "false"
285
286   # if the user does *not* have administrator privileges, abort
287   StrCpy $Answer ""
288   StrCpy $UserName ""
289   !insertmacro IsUserAdmin $Answer $UserName # macro from LyXUtils.nsh
290   ${if} $Answer == "yes"
291     !define ENABLE 0x00000001
292     SectionGetFlags ${SecAllUsers} $0
293     IntOp $0 $0 | ${ENABLE}
294     SectionSetFlags ${SecAllUsers} $0
295     !undef ENABLE
296   ${else}
297     MessageBox MB_OK|MB_ICONSTOP "$(NotAdmin)"
298     Abort
299   ${endif}
300
301   # check the LaTeX-system
302   Call LaTeXActions # Function from LaTeX.nsh
303
304   # check which programs are installed or not
305   Call MissingPrograms # function from MissingPrograms.nsh
306
307   # used later in the function LatexFolder
308   StrCpy $State "0"
309
310   ClearErrors
311 FunctionEnd
312
313 #--------------------------------
314
315 Function LaunchProduct
316   Exec ${PRODUCT_BAT}
317 FunctionEnd
318
319 #--------------------------------
320 # The Uninstaller
321
322 !include "Uninstall.nsh"
323
324 # eof