]> git.lyx.org Git - lyx.git/blob - development/Win32/packaging/AltInstaller/LyXInstaller-small.nsi
installer for beta4
[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
67 # Set of various macros and functions
68 !include "LyXUtils.nsh"
69
70 # Functions to check and configure the LaTeX-system
71 !include "LaTeX.nsh"
72
73 # Function to check if needed programs are missing or not
74 !include "MissingPrograms.nsh"
75
76 # Function for page to manually select LaTeX's installation folder
77 !include "LaTeXFolder.nsh"
78
79 # Functions for page to set installer language
80 # and LyX's menu language
81 !include "LanguageSettings.nsh"
82
83 # Function to configure LyX
84 !include "ConfigLyX.nsh"
85
86 # Function to configure needed third-party programs
87 !include "InstallThirdPartyProgs.nsh"
88
89 # Function for page to install Aspell dictionaries
90 !include "Aspell.nsh"
91
92 #--------------------------------
93 # Remember the installer language
94 !define MUI_LANGDLL_REGISTRY_ROOT "HKCU"
95 !define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
96 !define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
97
98 !define MUI_ABORTWARNING
99 !define MUI_HEADERIMAGE
100 !define MUI_HEADERIMAGE_BITMAP "${PRODUCT_DIR}\icons\lyx_logo_hi.bmp"
101 !define MUI_ICON "${PRODUCT_DIR}\icons\lyx.ico"
102 !define MUI_UNICON "${PRODUCT_DIR}\icons\lyx.ico"
103 !define MUI_WELCOMEFINISHPAGE_BITMAP "${VERSION_BITMAP}"
104
105 # Welcome page
106 !define MUI_WELCOMEPAGE_TEXT "$(WelcomePageText)"
107 !insertmacro MUI_PAGE_WELCOME
108
109 # Show the license.
110 !insertmacro MUI_PAGE_LICENSE "${PRODUCT_LICENSE_FILE}"
111
112 # Specify the installation directory.
113 !insertmacro MUI_PAGE_DIRECTORY
114
115 # Specify LyX's menu language.
116 Page custom SelectMenuLanguage SelectMenuLanguage_LeaveFunction
117
118 # Define which components to install.
119 !insertmacro MUI_PAGE_COMPONENTS
120
121 # Specify where to install program shortcuts.
122 !define MUI_STARTMENUPAGE_REGISTRY_ROOT "${PRODUCT_ROOT_KEY}"
123 !define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
124 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
125 !define MUI_STARTMENUPAGE_DEFAULTFOLDER "LyX ${PRODUCT_VERSION}"
126 !insertmacro MUI_PAGE_STARTMENU ${PRODUCT_NAME} $StartmenuFolder
127
128 # Select latex.exe manually
129 Page custom LatexFolder LatexFolder_LeaveFunction
130
131 # Check for needed programs
132 Page custom MissingProgramsPage MissingProgramsPage_LeaveFunction
133
134 # Watch the components being installed.
135 !insertmacro MUI_PAGE_INSTFILES
136
137 # Finish page
138 !define MUI_FINISHPAGE_RUN 
139 !define MUI_FINISHPAGE_TEXT "$(FinishPageMessage)"
140 !define MUI_FINISHPAGE_RUN_TEXT "$(FinishPageRun)"
141 !define MUI_FINISHPAGE_RUN_FUNCTION "LaunchProduct"
142 !insertmacro MUI_PAGE_FINISH
143
144 # The uninstaller.
145 !insertmacro MUI_UNPAGE_COMPONENTS
146 !insertmacro MUI_UNPAGE_INSTFILES
147
148 #--------------------------------
149 # Languages
150
151 !insertmacro MUI_LANGUAGE "English" # first language is the default language
152 !insertmacro MUI_LANGUAGE "Czech"
153 !insertmacro MUI_LANGUAGE "Danish"
154 !insertmacro MUI_LANGUAGE "Dutch"
155 !insertmacro MUI_LANGUAGE "French"
156 !insertmacro MUI_LANGUAGE "German"
157 !insertmacro MUI_LANGUAGE "Galician"
158 !insertmacro MUI_LANGUAGE "Hungarian"
159 !insertmacro MUI_LANGUAGE "Italian"
160 !insertmacro MUI_LANGUAGE "Japanese"
161 !insertmacro MUI_LANGUAGE "Norwegian"
162 !insertmacro MUI_LANGUAGE "Polish"
163 !insertmacro MUI_LANGUAGE "Portuguese"
164 !insertmacro MUI_LANGUAGE "Romanian"
165 !insertmacro MUI_LANGUAGE "Slovak"
166 !insertmacro MUI_LANGUAGE "Spanish"
167 !insertmacro MUI_LANGUAGE "Swedish"
168 !insertmacro MUI_LANGUAGE "Turkish"
169
170 !include "lyx_languages\english.nsh"
171 !include "lyx_languages\czech.nsh"
172 !include "lyx_languages\danish.nsh"
173 !include "lyx_languages\dutch.nsh"
174 !include "lyx_languages\french.nsh"
175 !include "lyx_languages\german.nsh"
176 !include "lyx_languages\galician.nsh"
177 !include "lyx_languages\hungarian.nsh"
178 !include "lyx_languages\italian.nsh"
179 !include "lyx_languages\japanese.nsh"
180 !include "lyx_languages\norwegian.nsh"
181 !include "lyx_languages\polish.nsh"
182 !include "lyx_languages\portuguese.nsh"
183 !include "lyx_languages\romanian.nsh"
184 !include "lyx_languages\slovak.nsh"
185 !include "lyx_languages\spanish.nsh"
186 !include "lyx_languages\swedish.nsh"
187 !include "lyx_languages\turkish.nsh"
188
189 LicenseData "$(LyXLicenseData)"
190
191 #--------------------------------
192 # Reserve Files
193
194 # These files are inserted before other files in the data block
195 !insertmacro MUI_RESERVEFILE_LANGDLL
196 ReserveFile "io_ui_language.ini"
197 !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
198
199 #--------------------------------
200 # Installer sections
201
202 Section "!${PRODUCT_NAME}" SecCore
203   SectionIn RO
204 SectionEnd
205 Section "$(SecAllUsersTitle)" SecAllUsers
206   SetShellVarContext all
207   StrCpy $ProductRootKey "HKLM"
208 SectionEnd
209 Section "$(SecFileAssocTitle)" SecFileAssoc
210   StrCpy $CreateFileAssociations "true"
211 SectionEnd
212 Section "$(SecDesktopTitle)" SecDesktop
213   StrCpy $CreateDesktopIcon "true"
214 SectionEnd
215
216 # Section descriptions
217 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
218 !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} "$(SecCoreDescription)"
219 !insertmacro MUI_DESCRIPTION_TEXT ${SecAllUsers} "$(SecAllUsersDescription)"
220 !insertmacro MUI_DESCRIPTION_TEXT ${SecFileAssoc} "$(SecFileAssocDescription)"
221 !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} "$(SecDesktopDescription)"
222 !insertmacro MUI_FUNCTION_DESCRIPTION_END
223
224 # the installation section
225 !include "InstallActions-complete-small.nsh"
226
227 #--------------------------------
228 # This hook function is called internally by NSIS on installer startup
229 Function .onInit
230
231   # set the installer language to the Windows locale language
232   System::Call "kernel32::GetUserDefaultLangID()i.a"
233
234   # check that the installer is not currently running
235   System::Call 'kernel32::CreateMutexA(i 0, i 0, t "${INSTALLER_EXE}.Instance") i .r1 ?e'
236   Pop $R0
237   ${if} $R0 != "0"
238    MessageBox MB_OK|MB_ICONSTOP "$(InstallRunning)"
239    Abort
240   ${endif}
241   FindProcDLL::FindProc "${INSTALLER2_EXE}"
242   ${if} $R0 == "1"
243    MessageBox MB_OK|MB_ICONSTOP "$(InstallRunning)"
244    Abort
245   ${endif}
246
247   # check if LyX is already installed
248   ReadRegStr $0 HKLM "${PRODUCT_UNINST_KEY}" "Publisher"
249   ${if} $0 != ""
250    MessageBox MB_OK|MB_ICONSTOP "$(StillInstalled)"
251    Abort
252   ${endif}
253
254   # default settings
255   # these can be reset to "all" in section SecAllUsers
256   SetShellVarContext current
257   StrCpy $ProductRootKey "HKCU"
258
259   # this can be reset to "true" in section SecDesktop
260   StrCpy $CreateDesktopIcon "false"
261   StrCpy $CreateFileAssociations "false"
262
263   # if the user does *not* have administrator privileges, abort
264   StrCpy $Answer ""
265   StrCpy $UserName ""
266   !insertmacro IsUserAdmin $Answer $UserName # macro from LyXUtils.nsh
267   ${if} $Answer == "yes"
268     !define ENABLE 0x00000001
269     SectionGetFlags ${SecAllUsers} $0
270     IntOp $0 $0 | ${ENABLE}
271     SectionSetFlags ${SecAllUsers} $0
272     !undef ENABLE
273   ${else}
274     MessageBox MB_OK|MB_ICONSTOP "$(NotAdmin)"
275     Abort
276   ${endif}
277
278   # check the LaTeX-system
279   Call LaTeXActions # Function from LaTeX.nsh
280
281   # check which programs are installed or not
282   Call MissingPrograms # function from MissingPrograms.nsh
283
284   # used later in the function LatexFolder
285   StrCpy $State "0"
286
287   ClearErrors
288 FunctionEnd
289
290 #--------------------------------
291
292 Function LaunchProduct
293   Exec ${PRODUCT_BAT}
294 FunctionEnd
295
296 #--------------------------------
297 # The Uninstaller
298
299 !include "Uninstall.nsh"
300
301 # eof