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 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.30 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 "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
60 # Variables used by all installer versions
61 !include "Variables.nsh"
63 #--------------------------------
64 # load some NSIS libraries
66 !include "LogicLib.nsh"
67 !include "FileFunc.nsh"
68 !include "StrFunc.nsh"
69 !include "TextFunc.nsh"
72 # Set of various macros and functions
73 !include "LyXUtils.nsh"
75 # Functions to check and configure the LaTeX-system
78 # Function to check if needed programs are missing or not
79 !include "MissingPrograms.nsh"
81 # Function for page to manually select LaTeX's installation folder
82 !include "LaTeXFolder.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 # Function 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 # Select latex.exe manually
134 Page custom LatexFolder LatexFolder_LeaveFunction
136 # Check for needed programs
137 Page custom MissingProgramsPage MissingProgramsPage_LeaveFunction
139 # Watch the components being installed.
140 !insertmacro MUI_PAGE_INSTFILES
143 !define MUI_FINISHPAGE_RUN
144 !define MUI_FINISHPAGE_TEXT "$(FinishPageMessage)"
145 !define MUI_FINISHPAGE_RUN_TEXT "$(FinishPageRun)"
146 !define MUI_FINISHPAGE_RUN_FUNCTION "LaunchProduct"
147 !insertmacro MUI_PAGE_FINISH
150 !insertmacro MUI_UNPAGE_COMPONENTS
151 !insertmacro MUI_UNPAGE_INSTFILES
153 #--------------------------------
154 # List of languages the installers are translated to
156 !include "TranslatedLanguages.nsh"
158 LicenseData "$(LyXLicenseData)"
160 #--------------------------------
163 # These files are inserted before other files in the data block
164 !insertmacro MUI_RESERVEFILE_LANGDLL
165 ReserveFile "io_ui_language.ini"
166 !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
168 #--------------------------------
171 Section "!${PRODUCT_NAME}" SecCore
174 Section "$(SecAllUsersTitle)" SecAllUsers
175 SetShellVarContext all
176 StrCpy $ProductRootKey "HKLM"
178 Section "$(SecFileAssocTitle)" SecFileAssoc
179 StrCpy $CreateFileAssociations "true"
181 Section "$(SecDesktopTitle)" SecDesktop
182 StrCpy $CreateDesktopIcon "true"
185 # Section descriptions
186 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
187 !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} "$(SecCoreDescription)"
188 !insertmacro MUI_DESCRIPTION_TEXT ${SecAllUsers} "$(SecAllUsersDescription)"
189 !insertmacro MUI_DESCRIPTION_TEXT ${SecFileAssoc} "$(SecFileAssocDescription)"
190 !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} "$(SecDesktopDescription)"
191 !insertmacro MUI_FUNCTION_DESCRIPTION_END
193 # the installation section
194 !include "InstallActions-complete-small.nsh"
196 #--------------------------------
197 # This hook function is called internally by NSIS on installer startup
200 # set the installer language to the Windows locale language
201 System::Call "kernel32::GetUserDefaultLangID()i.a"
203 # check that the installer is not currently running
204 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "${INSTALLER_EXE}.Instance") i .r1 ?e'
207 MessageBox MB_OK|MB_ICONSTOP "$(InstallRunning)"
210 FindProcDLL::FindProc "${INSTALLER2_EXE}"
212 MessageBox MB_OK|MB_ICONSTOP "$(InstallRunning)"
216 # check if LyX is already installed
217 ReadRegStr $0 HKLM "${PRODUCT_UNINST_KEY}" "Publisher"
219 MessageBox MB_OK|MB_ICONSTOP "$(StillInstalled)"
223 # printer settings, needed to install the Metafile2eps printer
224 !insertmacro PrinterInit # macro from InstallThirdPartyProgs.nsh
227 # these can be reset to "all" in section SecAllUsers
228 SetShellVarContext current
229 StrCpy $ProductRootKey "HKCU"
231 # this can be reset to "true" in section SecDesktop
232 StrCpy $CreateDesktopIcon "false"
233 StrCpy $CreateFileAssociations "false"
235 # if the user does *not* have administrator privileges, abort
238 !insertmacro IsUserAdmin $Answer $UserName # macro from LyXUtils.nsh
239 ${if} $Answer == "yes"
240 !define ENABLE 0x00000001
241 SectionGetFlags ${SecAllUsers} $0
242 IntOp $0 $0 | ${ENABLE}
243 SectionSetFlags ${SecAllUsers} $0
246 MessageBox MB_OK|MB_ICONSTOP "$(NotAdmin)"
250 # check the LaTeX-system
251 Call LaTeXActions # Function from LaTeX.nsh
253 # check which programs are installed or not
254 Call MissingPrograms # function from MissingPrograms.nsh
256 # used later in the function LatexFolder
262 #--------------------------------
264 Function LaunchProduct
268 #--------------------------------
271 !include "Uninstall.nsh"