]> git.lyx.org Git - features.git/blob - development/Win32/packaging/installer/include/init.nsh
lots of installer improvements:
[features.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 Function .onInit
13
14   ${IfNot} ${IsNT}
15   ${OrIfNot} ${AtLeastWin2000}
16     MessageBox MB_OK|MB_ICONSTOP "${APP_NAME} ${APP_VERSION} requires Windows 2000 or later."
17     Quit
18   ${EndIf}
19
20   !insertmacro MULTIUSER_INIT
21   
22   ${unless} ${silent}
23     Banner::show /NOUNLOAD "Checking system"
24   ${EndIf}
25   
26   Call SearchExternal
27   Call InitExternal
28
29   ${unless} ${silent}
30     Banner::destroy
31   ${EndIf}
32
33 FunctionEnd
34
35 Function un.onInit
36
37   !insertmacro MULTIUSER_UNINIT
38
39 FunctionEnd
40
41 #--------------------------------
42 # User initialization
43
44 Var ComponentPath
45 Var LyXPath
46 Var LyXLangName
47
48 # COMPONENT can be LaTeX ImageMagick and Ghostscript
49 !macro EXTERNAL_INIT COMPONENT
50
51   # APP_REGKEY_SETUP = "Software\${APP_NAME}${APP_SERIES_KEY}\Setup"
52   # where ${APP_NAME}${APP_SERIES_KEY} is something like LyX16
53   ReadRegStr $ComponentPath SHELL_CONTEXT "${APP_REGKEY_SETUP}" "${COMPONENT} Path"
54   
55   # BIN_LATEX etc are defined in settings.nsh
56   ${If} ${FileExists} "$ComponentPath\${BIN_${COMPONENT}}"
57     # set variables like PathLaTeX
58     StrCpy $Path${COMPONENT} $ComponentPath
59   ${EndIf}
60
61 !macroend
62
63 Function InitUser
64
65   # Get directories of components from registry
66
67   ReadRegStr $LyXPath SHELL_CONTEXT "${APP_REGKEY}" ""
68   
69   ${If} $LyXPath != ""
70     StrCpy $INSTDIR $LyXPath
71   ${EndIf}
72
73   !insertmacro EXTERNAL_INIT LaTeX
74   !insertmacro EXTERNAL_INIT ImageMagick
75   !insertmacro EXTERNAL_INIT Ghostscript
76   
77   # Get LyX language
78   
79   ReadRegStr $LyXLangName SHELL_CONTEXT "${APP_REGKEY_SETUP}" "LyX Language"
80   
81   ${If} $LyXLangName != ""
82     StrCpy $LangName $LyXLangName
83   ${EndIf}
84   
85 FunctionEnd