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
63 # Variables used by all installer versions
64 !include "Variables.nsh"
66 #--------------------------------
67 # load some NSIS libraries
69 !include "LogicLib.nsh"
70 !include "FileFunc.nsh"
71 !include "StrFunc.nsh"
72 !include "TextFunc.nsh"
75 # Set of various macros and functions
76 !include "LyXUtils.nsh"
78 # Functions to check and configure the LaTeX-system
81 # Function to check if needed programs are missing or not
82 !include "MissingPrograms.nsh"
84 # Functions for page to set installer language
85 # and LyX's menu language
86 !include "LanguageSettings.nsh"
88 # Function to configure LyX
89 !include "ConfigLyX.nsh"
91 # Functions to configure needed third-party programs
92 !include "InstallThirdPartyProgs.nsh"
94 # Function for page to install Aspell dictionaries
97 #--------------------------------
98 # Remember the installer language
99 !define MUI_LANGDLL_REGISTRY_ROOT "HKCU"
100 !define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
101 !define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
103 !define MUI_ABORTWARNING
104 !define MUI_HEADERIMAGE
105 !define MUI_HEADERIMAGE_BITMAP "${PRODUCT_DIR}\icons\lyx_logo_hi.bmp"
106 !define MUI_ICON "${PRODUCT_DIR}\icons\lyx.ico"
107 !define MUI_UNICON "${PRODUCT_DIR}\icons\lyx.ico"
108 !define MUI_WELCOMEFINISHPAGE_BITMAP "${VERSION_BITMAP}"
111 !define MUI_WELCOMEPAGE_TEXT "$(WelcomePageText)"
112 !insertmacro MUI_PAGE_WELCOME
115 !insertmacro MUI_PAGE_LICENSE "${PRODUCT_LICENSE_FILE}"
117 # Specify the installation directory.
118 !insertmacro MUI_PAGE_DIRECTORY
120 # Specify LyX's menu language.
121 Page custom SelectMenuLanguage SelectMenuLanguage_LeaveFunction
123 # Define which components to install.
124 !insertmacro MUI_PAGE_COMPONENTS
126 # Specify where to install program shortcuts.
127 !define MUI_STARTMENUPAGE_REGISTRY_ROOT "${PRODUCT_ROOT_KEY}"
128 !define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
129 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
130 !define MUI_STARTMENUPAGE_DEFAULTFOLDER "LyX ${PRODUCT_VERSION}"
131 !insertmacro MUI_PAGE_STARTMENU ${PRODUCT_NAME} $StartmenuFolder
133 # Check for needed programs
134 Page custom MissingProgramsPage MissingProgramsPage_LeaveFunction
136 # Watch the components being installed.
137 !insertmacro MUI_PAGE_INSTFILES
140 !define MUI_FINISHPAGE_RUN
141 !define MUI_FINISHPAGE_TEXT "$(FinishPageMessage)"
142 !define MUI_FINISHPAGE_RUN_TEXT "$(FinishPageRun)"
143 !define MUI_FINISHPAGE_RUN_FUNCTION "LaunchProduct"
144 !insertmacro MUI_PAGE_FINISH
147 !insertmacro MUI_UNPAGE_COMPONENTS
148 !insertmacro MUI_UNPAGE_INSTFILES
150 #--------------------------------
151 # List of languages the installers are translated to
153 !include "TranslatedLanguages.nsh"
155 LicenseData "$(LyXLicenseData)"
157 #--------------------------------
160 # These files are inserted before other files in the data block
161 !insertmacro MUI_RESERVEFILE_LANGDLL
162 ReserveFile "io_ui_language.ini"
163 !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
165 #--------------------------------
168 Section "!${PRODUCT_NAME}" SecCore
171 Section "$(SecAllUsersTitle)" SecAllUsers
172 SetShellVarContext all
173 StrCpy $ProductRootKey "HKLM"
175 Section "$(SecFileAssocTitle)" SecFileAssoc
176 StrCpy $CreateFileAssociations "true"
178 Section "$(SecDesktopTitle)" SecDesktop
179 StrCpy $CreateDesktopIcon "true"
181 Section /o "$(SecInstGSviewTitle)" SecInstGSview
183 StrCpy $InstallGSview "true"
185 Section /o "$(SecInstJabRefTitle)" SecInstJabRef
187 StrCpy $InstallJabRef "true"
190 # Section descriptions
191 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
192 !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} "$(SecCoreDescription)"
193 !insertmacro MUI_DESCRIPTION_TEXT ${SecAllUsers} "$(SecAllUsersDescription)"
194 !insertmacro MUI_DESCRIPTION_TEXT ${SecFileAssoc} "$(SecFileAssocDescription)"
195 !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} "$(SecDesktopDescription)"
196 !insertmacro MUI_DESCRIPTION_TEXT ${SecInstGSview} "$(SecInstGSviewDescription)"
197 !insertmacro MUI_DESCRIPTION_TEXT ${SecInstJabRef} "$(SecInstJabRefDescription)"
198 !insertmacro MUI_FUNCTION_DESCRIPTION_END
200 # the installation section
201 !include "InstallActions-complete-small.nsh"
203 #--------------------------------
204 # This hook function is called internally by NSIS on installer startup
207 # set the installer language to the Windows locale language
208 System::Call "kernel32::GetUserDefaultLangID()i.a"
210 # check that the installer is not currently running
211 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "${INSTALLER_EXE}.Instance") i .r1 ?e'
214 MessageBox MB_OK|MB_ICONSTOP "$(InstallRunning)"
217 FindProcDLL::FindProc "${INSTALLER2_EXE}"
219 MessageBox MB_OK|MB_ICONSTOP "$(InstallRunning)"
223 # check if LyX is already installed
224 ReadRegStr $0 HKLM "${PRODUCT_UNINST_KEY}" "Publisher"
226 MessageBox MB_OK|MB_ICONSTOP "$(StillInstalled)"
230 # printer settings, needed to install the Metafile2eps printer
231 !insertmacro PrinterInit # macro from InstallThirdPartyProgs.nsh
234 # these can be reset to "all" in section SecAllUsers
235 SetShellVarContext current
236 StrCpy $ProductRootKey "HKCU"
238 # this can be reset to "true" in section SecDesktop
239 StrCpy $CreateDesktopIcon "false"
240 StrCpy $CreateFileAssociations "false"
242 # if the user does *not* have administrator privileges, abort
245 !insertmacro IsUserAdmin $Answer $UserName # macro from LyXUtils.nsh
246 ${if} $Answer == "yes"
247 !define ENABLE 0x00000001
248 SectionGetFlags ${SecAllUsers} $0
249 IntOp $0 $0 | ${ENABLE}
250 SectionSetFlags ${SecAllUsers} $0
253 MessageBox MB_OK|MB_ICONSTOP "$(NotAdmin)"
257 # check the LaTeX-system
258 Call LaTeXActions # Function from LaTeX.nsh
260 # check which programs are installed or not
261 Call MissingPrograms # function from MissingPrograms.nsh
263 # don't let the installer sections appear when the programs are already installed
265 SectionSetText 4 "" # hides the corresponding uninstaller section, ${SecInstGSview}
267 ${if} $BibTeXEditorPath != ""
268 SectionSetText 5 "" # hides the corresponding uninstaller section, ${SecInstJabRef}
274 #--------------------------------
276 Function LaunchProduct
277 # call the lyx.exe and not the lyxLauncher.exe to show the console window. This is
278 # necessary because sometimes LyX's configure run that is started by the
279 # installer fails when MiKTeX was installed together with this installer.
280 # Showing the console gives the user feedback otherwise he would wonder why
281 # LyX won't start for minutes while it is downloading LaTeX-packages in the
286 #--------------------------------
289 !include "Uninstall.nsh"