]> git.lyx.org Git - lyx.git/blob - development/Win32/packaging/installer/include/init.nsh
* All ImageMagick and Ghostscript resources are no longer installed as separate files...
[lyx.git] / development / Win32 / packaging / installer / include / init.nsh
1 /*
2
3 init.nsh
4
5 Initialization function
6
7 */
8
9 #--------------------------------
10 # Installer initialization
11
12 !macro PRINTER_INIT
13
14   ${If} ${AtLeastWinVista}
15     StrCpy $PrinterConf "printui.exe"
16   ${Else}
17     StrCpy $PrinterConf "rundll32.exe printui.dll,PrintUIEntry"
18   ${EndIf}
19
20 !macroend
21
22 Function .onInit
23
24   ${IfNot} ${IsNT}
25   ${OrIfNot} ${AtLeastWin2000}
26     MessageBox MB_OK|MB_ICONSTOP "${APP_NAME} ${APP_VERSION} requires Windows 2000 or later."
27     Quit
28   ${EndIf}
29
30   !insertmacro PRINTER_INIT
31   !insertmacro MULTIUSER_INIT
32  
33   ${IfNot} ${Silent}
34   
35     !ifndef BUNDLE_IMAGEMAGICK & BUNDLE_GHOSTSCRIPT
36     # Warn the user when no Administrator or Power user privileges are available
37     # These privileges are required to install ImageMagick or Ghostscript
38     ${If} $MultiUser.Privileges != "Admin"
39     ${AndIf} $MultiUser.Privileges != "Power"
40       MessageBox MB_OK|MB_ICONEXCLAMATION $(TEXT_NO_PRIVILEDGES)
41     ${EndIf}
42     !endif
43     
44     # Show banner while installer is intializating 
45     Banner::show /NOUNLOAD "Checking system"
46   ${EndIf}
47  
48   Call SearchExternal
49   Call InitExternal
50
51   ${IfNot} ${Silent}
52     Banner::destroy
53   ${EndIf}
54
55 FunctionEnd
56
57 Function un.onInit
58
59   !insertmacro PRINTER_INIT
60   !insertmacro MULTIUSER_UNINIT
61
62 FunctionEnd
63
64 #--------------------------------
65 # User initialization
66
67 Var ComponentPath
68 Var LyXLangName
69
70 # COMPONENT can be LaTeX ImageMagick and Ghostscript
71 !macro EXTERNAL_INIT COMPONENT
72
73   # APP_REGKEY_SETUP = "Software\${APP_NAME}${APP_SERIES_KEY}\Setup"
74   # where ${APP_NAME}${APP_SERIES_KEY} is something like LyX16
75   ReadRegStr $ComponentPath SHELL_CONTEXT "${APP_REGKEY_SETUP}" "${COMPONENT} Path"
76   
77   # BIN_LATEX etc are defined in settings.nsh
78   ${If} ${FileExists} "$ComponentPath\${BIN_${COMPONENT}}"
79     # set variables like PathLaTeX
80     StrCpy $Path${COMPONENT} $ComponentPath
81   ${EndIf}
82
83 !macroend
84
85 Function InitUser
86
87   # Get directories of components from registry
88   
89   !insertmacro EXTERNAL_INIT LaTeX
90   !insertmacro EXTERNAL_INIT ImageMagick
91   !insertmacro EXTERNAL_INIT Ghostscript
92   
93   # Get LyX language
94   
95   ReadRegStr $LyXLangName SHELL_CONTEXT "${APP_REGKEY_SETUP}" "LyX Language"
96   
97   ${If} $LyXLangName != ""
98     StrCpy $LangName $LyXLangName
99   ${EndIf}
100   
101 FunctionEnd