]> git.lyx.org Git - lyx.git/blob - development/Win32/packaging/AltInstaller/LyXInstaller-small.nsi
installer: require NSIS 2.45 because of the fixed Indonesian translation
[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.45 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 AppFiles
39 Var AiksaurusPath
40 Var AspellPath
41 Var Acrobat
42 Var BibTeXEditorPath
43 Var DelGSDir
44 Var DelPythonFiles
45 Var DelWMFDir
46 Var EditorPath
47 Var GhostscriptPath
48 Var ImageEditorPath
49 Var LangEncoding
50 Var LangSysEncoding
51 Var LaTeXName
52 Var MiKTeXVersion
53 Var MiKTeXUser
54 Var MissedProg
55 Var PathPrefix
56 Var PSVPath
57 Var State
58 Var SVGPath
59 Var WMFPath
60
61 # Variables used by all installer versions
62 !include "Variables.nsh"
63
64 #--------------------------------
65 # load some NSIS libraries
66 !include "MUI.nsh"
67 !include "LogicLib.nsh"
68 !include "FileFunc.nsh"
69 !include "StrFunc.nsh"
70 !include "TextFunc.nsh"
71 !include "WinVer.nsh"
72
73 # Set of various macros and functions
74 !include "LyXUtils.nsh"
75
76 # Functions to check and configure the LaTeX-system
77 !include "LaTeX.nsh"
78
79 # Function to check if needed programs are missing or not
80 !include "MissingPrograms.nsh"
81
82 # Function for page to manually select LaTeX's installation folder
83 !include "LaTeXFolder.nsh"
84
85 # Functions for page to set installer language
86 # and LyX's menu language
87 !include "LanguageSettings.nsh"
88
89 # Function to configure LyX
90 !include "ConfigLyX.nsh"
91
92 # Function to configure needed third-party programs
93 !include "InstallThirdPartyProgs.nsh"
94
95 # Function for page to install Aspell dictionaries
96 !include "Aspell.nsh"
97
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"
103
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}"
110
111 # Welcome page
112 !define MUI_WELCOMEPAGE_TEXT "$(WelcomePageText)"
113 !insertmacro MUI_PAGE_WELCOME
114
115 # Show the license.
116 !insertmacro MUI_PAGE_LICENSE "${PRODUCT_LICENSE_FILE}"
117
118 # Specify the installation directory.
119 !insertmacro MUI_PAGE_DIRECTORY
120
121 # Specify LyX's menu language.
122 Page custom SelectMenuLanguage SelectMenuLanguage_LeaveFunction
123
124 # Define which components to install.
125 !insertmacro MUI_PAGE_COMPONENTS
126
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
133
134 # Select latex.exe manually
135 Page custom LatexFolder LatexFolder_LeaveFunction
136
137 # Check for needed programs
138 Page custom MissingProgramsPage MissingProgramsPage_LeaveFunction
139
140 # Watch the components being installed.
141 !insertmacro MUI_PAGE_INSTFILES
142
143 # Finish page
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
149
150 # The uninstaller.
151 !insertmacro MUI_UNPAGE_COMPONENTS
152 !insertmacro MUI_UNPAGE_INSTFILES
153
154 #--------------------------------
155 # List of languages the installers are translated to
156
157 !include "TranslatedLanguages.nsh"
158
159 LicenseData "$(LyXLicenseData)"
160
161 #--------------------------------
162 # Reserve Files
163
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
168
169 #--------------------------------
170 # Installer sections
171
172 Section "!${PRODUCT_NAME}" SecCore
173   SectionIn RO
174 SectionEnd
175 Section "$(SecAllUsersTitle)" SecAllUsers
176   SetShellVarContext all
177   StrCpy $ProductRootKey "HKLM"
178 SectionEnd
179 Section "$(SecFileAssocTitle)" SecFileAssoc
180   StrCpy $CreateFileAssociations "true"
181 SectionEnd
182 Section "$(SecDesktopTitle)" SecDesktop
183   StrCpy $CreateDesktopIcon "true"
184 SectionEnd
185
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
193
194 # the installation section
195 !include "InstallActions-complete-small.nsh"
196
197 #--------------------------------
198 # This hook function is called internally by NSIS on installer startup
199 Function .onInit
200
201   # set the installer language to the Windows locale language
202   System::Call "kernel32::GetUserDefaultLangID()i.a"
203
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'
206   Pop $R0
207   ${if} $R0 != "0"
208    MessageBox MB_OK|MB_ICONSTOP "$(InstallRunning)"
209    Abort
210   ${endif}
211   FindProcDLL::FindProc "${INSTALLER2_EXE}"
212   ${if} $R0 == "1"
213    MessageBox MB_OK|MB_ICONSTOP "$(InstallRunning)"
214    Abort
215   ${endif}
216
217   # check if LyX is already installed
218   ReadRegStr $0 HKLM "${PRODUCT_UNINST_KEY}" "Publisher"
219   ${if} $0 != ""
220    MessageBox MB_OK|MB_ICONSTOP "$(StillInstalled)"
221    Abort
222   ${endif}
223   
224   # printer settings, needed to install the Metafile2eps printer
225   !insertmacro PrinterInit # macro from InstallThirdPartyProgs.nsh
226
227   # default settings
228   # these can be reset to "all" in section SecAllUsers
229   SetShellVarContext current
230   StrCpy $ProductRootKey "HKCU"
231
232   # this can be reset to "true" in section SecDesktop
233   StrCpy $CreateDesktopIcon "false"
234   StrCpy $CreateFileAssociations "false"
235
236   # if the user does *not* have administrator privileges, abort
237   StrCpy $Answer ""
238   StrCpy $UserName ""
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
245     !undef ENABLE
246   ${else}
247     MessageBox MB_OK|MB_ICONSTOP "$(NotAdmin)"
248     Abort
249   ${endif}
250
251   # check the LaTeX-system
252   Call LaTeXActions # Function from LaTeX.nsh
253
254   # check which programs are installed or not
255   Call MissingPrograms # function from MissingPrograms.nsh
256
257   # used later in the function LatexFolder
258   StrCpy $State "0"
259
260   ClearErrors
261 FunctionEnd
262
263 #--------------------------------
264
265 Function LaunchProduct
266   Exec ${PRODUCT_BAT}
267 FunctionEnd
268
269 #--------------------------------
270 # The Uninstaller
271
272 !include "Uninstall.nsh"
273
274 # eof