1 # Lyx for Windows, NSIS v2 series installer script
3 # File LyXInstaller-small.nsi
4 # This file is part of LyX, the document processor.
6 # Licence details can be found in the file COPYING or copy at
7 # http://www.lyx.org/about/license.php3
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
13 # This script requires NSIS 2.25 and newer
14 # http://nsis.sourceforge.net/
15 #--------------------------------
17 # Do a Cyclic Redundancy Check to make sure the installer
18 # was not corrupted by the download.
21 # Make the installer as small as possible.
24 #--------------------------------
25 # You should need to change only these macros...
27 !define INSTALLER_VERSION "Small"
28 !define INSTALLER2_VERSION "Complete"
29 !define INSTALLER3_VERSION "Update"
30 !define INSTALLER_TYPE "NotUpdate"
33 !include "Settings.nsh"
35 #--------------------------------
36 # variables only used in this installer version
54 # Variables used by all installer versions
70 Var CreateFileAssociations
89 #--------------------------------
90 # load some NSIS libraries
92 !include "LogicLib.nsh"
93 !include "FileFunc.nsh"
94 !include "StrFunc.nsh"
96 # Set of various macros and functions
97 !include "LyXUtils.nsh"
99 # Functions to check and configure the LaTeX-system
102 # Function to check if needed programs are missing or not
103 !include "MissingPrograms.nsh"
105 # Function for page to manually select LaTeX's installation folder
106 !include "LaTeXFolder.nsh"
108 # Functions for page to set installer language
109 # and LyX's menu language
110 !include "LanguageSettings.nsh"
112 # Function to configure LyX
113 !include "ConfigLyX.nsh"
115 # Function for page to install Aspell dictionaries
116 !include "Aspell.nsh"
118 #--------------------------------
119 # Remember the installer language
120 !define MUI_LANGDLL_REGISTRY_ROOT "HKCU"
121 !define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
122 !define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
124 !define MUI_ABORTWARNING
125 !define MUI_HEADERIMAGE
126 !define MUI_HEADERIMAGE_BITMAP "${PRODUCT_DIR}\icons\lyx_logo_hi.bmp"
127 !define MUI_ICON "${PRODUCT_DIR}\icons\lyx.ico"
128 !define MUI_UNICON "${PRODUCT_DIR}\icons\lyx.ico"
129 !define MUI_WELCOMEFINISHPAGE_BITMAP "${VERSION_BITMAP}"
132 !define MUI_WELCOMEPAGE_TEXT "$(WelcomePageText)"
133 !insertmacro MUI_PAGE_WELCOME
136 !insertmacro MUI_PAGE_LICENSE "${PRODUCT_LICENSE_FILE}"
138 # Specify the installation directory.
139 !insertmacro MUI_PAGE_DIRECTORY
141 # Specify LyX's menu language.
142 Page custom SelectMenuLanguage SelectMenuLanguage_LeaveFunction
144 # Define which components to install.
145 !insertmacro MUI_PAGE_COMPONENTS
147 # Specify where to install program shortcuts.
148 !define MUI_STARTMENUPAGE_REGISTRY_ROOT "${PRODUCT_ROOT_KEY}"
149 !define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
150 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
151 !define MUI_STARTMENUPAGE_DEFAULTFOLDER "LyX ${PRODUCT_VERSION}"
152 !insertmacro MUI_PAGE_STARTMENU ${PRODUCT_NAME} $StartmenuFolder
154 # Select latex.exe manually
155 Page custom LatexFolder LatexFolder_LeaveFunction
157 # Check for needed programs
158 Page custom MissingProgramsPage MissingProgramsPage_LeaveFunction
160 # Watch the components being installed.
161 !insertmacro MUI_PAGE_INSTFILES
164 !define MUI_FINISHPAGE_RUN
165 !define MUI_FINISHPAGE_TEXT "$(FinishPageMessage)"
166 !define MUI_FINISHPAGE_RUN_TEXT "$(FinishPageRun)"
167 !define MUI_FINISHPAGE_RUN_FUNCTION "LaunchProduct"
168 !insertmacro MUI_PAGE_FINISH
171 !insertmacro MUI_UNPAGE_COMPONENTS
172 !insertmacro MUI_UNPAGE_INSTFILES
174 #--------------------------------
177 !insertmacro MUI_LANGUAGE "English" # first language is the default language
178 !insertmacro MUI_LANGUAGE "Danish"
179 !insertmacro MUI_LANGUAGE "Dutch"
180 !insertmacro MUI_LANGUAGE "French"
181 !insertmacro MUI_LANGUAGE "German"
182 !insertmacro MUI_LANGUAGE "Galician"
183 !insertmacro MUI_LANGUAGE "Hungarian"
184 !insertmacro MUI_LANGUAGE "Italian"
185 !insertmacro MUI_LANGUAGE "Norwegian"
186 !insertmacro MUI_LANGUAGE "Polish"
187 !insertmacro MUI_LANGUAGE "Portuguese"
188 !insertmacro MUI_LANGUAGE "Slovak"
189 !insertmacro MUI_LANGUAGE "Spanish"
190 !insertmacro MUI_LANGUAGE "Swedish"
191 !insertmacro MUI_LANGUAGE "Turkish"
193 !include "lyx_languages\english.nsh"
194 !include "lyx_languages\danish.nsh"
195 !include "lyx_languages\dutch.nsh"
196 !include "lyx_languages\french.nsh"
197 !include "lyx_languages\german.nsh"
198 !include "lyx_languages\galician.nsh"
199 !include "lyx_languages\hungarian.nsh"
200 !include "lyx_languages\italian.nsh"
201 !include "lyx_languages\norwegian.nsh"
202 !include "lyx_languages\polish.nsh"
203 !include "lyx_languages\portuguese.nsh"
204 !include "lyx_languages\slovak.nsh"
205 !include "lyx_languages\spanish.nsh"
206 !include "lyx_languages\swedish.nsh"
207 !include "lyx_languages\turkish.nsh"
209 LicenseData "$(LyXLicenseData)"
211 #--------------------------------
214 # These files are inserted before other files in the data block
215 !insertmacro MUI_RESERVEFILE_LANGDLL
216 ReserveFile "io_ui_language.ini"
217 !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
219 #--------------------------------
222 Section "!${PRODUCT_NAME}" SecCore
225 Section "$(SecAllUsersTitle)" SecAllUsers
226 SetShellVarContext all
227 StrCpy $ProductRootKey "HKLM"
229 Section "$(SecFileAssocTitle)" SecFileAssoc
230 StrCpy $CreateFileAssociations "true"
232 Section "$(SecDesktopTitle)" SecDesktop
233 StrCpy $CreateDesktopIcon "true"
236 # Section descriptions
237 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
238 !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} "$(SecCoreDescription)"
239 !insertmacro MUI_DESCRIPTION_TEXT ${SecAllUsers} "$(SecAllUsersDescription)"
240 !insertmacro MUI_DESCRIPTION_TEXT ${SecFileAssoc} "$(SecFileAssocDescription)"
241 !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} "$(SecDesktopDescription)"
242 !insertmacro MUI_FUNCTION_DESCRIPTION_END
244 # the installation section
245 !include "InstallActions-small.nsh"
247 #--------------------------------
248 # This hook function is called internally by NSIS on installer startup
251 # set the installer language to the Windows locale language
252 System::Call "kernel32::GetUserDefaultLangID()i.a"
254 # check that the installer is not currently running
255 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "${INSTALLER_EXE}.Instance") i .r1 ?e'
258 MessageBox MB_OK|MB_ICONSTOP "$(InstallRunning)"
261 FindProcDLL::FindProc "${INSTALLER2_EXE}"
263 MessageBox MB_OK|MB_ICONSTOP "$(InstallRunning)"
267 # check if LyX is already installed
268 ReadRegStr $0 HKLM "${PRODUCT_UNINST_KEY}" "Publisher"
270 MessageBox MB_OK|MB_ICONSTOP "$(StillInstalled)"
275 # these can be reset to "all" in section SecAllUsers
276 SetShellVarContext current
277 StrCpy $ProductRootKey "HKCU"
279 # this can be reset to "true" in section SecDesktop
280 StrCpy $CreateDesktopIcon "false"
281 StrCpy $CreateFileAssociations "false"
283 # if the user does *not* have administrator privileges, abort
286 !insertmacro IsUserAdmin $Answer $UserName # macro from LyXUtils.nsh
287 ${if} $Answer == "yes"
288 !define ENABLE 0x00000001
289 SectionGetFlags ${SecAllUsers} $0
290 IntOp $0 $0 | ${ENABLE}
291 SectionSetFlags ${SecAllUsers} $0
294 MessageBox MB_OK|MB_ICONSTOP "$(NotAdmin)"
298 # check the LaTeX-system
299 Call LaTeXActions # Function from LaTeX.nsh
301 # check which programs are installed or not
302 Call MissingPrograms # function from MissingPrograms.nsh
304 # used later in the function LatexFolder
310 #--------------------------------
312 Function LaunchProduct
316 #--------------------------------
319 !include "Uninstall.nsh"