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.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 "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
62 # Variables used by all installer versions
63 !include "Variables.nsh"
65 #--------------------------------
66 # load some NSIS libraries
68 !include "LogicLib.nsh"
69 !include "FileFunc.nsh"
70 !include "StrFunc.nsh"
71 !include "TextFunc.nsh"
74 # Set of various macros and functions
75 !include "LyXUtils.nsh"
77 # Functions to check and configure the LaTeX-system
80 # Function to check if needed programs are missing or not
81 !include "MissingPrograms.nsh"
83 # Function for page to manually select LaTeX's installation folder
84 !include "LaTeXFolder.nsh"
86 # Functions for page to set installer language
87 # and LyX's menu language
88 !include "LanguageSettings.nsh"
90 # Function to configure LyX
91 !include "ConfigLyX.nsh"
93 # Functions to configure needed third-party programs
94 !include "InstallThirdPartyProgs.nsh"
96 # Function for page to install Aspell dictionaries
99 #--------------------------------
100 # Remember the installer language
101 !define MUI_LANGDLL_REGISTRY_ROOT "HKCU"
102 !define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
103 !define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
105 !define MUI_ABORTWARNING
106 !define MUI_HEADERIMAGE
107 !define MUI_HEADERIMAGE_BITMAP "${PRODUCT_DIR}\icons\lyx_logo_hi.bmp"
108 !define MUI_ICON "${PRODUCT_DIR}\icons\lyx.ico"
109 !define MUI_UNICON "${PRODUCT_DIR}\icons\lyx.ico"
110 !define MUI_WELCOMEFINISHPAGE_BITMAP "${VERSION_BITMAP}"
113 !define MUI_WELCOMEPAGE_TEXT "$(WelcomePageText)"
114 !insertmacro MUI_PAGE_WELCOME
117 !insertmacro MUI_PAGE_LICENSE "${PRODUCT_LICENSE_FILE}"
119 # Specify the installation directory.
120 !insertmacro MUI_PAGE_DIRECTORY
122 # Specify LyX's menu language.
123 Page custom SelectMenuLanguage SelectMenuLanguage_LeaveFunction
125 # Define which components to install.
126 !insertmacro MUI_PAGE_COMPONENTS
128 # Specify where to install program shortcuts.
129 !define MUI_STARTMENUPAGE_REGISTRY_ROOT "${PRODUCT_ROOT_KEY}"
130 !define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
131 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
132 !define MUI_STARTMENUPAGE_DEFAULTFOLDER "LyX ${PRODUCT_VERSION}"
133 !insertmacro MUI_PAGE_STARTMENU ${PRODUCT_NAME} $StartmenuFolder
135 # Select latex.exe manually
136 Page custom LatexFolder LatexFolder_LeaveFunction
138 # Check for needed programs
139 Page custom MissingProgramsPage MissingProgramsPage_LeaveFunction
141 # Watch the components being installed.
142 !insertmacro MUI_PAGE_INSTFILES
145 !define MUI_FINISHPAGE_RUN
146 !define MUI_FINISHPAGE_TEXT "$(FinishPageMessage)"
147 !define MUI_FINISHPAGE_RUN_TEXT "$(FinishPageRun)"
148 !define MUI_FINISHPAGE_RUN_FUNCTION "LaunchProduct"
149 !insertmacro MUI_PAGE_FINISH
152 !insertmacro MUI_UNPAGE_COMPONENTS
153 !insertmacro MUI_UNPAGE_INSTFILES
155 #--------------------------------
156 # List of languages the installers are translated to
158 !include "TranslatedLanguages.nsh"
160 LicenseData "$(LyXLicenseData)"
162 #--------------------------------
165 # These files are inserted before other files in the data block
166 !insertmacro MUI_RESERVEFILE_LANGDLL
167 ReserveFile "io_ui_language.ini"
168 !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
170 #--------------------------------
173 Section "!${PRODUCT_NAME}" SecCore
176 Section "$(SecAllUsersTitle)" SecAllUsers
177 SetShellVarContext all
178 StrCpy $ProductRootKey "HKLM"
180 # remove the /o for LyX 2.0 final!
181 Section /o "$(SecFileAssocTitle)" SecFileAssoc
182 StrCpy $CreateFileAssociations "true"
184 Section /o "$(SecDesktopTitle)" SecDesktop
185 StrCpy $CreateDesktopIcon "true"
188 # Section descriptions
189 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
190 !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} "$(SecCoreDescription)"
191 !insertmacro MUI_DESCRIPTION_TEXT ${SecAllUsers} "$(SecAllUsersDescription)"
192 !insertmacro MUI_DESCRIPTION_TEXT ${SecFileAssoc} "$(SecFileAssocDescription)"
193 !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} "$(SecDesktopDescription)"
194 !insertmacro MUI_FUNCTION_DESCRIPTION_END
196 # the installation section
197 !include "InstallActions-complete-small.nsh"
199 #--------------------------------
200 # This hook function is called internally by NSIS on installer startup
203 # set the installer language to the Windows locale language
204 System::Call "kernel32::GetUserDefaultLangID()i.a"
206 # check that the installer is not currently running
207 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "${INSTALLER_EXE}.Instance") i .r1 ?e'
210 MessageBox MB_OK|MB_ICONSTOP "$(InstallRunning)"
213 FindProcDLL::FindProc "${INSTALLER2_EXE}"
215 MessageBox MB_OK|MB_ICONSTOP "$(InstallRunning)"
219 # check if LyX is already installed
220 ReadRegStr $0 HKLM "${PRODUCT_UNINST_KEY}" "Publisher"
222 MessageBox MB_OK|MB_ICONSTOP "$(StillInstalled)"
226 # printer settings, needed to install the Metafile2eps printer
227 !insertmacro PrinterInit # macro from InstallThirdPartyProgs.nsh
230 # these can be reset to "all" in section SecAllUsers
231 SetShellVarContext current
232 StrCpy $ProductRootKey "HKCU"
234 # this can be reset to "true" in section SecDesktop
235 StrCpy $CreateDesktopIcon "false"
236 StrCpy $CreateFileAssociations "false"
238 # if the user does *not* have administrator privileges, abort
241 !insertmacro IsUserAdmin $Answer $UserName # macro from LyXUtils.nsh
242 ${if} $Answer == "yes"
243 !define ENABLE 0x00000001
244 SectionGetFlags ${SecAllUsers} $0
245 IntOp $0 $0 | ${ENABLE}
246 SectionSetFlags ${SecAllUsers} $0
249 MessageBox MB_OK|MB_ICONSTOP "$(NotAdmin)"
253 # check the LaTeX-system
254 Call LaTeXActions # Function from LaTeX.nsh
256 # check which programs are installed or not
257 Call MissingPrograms # function from MissingPrograms.nsh
259 # used later in the function LatexFolder
265 #--------------------------------
267 Function LaunchProduct
271 #--------------------------------
274 !include "Uninstall.nsh"