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
68 Var CreateFileAssociations
87 #--------------------------------
88 # load some NSIS libraries
90 !include "LogicLib.nsh"
91 !include "FileFunc.nsh"
92 !include "StrFunc.nsh"
94 # Set of various macros and functions
95 !include "LyXUtils.nsh"
97 # Functions to check and configure the LaTeX-system
100 # Function to check if needed programs are missing or not
101 !include "MissingPrograms.nsh"
103 # Function for page to manually select LaTeX's installation folder
104 !include "LaTeXFolder.nsh"
106 # Functions for page to set installer language
107 # and LyX's menu language
108 !include "LanguageSettings.nsh"
110 # Function to configure LyX
111 !include "ConfigLyX.nsh"
113 # Function for page to install Aspell dictionaries
114 !include "Aspell.nsh"
116 #--------------------------------
117 # Remember the installer language
118 !define MUI_LANGDLL_REGISTRY_ROOT "HKCU"
119 !define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
120 !define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
122 !define MUI_ABORTWARNING
123 !define MUI_HEADERIMAGE
124 !define MUI_HEADERIMAGE_BITMAP "${PRODUCT_DIR}\icons\lyx_logo_hi.bmp"
125 !define MUI_ICON "${PRODUCT_DIR}\icons\lyx.ico"
126 !define MUI_UNICON "${PRODUCT_DIR}\icons\lyx.ico"
127 !define MUI_WELCOMEFINISHPAGE_BITMAP "${VERSION_BITMAP}"
130 !define MUI_WELCOMEPAGE_TEXT "$(WelcomePageText)"
131 !insertmacro MUI_PAGE_WELCOME
134 !insertmacro MUI_PAGE_LICENSE "${PRODUCT_LICENSE_FILE}"
136 # Specify the installation directory.
137 !insertmacro MUI_PAGE_DIRECTORY
139 # Specify LyX's menu language.
140 Page custom SelectMenuLanguage SelectMenuLanguage_LeaveFunction
142 # Define which components to install.
143 !insertmacro MUI_PAGE_COMPONENTS
145 # Specify where to install program shortcuts.
146 !define MUI_STARTMENUPAGE_REGISTRY_ROOT "${PRODUCT_ROOT_KEY}"
147 !define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
148 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
149 !define MUI_STARTMENUPAGE_DEFAULTFOLDER "LyX ${PRODUCT_VERSION}"
150 !insertmacro MUI_PAGE_STARTMENU ${PRODUCT_NAME} $StartmenuFolder
152 # Select latex.exe manually
153 Page custom LatexFolder LatexFolder_LeaveFunction
155 # Check for needed programs
156 Page custom MissingProgramsPage MissingProgramsPage_LeaveFunction
158 # Watch the components being installed.
159 !insertmacro MUI_PAGE_INSTFILES
162 !define MUI_FINISHPAGE_RUN
163 !define MUI_FINISHPAGE_TEXT "$(FinishPageMessage)"
164 !define MUI_FINISHPAGE_RUN_TEXT "$(FinishPageRun)"
165 !define MUI_FINISHPAGE_RUN_FUNCTION "LaunchProduct"
166 !insertmacro MUI_PAGE_FINISH
169 !insertmacro MUI_UNPAGE_COMPONENTS
170 !insertmacro MUI_UNPAGE_INSTFILES
172 #--------------------------------
175 !insertmacro MUI_LANGUAGE "English" # first language is the default language
176 !insertmacro MUI_LANGUAGE "Danish"
177 !insertmacro MUI_LANGUAGE "Dutch"
178 !insertmacro MUI_LANGUAGE "French"
179 !insertmacro MUI_LANGUAGE "German"
180 !insertmacro MUI_LANGUAGE "Galician"
181 !insertmacro MUI_LANGUAGE "Hungarian"
182 !insertmacro MUI_LANGUAGE "Italian"
183 !insertmacro MUI_LANGUAGE "Norwegian"
184 !insertmacro MUI_LANGUAGE "Polish"
185 !insertmacro MUI_LANGUAGE "Portuguese"
186 !insertmacro MUI_LANGUAGE "Slovak"
187 !insertmacro MUI_LANGUAGE "Spanish"
188 !insertmacro MUI_LANGUAGE "Swedish"
189 !insertmacro MUI_LANGUAGE "Turkish"
191 !include "lyx_languages\english.nsh"
192 !include "lyx_languages\danish.nsh"
193 !include "lyx_languages\dutch.nsh"
194 !include "lyx_languages\french.nsh"
195 !include "lyx_languages\german.nsh"
196 !include "lyx_languages\galician.nsh"
197 !include "lyx_languages\hungarian.nsh"
198 !include "lyx_languages\italian.nsh"
199 !include "lyx_languages\norwegian.nsh"
200 !include "lyx_languages\polish.nsh"
201 !include "lyx_languages\portuguese.nsh"
202 !include "lyx_languages\slovak.nsh"
203 !include "lyx_languages\spanish.nsh"
204 !include "lyx_languages\swedish.nsh"
205 !include "lyx_languages\turkish.nsh"
207 LicenseData "$(LyXLicenseData)"
209 #--------------------------------
212 # These files are inserted before other files in the data block
213 !insertmacro MUI_RESERVEFILE_LANGDLL
214 ReserveFile "io_ui_language.ini"
215 !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
217 #--------------------------------
220 Section "!${PRODUCT_NAME}" SecCore
223 Section "$(SecAllUsersTitle)" SecAllUsers
224 SetShellVarContext all
225 StrCpy $ProductRootKey "HKLM"
227 Section "$(SecFileAssocTitle)" SecFileAssoc
228 StrCpy $CreateFileAssociations "true"
230 Section "$(SecDesktopTitle)" SecDesktop
231 StrCpy $CreateDesktopIcon "true"
234 # Section descriptions
235 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
236 !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} "$(SecCoreDescription)"
237 !insertmacro MUI_DESCRIPTION_TEXT ${SecAllUsers} "$(SecAllUsersDescription)"
238 !insertmacro MUI_DESCRIPTION_TEXT ${SecFileAssoc} "$(SecFileAssocDescription)"
239 !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} "$(SecDesktopDescription)"
240 !insertmacro MUI_FUNCTION_DESCRIPTION_END
242 # the installation section
243 !include "InstallActions-small.nsh"
245 #--------------------------------
246 # This hook function is called internally by NSIS on installer startup
249 # set the installer language to the Windows locale language
250 System::Call "kernel32::GetUserDefaultLangID()i.a"
252 # check that the installer is not currently running
253 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "${INSTALLER_EXE}.Instance") i .r1 ?e'
256 MessageBox MB_OK|MB_ICONSTOP "$(InstallRunning)"
259 FindProcDLL::FindProc "${INSTALLER2_EXE}"
261 MessageBox MB_OK|MB_ICONSTOP "$(InstallRunning)"
265 # check if LyX is already installed
266 ReadRegStr $0 HKLM "${PRODUCT_UNINST_KEY}" "Publisher"
268 MessageBox MB_OK|MB_ICONSTOP "$(StillInstalled)"
273 # these can be reset to "all" in section SecAllUsers
274 SetShellVarContext current
275 StrCpy $ProductRootKey "HKCU"
277 # this can be reset to "true" in section SecDesktop
278 StrCpy $CreateDesktopIcon "false"
279 StrCpy $CreateFileAssociations "false"
281 # if the user does *not* have administrator privileges, abort
284 !insertmacro IsUserAdmin $Answer $UserName # macro from LyXUtils.nsh
285 ${if} $Answer == "yes"
286 !define ENABLE 0x00000001
287 SectionGetFlags ${SecAllUsers} $0
288 IntOp $0 $0 | ${ENABLE}
289 SectionSetFlags ${SecAllUsers} $0
292 MessageBox MB_OK|MB_ICONSTOP "$(NotAdmin)"
296 # check the LaTeX-system
297 Call LaTeXActions # Function from LaTeX.nsh
299 # check which programs are installed or not
300 Call MissingPrograms # function from MissingPrograms.nsh
302 # used later in the function LatexFolder
308 #--------------------------------
310 Function LaunchProduct
314 #--------------------------------
317 !include "Uninstall.nsh"