]> git.lyx.org Git - lyx.git/blob - development/Win32/packaging/AltInstaller/LyXInstaller-small.nsi
installer:
[lyx.git] / development / Win32 / packaging / AltInstaller / LyXInstaller-small.nsi
1 # Lyx for Windows, NSIS v2 series installer script
2
3 # File LyXInstaller-small.nsi
4 # This file is part of LyX, the document processor.
5 # http://www.lyx.org/
6 # Licence details can be found in the file COPYING or copy at
7 # http://www.lyx.org/about/license.php3
8
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
12
13 # This script requires NSIS 2.30 or newer
14 # http://nsis.sourceforge.net/
15 #--------------------------------
16
17 # Do a Cyclic Redundancy Check to make sure the installer
18 # was not corrupted by the download.
19 CRCCheck force
20
21 # Make the installer as small as possible.
22 #SetCompressor lzma
23
24 #--------------------------------
25 # You should need to change only these macros...
26
27 !define INSTALLER_VERSION "Small"
28 !define INSTALLER2_VERSION "Complete"
29 !define INSTALLER3_VERSION "Update"
30 !define INSTALLER_TYPE "NotUpdate"
31
32 # load the settings
33 !include "Settings.nsh"
34
35 #--------------------------------
36 # variables only used in this installer version
37
38 Var DelPythonFiles
39 Var GhostscriptPath
40 Var AiksaurusPath
41 Var AspellPath
42 Var Acrobat
43 Var PSVPath
44 Var DelGSDir
45 Var EditorPath
46 Var ImageEditorPath
47 Var BibTeXEditorPath
48 Var LangEncoding
49 Var LangSysEncoding
50 Var MissedProg
51 Var LaTeXName
52 Var MiKTeXVersion
53 Var MiKTeXUser
54 Var State
55 Var SVGPath
56 # Variables used by all installer versions
57 !include "Variables.nsh"
58
59 #--------------------------------
60 # load some NSIS libraries
61 !include "MUI.nsh"
62 !include "LogicLib.nsh"
63 !include "FileFunc.nsh"
64 !include "StrFunc.nsh"
65 !include "TextFunc.nsh"
66 !insertmacro LineFind
67
68 # Set of various macros and functions
69 !include "LyXUtils.nsh"
70
71 # Functions to check and configure the LaTeX-system
72 !include "LaTeX.nsh"
73
74 # Function to check if needed programs are missing or not
75 !include "MissingPrograms.nsh"
76
77 # Function for page to manually select LaTeX's installation folder
78 !include "LaTeXFolder.nsh"
79
80 # Functions for page to set installer language
81 # and LyX's menu language
82 !include "LanguageSettings.nsh"
83
84 # Function to configure LyX
85 !include "ConfigLyX.nsh"
86
87 # Function to configure needed third-party programs
88 !include "InstallThirdPartyProgs.nsh"
89
90 # Function for page to install Aspell dictionaries
91 !include "Aspell.nsh"
92
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"
98
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}"
105
106 # Welcome page
107 !define MUI_WELCOMEPAGE_TEXT "$(WelcomePageText)"
108 !insertmacro MUI_PAGE_WELCOME
109
110 # Show the license.
111 !insertmacro MUI_PAGE_LICENSE "${PRODUCT_LICENSE_FILE}"
112
113 # Specify the installation directory.
114 !insertmacro MUI_PAGE_DIRECTORY
115
116 # Specify LyX's menu language.
117 Page custom SelectMenuLanguage SelectMenuLanguage_LeaveFunction
118
119 # Define which components to install.
120 !insertmacro MUI_PAGE_COMPONENTS
121
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
128
129 # Select latex.exe manually
130 Page custom LatexFolder LatexFolder_LeaveFunction
131
132 # Check for needed programs
133 Page custom MissingProgramsPage MissingProgramsPage_LeaveFunction
134
135 # Watch the components being installed.
136 !insertmacro MUI_PAGE_INSTFILES
137
138 # Finish page
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
144
145 # The uninstaller.
146 !insertmacro MUI_UNPAGE_COMPONENTS
147 !insertmacro MUI_UNPAGE_INSTFILES
148
149 #--------------------------------
150 # Languages
151
152 !insertmacro MUI_LANGUAGE "English" # first language is the default language
153 !insertmacro MUI_LANGUAGE "Czech"
154 !insertmacro MUI_LANGUAGE "Danish"
155 !insertmacro MUI_LANGUAGE "Dutch"
156 !insertmacro MUI_LANGUAGE "French"
157 !insertmacro MUI_LANGUAGE "German"
158 !insertmacro MUI_LANGUAGE "Galician"
159 !insertmacro MUI_LANGUAGE "Hungarian"
160 !insertmacro MUI_LANGUAGE "Italian"
161 !insertmacro MUI_LANGUAGE "Japanese"
162 !insertmacro MUI_LANGUAGE "Norwegian"
163 !insertmacro MUI_LANGUAGE "Polish"
164 !insertmacro MUI_LANGUAGE "Portuguese"
165 !insertmacro MUI_LANGUAGE "Romanian"
166 !insertmacro MUI_LANGUAGE "Slovak"
167 !insertmacro MUI_LANGUAGE "Spanish"
168 !insertmacro MUI_LANGUAGE "Swedish"
169 !insertmacro MUI_LANGUAGE "Turkish"
170
171 !include "lyx_languages\english.nsh"
172 !include "lyx_languages\czech.nsh"
173 !include "lyx_languages\danish.nsh"
174 !include "lyx_languages\dutch.nsh"
175 !include "lyx_languages\french.nsh"
176 !include "lyx_languages\german.nsh"
177 !include "lyx_languages\galician.nsh"
178 !include "lyx_languages\hungarian.nsh"
179 !include "lyx_languages\italian.nsh"
180 !include "lyx_languages\japanese.nsh"
181 !include "lyx_languages\norwegian.nsh"
182 !include "lyx_languages\polish.nsh"
183 !include "lyx_languages\portuguese.nsh"
184 !include "lyx_languages\romanian.nsh"
185 !include "lyx_languages\slovak.nsh"
186 !include "lyx_languages\spanish.nsh"
187 !include "lyx_languages\swedish.nsh"
188 !include "lyx_languages\turkish.nsh"
189
190 LicenseData "$(LyXLicenseData)"
191
192 #--------------------------------
193 # Reserve Files
194
195 # These files are inserted before other files in the data block
196 !insertmacro MUI_RESERVEFILE_LANGDLL
197 ReserveFile "io_ui_language.ini"
198 !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
199
200 #--------------------------------
201 # Installer sections
202
203 Section "!${PRODUCT_NAME}" SecCore
204   SectionIn RO
205 SectionEnd
206 Section "$(SecAllUsersTitle)" SecAllUsers
207   SetShellVarContext all
208   StrCpy $ProductRootKey "HKLM"
209 SectionEnd
210 Section "$(SecFileAssocTitle)" SecFileAssoc
211   StrCpy $CreateFileAssociations "true"
212 SectionEnd
213 Section "$(SecDesktopTitle)" SecDesktop
214   StrCpy $CreateDesktopIcon "true"
215 SectionEnd
216
217 # Section descriptions
218 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
219 !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} "$(SecCoreDescription)"
220 !insertmacro MUI_DESCRIPTION_TEXT ${SecAllUsers} "$(SecAllUsersDescription)"
221 !insertmacro MUI_DESCRIPTION_TEXT ${SecFileAssoc} "$(SecFileAssocDescription)"
222 !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} "$(SecDesktopDescription)"
223 !insertmacro MUI_FUNCTION_DESCRIPTION_END
224
225 # the installation section
226 !include "InstallActions-complete-small.nsh"
227
228 #--------------------------------
229 # This hook function is called internally by NSIS on installer startup
230 Function .onInit
231
232   # set the installer language to the Windows locale language
233   System::Call "kernel32::GetUserDefaultLangID()i.a"
234
235   # check that the installer is not currently running
236   System::Call 'kernel32::CreateMutexA(i 0, i 0, t "${INSTALLER_EXE}.Instance") i .r1 ?e'
237   Pop $R0
238   ${if} $R0 != "0"
239    MessageBox MB_OK|MB_ICONSTOP "$(InstallRunning)"
240    Abort
241   ${endif}
242   FindProcDLL::FindProc "${INSTALLER2_EXE}"
243   ${if} $R0 == "1"
244    MessageBox MB_OK|MB_ICONSTOP "$(InstallRunning)"
245    Abort
246   ${endif}
247
248   # check if LyX is already installed
249   ReadRegStr $0 HKLM "${PRODUCT_UNINST_KEY}" "Publisher"
250   ${if} $0 != ""
251    MessageBox MB_OK|MB_ICONSTOP "$(StillInstalled)"
252    Abort
253   ${endif}
254
255   # default settings
256   # these can be reset to "all" in section SecAllUsers
257   SetShellVarContext current
258   StrCpy $ProductRootKey "HKCU"
259
260   # this can be reset to "true" in section SecDesktop
261   StrCpy $CreateDesktopIcon "false"
262   StrCpy $CreateFileAssociations "false"
263
264   # if the user does *not* have administrator privileges, abort
265   StrCpy $Answer ""
266   StrCpy $UserName ""
267   !insertmacro IsUserAdmin $Answer $UserName # macro from LyXUtils.nsh
268   ${if} $Answer == "yes"
269     !define ENABLE 0x00000001
270     SectionGetFlags ${SecAllUsers} $0
271     IntOp $0 $0 | ${ENABLE}
272     SectionSetFlags ${SecAllUsers} $0
273     !undef ENABLE
274   ${else}
275     MessageBox MB_OK|MB_ICONSTOP "$(NotAdmin)"
276     Abort
277   ${endif}
278
279   # check the LaTeX-system
280   Call LaTeXActions # Function from LaTeX.nsh
281
282   # check which programs are installed or not
283   Call MissingPrograms # function from MissingPrograms.nsh
284
285   # used later in the function LatexFolder
286   StrCpy $State "0"
287
288   ClearErrors
289 FunctionEnd
290
291 #--------------------------------
292
293 Function LaunchProduct
294   Exec ${PRODUCT_BAT}
295 FunctionEnd
296
297 #--------------------------------
298 # The Uninstaller
299
300 !include "Uninstall.nsh"
301
302 # eof