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
57 # Variables used by all installer versions
58 !include "Variables.nsh"
60 #--------------------------------
61 # load some NSIS libraries
63 !include "LogicLib.nsh"
64 !include "FileFunc.nsh"
65 !include "StrFunc.nsh"
66 !include "TextFunc.nsh"
68 # Set of various macros and functions
69 !include "LyXUtils.nsh"
71 # Functions to check and configure the LaTeX-system
74 # Function to check if needed programs are missing or not
75 !include "MissingPrograms.nsh"
77 # Function for page to manually select LaTeX's installation folder
78 !include "LaTeXFolder.nsh"
80 # Functions for page to set installer language
81 # and LyX's menu language
82 !include "LanguageSettings.nsh"
84 # Function to configure LyX
85 !include "ConfigLyX.nsh"
87 # Function to configure needed third-party programs
88 !include "InstallThirdPartyProgs.nsh"
90 # Function for page to install Aspell dictionaries
93 #--------------------------------
94 # Remember the installer language
95 !define MUI_LANGDLL_REGISTRY_ROOT "HKCU"
96 !define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
97 !define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
99 !define MUI_ABORTWARNING
100 !define MUI_HEADERIMAGE
101 !define MUI_HEADERIMAGE_BITMAP "${PRODUCT_DIR}\icons\lyx_logo_hi.bmp"
102 !define MUI_ICON "${PRODUCT_DIR}\icons\lyx.ico"
103 !define MUI_UNICON "${PRODUCT_DIR}\icons\lyx.ico"
104 !define MUI_WELCOMEFINISHPAGE_BITMAP "${VERSION_BITMAP}"
107 !define MUI_WELCOMEPAGE_TEXT "$(WelcomePageText)"
108 !insertmacro MUI_PAGE_WELCOME
111 !insertmacro MUI_PAGE_LICENSE "${PRODUCT_LICENSE_FILE}"
113 # Specify the installation directory.
114 !insertmacro MUI_PAGE_DIRECTORY
116 # Specify LyX's menu language.
117 Page custom SelectMenuLanguage SelectMenuLanguage_LeaveFunction
119 # Define which components to install.
120 !insertmacro MUI_PAGE_COMPONENTS
122 # Specify where to install program shortcuts.
123 !define MUI_STARTMENUPAGE_REGISTRY_ROOT "${PRODUCT_ROOT_KEY}"
124 !define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
125 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
126 !define MUI_STARTMENUPAGE_DEFAULTFOLDER "LyX ${PRODUCT_VERSION}"
127 !insertmacro MUI_PAGE_STARTMENU ${PRODUCT_NAME} $StartmenuFolder
129 # Select latex.exe manually
130 Page custom LatexFolder LatexFolder_LeaveFunction
132 # Check for needed programs
133 Page custom MissingProgramsPage MissingProgramsPage_LeaveFunction
135 # Watch the components being installed.
136 !insertmacro MUI_PAGE_INSTFILES
139 !define MUI_FINISHPAGE_RUN
140 !define MUI_FINISHPAGE_TEXT "$(FinishPageMessage)"
141 !define MUI_FINISHPAGE_RUN_TEXT "$(FinishPageRun)"
142 !define MUI_FINISHPAGE_RUN_FUNCTION "LaunchProduct"
143 !insertmacro MUI_PAGE_FINISH
146 !insertmacro MUI_UNPAGE_COMPONENTS
147 !insertmacro MUI_UNPAGE_INSTFILES
149 #--------------------------------
150 # List of languages the installers are translated to
152 !include "TranslatedLanguages.nsh"
154 LicenseData "$(LyXLicenseData)"
156 #--------------------------------
159 # These files are inserted before other files in the data block
160 !insertmacro MUI_RESERVEFILE_LANGDLL
161 ReserveFile "io_ui_language.ini"
162 !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
164 #--------------------------------
167 Section "!${PRODUCT_NAME}" SecCore
170 Section "$(SecAllUsersTitle)" SecAllUsers
171 SetShellVarContext all
172 StrCpy $ProductRootKey "HKLM"
174 Section "$(SecFileAssocTitle)" SecFileAssoc
175 StrCpy $CreateFileAssociations "true"
177 Section "$(SecDesktopTitle)" SecDesktop
178 StrCpy $CreateDesktopIcon "true"
181 # Section descriptions
182 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
183 !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} "$(SecCoreDescription)"
184 !insertmacro MUI_DESCRIPTION_TEXT ${SecAllUsers} "$(SecAllUsersDescription)"
185 !insertmacro MUI_DESCRIPTION_TEXT ${SecFileAssoc} "$(SecFileAssocDescription)"
186 !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} "$(SecDesktopDescription)"
187 !insertmacro MUI_FUNCTION_DESCRIPTION_END
189 # the installation section
190 !include "InstallActions-complete-small.nsh"
192 #--------------------------------
193 # This hook function is called internally by NSIS on installer startup
196 # set the installer language to the Windows locale language
197 System::Call "kernel32::GetUserDefaultLangID()i.a"
199 # check that the installer is not currently running
200 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "${INSTALLER_EXE}.Instance") i .r1 ?e'
203 MessageBox MB_OK|MB_ICONSTOP "$(InstallRunning)"
206 FindProcDLL::FindProc "${INSTALLER2_EXE}"
208 MessageBox MB_OK|MB_ICONSTOP "$(InstallRunning)"
212 # check if LyX is already installed
213 ReadRegStr $0 HKLM "${PRODUCT_UNINST_KEY}" "Publisher"
215 MessageBox MB_OK|MB_ICONSTOP "$(StillInstalled)"
220 # these can be reset to "all" in section SecAllUsers
221 SetShellVarContext current
222 StrCpy $ProductRootKey "HKCU"
224 # this can be reset to "true" in section SecDesktop
225 StrCpy $CreateDesktopIcon "false"
226 StrCpy $CreateFileAssociations "false"
228 # if the user does *not* have administrator privileges, abort
231 !insertmacro IsUserAdmin $Answer $UserName # macro from LyXUtils.nsh
232 ${if} $Answer == "yes"
233 !define ENABLE 0x00000001
234 SectionGetFlags ${SecAllUsers} $0
235 IntOp $0 $0 | ${ENABLE}
236 SectionSetFlags ${SecAllUsers} $0
239 MessageBox MB_OK|MB_ICONSTOP "$(NotAdmin)"
243 # check the LaTeX-system
244 Call LaTeXActions # Function from LaTeX.nsh
246 # check which programs are installed or not
247 Call MissingPrograms # function from MissingPrograms.nsh
249 # used later in the function LatexFolder
255 #--------------------------------
257 Function LaunchProduct
261 #--------------------------------
264 !include "Uninstall.nsh"