1 # Lyx for Windows, NSIS v2 series installer script
3 # File LyXInstaller-complete.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 ideas of 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.45 or 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 "Complete"
28 !define INSTALLER2_VERSION "Small"
29 !define INSTALLER3_VERSION "Update"
30 !define INSTALLER_TYPE "NotUpdate"
33 !include "Settings.nsh"
35 #--------------------------------
36 # variables only used in this installer version
64 # Variables used by all installer versions
65 !include "Variables.nsh"
67 #--------------------------------
68 # load some NSIS libraries
70 !include "LogicLib.nsh"
71 !include "FileFunc.nsh"
72 !include "StrFunc.nsh"
73 !include "TextFunc.nsh"
76 # Set of various macros and functions
77 !include "LyXUtils.nsh"
79 # Functions to check and configure the LaTeX-system
82 # Function to check if needed programs are missing or not
83 !include "MissingPrograms.nsh"
85 # Functions for page to set installer language
86 # and LyX's menu language
87 !include "LanguageSettings.nsh"
89 # Function to configure LyX
90 !include "ConfigLyX.nsh"
92 # Functions to configure needed third-party programs
93 !include "InstallThirdPartyProgs.nsh"
95 # Function for page to install Aspell dictionaries
98 #--------------------------------
99 # Remember the installer language
100 !define MUI_LANGDLL_REGISTRY_ROOT "HKCU"
101 !define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
102 !define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
104 !define MUI_ABORTWARNING
105 !define MUI_HEADERIMAGE
106 !define MUI_HEADERIMAGE_BITMAP "${PRODUCT_DIR}\icons\lyx_logo_hi.bmp"
107 !define MUI_ICON "${PRODUCT_DIR}\icons\lyx.ico"
108 !define MUI_UNICON "${PRODUCT_DIR}\icons\lyx.ico"
109 !define MUI_WELCOMEFINISHPAGE_BITMAP "${VERSION_BITMAP}"
112 !define MUI_WELCOMEPAGE_TEXT "$(WelcomePageText)"
113 !insertmacro MUI_PAGE_WELCOME
116 !insertmacro MUI_PAGE_LICENSE "${PRODUCT_LICENSE_FILE}"
118 # Specify the installation directory.
119 !insertmacro MUI_PAGE_DIRECTORY
121 # Specify LyX's menu language.
122 Page custom SelectMenuLanguage SelectMenuLanguage_LeaveFunction
124 # Define which components to install.
125 !insertmacro MUI_PAGE_COMPONENTS
127 # Specify where to install program shortcuts.
128 !define MUI_STARTMENUPAGE_REGISTRY_ROOT "${PRODUCT_ROOT_KEY}"
129 !define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
130 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
131 !define MUI_STARTMENUPAGE_DEFAULTFOLDER "LyX ${PRODUCT_VERSION}"
132 !insertmacro MUI_PAGE_STARTMENU ${PRODUCT_NAME} $StartmenuFolder
134 # Check for needed programs
135 Page custom MissingProgramsPage MissingProgramsPage_LeaveFunction
137 # Watch the components being installed.
138 !insertmacro MUI_PAGE_INSTFILES
141 !define MUI_FINISHPAGE_RUN
142 !define MUI_FINISHPAGE_TEXT "$(FinishPageMessage)"
143 !define MUI_FINISHPAGE_RUN_TEXT "$(FinishPageRun)"
144 !define MUI_FINISHPAGE_RUN_FUNCTION "LaunchProduct"
145 !insertmacro MUI_PAGE_FINISH
148 !insertmacro MUI_UNPAGE_COMPONENTS
149 !insertmacro MUI_UNPAGE_INSTFILES
151 #--------------------------------
152 # List of languages the installers are translated to
154 !include "TranslatedLanguages.nsh"
156 LicenseData "$(LyXLicenseData)"
158 #--------------------------------
161 # These files are inserted before other files in the data block
162 !insertmacro MUI_RESERVEFILE_LANGDLL
163 ReserveFile "io_ui_language.ini"
164 !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
166 #--------------------------------
169 Section "!${PRODUCT_NAME}" SecCore
172 Section "$(SecAllUsersTitle)" SecAllUsers
173 SetShellVarContext all
174 StrCpy $ProductRootKey "HKLM"
176 Section "$(SecFileAssocTitle)" SecFileAssoc
177 StrCpy $CreateFileAssociations "true"
179 Section "$(SecDesktopTitle)" SecDesktop
180 StrCpy $CreateDesktopIcon "true"
182 Section /o "$(SecInstGSviewTitle)" SecInstGSview
184 StrCpy $InstallGSview "true"
186 Section /o "$(SecInstJabRefTitle)" SecInstJabRef
188 StrCpy $InstallJabRef "true"
191 # Section descriptions
192 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
193 !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} "$(SecCoreDescription)"
194 !insertmacro MUI_DESCRIPTION_TEXT ${SecAllUsers} "$(SecAllUsersDescription)"
195 !insertmacro MUI_DESCRIPTION_TEXT ${SecFileAssoc} "$(SecFileAssocDescription)"
196 !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} "$(SecDesktopDescription)"
197 !insertmacro MUI_DESCRIPTION_TEXT ${SecInstGSview} "$(SecInstGSviewDescription)"
198 !insertmacro MUI_DESCRIPTION_TEXT ${SecInstJabRef} "$(SecInstJabRefDescription)"
199 !insertmacro MUI_FUNCTION_DESCRIPTION_END
201 # the installation section
202 !include "InstallActions-complete-small.nsh"
204 #--------------------------------
205 # This hook function is called internally by NSIS on installer startup
208 # set the installer language to the Windows locale language
209 System::Call "kernel32::GetUserDefaultLangID()i.a"
211 # check that the installer is not currently running
212 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "${INSTALLER_EXE}.Instance") i .r1 ?e'
215 MessageBox MB_OK|MB_ICONSTOP "$(InstallRunning)"
218 FindProcDLL::FindProc "${INSTALLER2_EXE}"
220 MessageBox MB_OK|MB_ICONSTOP "$(InstallRunning)"
224 # check if LyX is already installed
225 ReadRegStr $0 HKLM "${PRODUCT_UNINST_KEY}" "Publisher"
227 MessageBox MB_OK|MB_ICONSTOP "$(StillInstalled)"
231 # printer settings, needed to install the Metafile2eps printer
232 !insertmacro PrinterInit # macro from InstallThirdPartyProgs.nsh
235 # these can be reset to "all" in section SecAllUsers
236 SetShellVarContext current
237 StrCpy $ProductRootKey "HKCU"
239 # this can be reset to "true" in section SecDesktop
240 StrCpy $CreateDesktopIcon "false"
241 StrCpy $CreateFileAssociations "false"
243 # if the user does *not* have administrator privileges, abort
246 !insertmacro IsUserAdmin $Answer $UserName # macro from LyXUtils.nsh
247 ${if} $Answer == "yes"
248 !define ENABLE 0x00000001
249 SectionGetFlags ${SecAllUsers} $0
250 IntOp $0 $0 | ${ENABLE}
251 SectionSetFlags ${SecAllUsers} $0
254 MessageBox MB_OK|MB_ICONSTOP "$(NotAdmin)"
258 # check the LaTeX-system
259 Call LaTeXActions # Function from LaTeX.nsh
261 # check which programs are installed or not
262 Call MissingPrograms # function from MissingPrograms.nsh
264 # don't let the installer sections appear when the programs are already installed
266 SectionSetText 4 "" # hides the corresponding uninstaller section, ${SecInstGSview}
268 ${if} $BibTeXEditorPath != ""
269 SectionSetText 5 "" # hides the corresponding uninstaller section, ${SecInstJabRef}
275 #--------------------------------
277 Function LaunchProduct
278 # call the lyx.exe and not the lyxLauncher.exe to show the console window. This is
279 # necessary because sometimes LyX's configure run that is started by the
280 # installer fails when MiKTeX was installed together with this installer.
281 # Showing the console gives the user feedback otherwise he would wonder why
282 # LyX won't start for minutes while it is downloading LaTeX-packages in the
287 #--------------------------------
290 !include "Uninstall.nsh"