]> git.lyx.org Git - lyx.git/blob - development/Win32/packaging/installer/include/init.nsh
* optimizations and fixes for installation using a limited user account. default...
[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     # Warn the user when no Administrator or Power user privileges are available
35     # These privileges are required to install ImageMagick or Ghostscript
36     ${If} $MultiUser.Privileges != "Admin"
37     ${andif} $MultiUser.Privileges != "Power"
38       MessageBox MB_OK|MB_ICONEXCLAMATION $(TEXT_NO_PRIVILEDGES)
39     ${EndIf}
40     
41     # Show banner while installer is intializating 
42     Banner::show /NOUNLOAD "Checking system"
43   ${EndIf}
44  
45   Call SearchExternal
46   Call InitExternal
47
48   ${IfNot} ${Silent}
49     Banner::destroy
50   ${EndIf}
51
52 FunctionEnd
53
54 Function un.onInit
55
56   !insertmacro PRINTER_INIT
57   !insertmacro MULTIUSER_UNINIT
58
59 FunctionEnd
60
61 #--------------------------------
62 # User initialization
63
64 Var ComponentPath
65 Var LyXLangName
66
67 # COMPONENT can be LaTeX ImageMagick and Ghostscript
68 !macro EXTERNAL_INIT COMPONENT
69
70   # APP_REGKEY_SETUP = "Software\${APP_NAME}${APP_SERIES_KEY}\Setup"
71   # where ${APP_NAME}${APP_SERIES_KEY} is something like LyX16
72   ReadRegStr $ComponentPath SHELL_CONTEXT "${APP_REGKEY_SETUP}" "${COMPONENT} Path"
73   
74   # BIN_LATEX etc are defined in settings.nsh
75   ${If} ${FileExists} "$ComponentPath\${BIN_${COMPONENT}}"
76     # set variables like PathLaTeX
77     StrCpy $Path${COMPONENT} $ComponentPath
78   ${EndIf}
79
80 !macroend
81
82 Function InitUser
83
84   # Get directories of components from registry
85   
86   !insertmacro EXTERNAL_INIT LaTeX
87   !insertmacro EXTERNAL_INIT ImageMagick
88   !insertmacro EXTERNAL_INIT Ghostscript
89   
90   # Get LyX language
91   
92   ReadRegStr $LyXLangName SHELL_CONTEXT "${APP_REGKEY_SETUP}" "LyX Language"
93   
94   ${If} $LyXLangName != ""
95     StrCpy $LangName $LyXLangName
96   ${EndIf}
97   
98 FunctionEnd