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
61 # Variables used by all installer versions
62 !include "Variables.nsh"
64 #--------------------------------
65 # load some NSIS libraries
67 !include "LogicLib.nsh"
68 !include "FileFunc.nsh"
69 !include "StrFunc.nsh"
70 !include "TextFunc.nsh"
73 # Set of various macros and functions
74 !include "LyXUtils.nsh"
76 # Functions to check and configure the LaTeX-system
79 # Function to check if needed programs are missing or not
80 !include "MissingPrograms.nsh"
82 # Function for page to manually select LaTeX's installation folder
83 !include "LaTeXFolder.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 # Select latex.exe manually
135 Page custom LatexFolder LatexFolder_LeaveFunction
137 # Check for needed programs
138 Page custom MissingProgramsPage MissingProgramsPage_LeaveFunction
140 # Watch the components being installed.
141 !insertmacro MUI_PAGE_INSTFILES
144 !define MUI_FINISHPAGE_RUN
145 !define MUI_FINISHPAGE_TEXT "$(FinishPageMessage)"
146 !define MUI_FINISHPAGE_RUN_TEXT "$(FinishPageRun)"
147 !define MUI_FINISHPAGE_RUN_FUNCTION "LaunchProduct"
148 !insertmacro MUI_PAGE_FINISH
151 !insertmacro MUI_UNPAGE_COMPONENTS
152 !insertmacro MUI_UNPAGE_INSTFILES
154 #--------------------------------
155 # List of languages the installers are translated to
157 !include "TranslatedLanguages.nsh"
159 LicenseData "$(LyXLicenseData)"
161 #--------------------------------
164 # These files are inserted before other files in the data block
165 !insertmacro MUI_RESERVEFILE_LANGDLL
166 ReserveFile "io_ui_language.ini"
167 !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
169 #--------------------------------
172 Section "!${PRODUCT_NAME}" SecCore
175 Section "$(SecAllUsersTitle)" SecAllUsers
176 SetShellVarContext all
177 StrCpy $ProductRootKey "HKLM"
179 Section "$(SecFileAssocTitle)" SecFileAssoc
180 StrCpy $CreateFileAssociations "true"
182 Section "$(SecDesktopTitle)" SecDesktop
183 StrCpy $CreateDesktopIcon "true"
186 # Section descriptions
187 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
188 !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} "$(SecCoreDescription)"
189 !insertmacro MUI_DESCRIPTION_TEXT ${SecAllUsers} "$(SecAllUsersDescription)"
190 !insertmacro MUI_DESCRIPTION_TEXT ${SecFileAssoc} "$(SecFileAssocDescription)"
191 !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} "$(SecDesktopDescription)"
192 !insertmacro MUI_FUNCTION_DESCRIPTION_END
194 # the installation section
195 !include "InstallActions-complete-small.nsh"
197 #--------------------------------
198 # This hook function is called internally by NSIS on installer startup
201 # set the installer language to the Windows locale language
202 System::Call "kernel32::GetUserDefaultLangID()i.a"
204 # check that the installer is not currently running
205 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "${INSTALLER_EXE}.Instance") i .r1 ?e'
208 MessageBox MB_OK|MB_ICONSTOP "$(InstallRunning)"
211 FindProcDLL::FindProc "${INSTALLER2_EXE}"
213 MessageBox MB_OK|MB_ICONSTOP "$(InstallRunning)"
217 # check if LyX is already installed
218 ReadRegStr $0 HKLM "${PRODUCT_UNINST_KEY}" "Publisher"
220 MessageBox MB_OK|MB_ICONSTOP "$(StillInstalled)"
224 # printer settings, needed to install the Metafile2eps printer
225 !insertmacro PrinterInit # macro from InstallThirdPartyProgs.nsh
228 # these can be reset to "all" in section SecAllUsers
229 SetShellVarContext current
230 StrCpy $ProductRootKey "HKCU"
232 # this can be reset to "true" in section SecDesktop
233 StrCpy $CreateDesktopIcon "false"
234 StrCpy $CreateFileAssociations "false"
236 # if the user does *not* have administrator privileges, abort
239 !insertmacro IsUserAdmin $Answer $UserName # macro from LyXUtils.nsh
240 ${if} $Answer == "yes"
241 !define ENABLE 0x00000001
242 SectionGetFlags ${SecAllUsers} $0
243 IntOp $0 $0 | ${ENABLE}
244 SectionSetFlags ${SecAllUsers} $0
247 MessageBox MB_OK|MB_ICONSTOP "$(NotAdmin)"
251 # check the LaTeX-system
252 Call LaTeXActions # Function from LaTeX.nsh
254 # check which programs are installed or not
255 Call MissingPrograms # function from MissingPrograms.nsh
257 # used later in the function LatexFolder
263 #--------------------------------
265 Function LaunchProduct
269 #--------------------------------
272 !include "Uninstall.nsh"