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