2007-02-08 21:09:30 +00:00
|
|
|
/*
|
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
init.nsh
|
|
|
|
|
|
|
|
Initialization function
|
2007-02-08 21:09:30 +00:00
|
|
|
|
|
|
|
*/
|
|
|
|
|
2007-02-26 16:03:30 +00:00
|
|
|
#--------------------------------
|
2008-03-30 21:37:53 +00:00
|
|
|
# Installer initialization
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-04-05 19:12:37 +00:00
|
|
|
!macro PRINTER_INIT
|
|
|
|
|
|
|
|
${If} ${AtLeastWinVista}
|
|
|
|
StrCpy $PrinterConf "printui.exe"
|
|
|
|
${Else}
|
|
|
|
StrCpy $PrinterConf "rundll32.exe printui.dll,PrintUIEntry"
|
|
|
|
${EndIf}
|
|
|
|
|
|
|
|
!macroend
|
|
|
|
|
2007-02-08 21:09:30 +00:00
|
|
|
Function .onInit
|
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
${IfNot} ${IsNT}
|
|
|
|
${OrIfNot} ${AtLeastWin2000}
|
|
|
|
MessageBox MB_OK|MB_ICONSTOP "${APP_NAME} ${APP_VERSION} requires Windows 2000 or later."
|
|
|
|
Quit
|
|
|
|
${EndIf}
|
|
|
|
|
2008-04-05 19:12:37 +00:00
|
|
|
!insertmacro PRINTER_INIT
|
2008-03-30 21:37:53 +00:00
|
|
|
!insertmacro MULTIUSER_INIT
|
2008-04-11 23:01:05 +00:00
|
|
|
|
2008-04-07 17:26:02 +00:00
|
|
|
${IfNot} ${Silent}
|
2008-05-01 18:33:36 +00:00
|
|
|
|
|
|
|
!ifndef BUNDLE_IMAGEMAGICK & BUNDLE_GHOSTSCRIPT
|
2008-04-11 23:01:05 +00:00
|
|
|
# Warn the user when no Administrator or Power user privileges are available
|
|
|
|
# These privileges are required to install ImageMagick or Ghostscript
|
|
|
|
${If} $MultiUser.Privileges != "Admin"
|
2008-05-01 18:33:36 +00:00
|
|
|
${AndIf} $MultiUser.Privileges != "Power"
|
2008-04-11 23:01:05 +00:00
|
|
|
MessageBox MB_OK|MB_ICONEXCLAMATION $(TEXT_NO_PRIVILEDGES)
|
|
|
|
${EndIf}
|
2008-05-01 18:33:36 +00:00
|
|
|
!endif
|
2008-04-11 23:01:05 +00:00
|
|
|
|
|
|
|
# Show banner while installer is intializating
|
2007-02-08 21:09:30 +00:00
|
|
|
Banner::show /NOUNLOAD "Checking system"
|
2008-03-30 21:37:53 +00:00
|
|
|
${EndIf}
|
2008-04-11 23:01:05 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
Call SearchExternal
|
|
|
|
Call InitExternal
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-04-07 17:26:02 +00:00
|
|
|
${IfNot} ${Silent}
|
2007-02-08 21:09:30 +00:00
|
|
|
Banner::destroy
|
2008-03-30 21:37:53 +00:00
|
|
|
${EndIf}
|
2007-02-08 21:09:30 +00:00
|
|
|
|
|
|
|
FunctionEnd
|
|
|
|
|
|
|
|
Function un.onInit
|
|
|
|
|
2008-04-05 19:12:37 +00:00
|
|
|
!insertmacro PRINTER_INIT
|
2008-03-30 21:37:53 +00:00
|
|
|
!insertmacro MULTIUSER_UNINIT
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
FunctionEnd
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
#--------------------------------
|
|
|
|
# User initialization
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
Var ComponentPath
|
|
|
|
Var LyXLangName
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
# COMPONENT can be LaTeX ImageMagick and Ghostscript
|
|
|
|
!macro EXTERNAL_INIT COMPONENT
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
# APP_REGKEY_SETUP = "Software\${APP_NAME}${APP_SERIES_KEY}\Setup"
|
|
|
|
# where ${APP_NAME}${APP_SERIES_KEY} is something like LyX16
|
|
|
|
ReadRegStr $ComponentPath SHELL_CONTEXT "${APP_REGKEY_SETUP}" "${COMPONENT} Path"
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
# BIN_LATEX etc are defined in settings.nsh
|
|
|
|
${If} ${FileExists} "$ComponentPath\${BIN_${COMPONENT}}"
|
|
|
|
# set variables like PathLaTeX
|
|
|
|
StrCpy $Path${COMPONENT} $ComponentPath
|
|
|
|
${EndIf}
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
!macroend
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
Function InitUser
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
# Get directories of components from registry
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
!insertmacro EXTERNAL_INIT LaTeX
|
|
|
|
!insertmacro EXTERNAL_INIT ImageMagick
|
|
|
|
!insertmacro EXTERNAL_INIT Ghostscript
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
# Get LyX language
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
ReadRegStr $LyXLangName SHELL_CONTEXT "${APP_REGKEY_SETUP}" "LyX Language"
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
${If} $LyXLangName != ""
|
|
|
|
StrCpy $LangName $LyXLangName
|
|
|
|
${EndIf}
|
2007-02-08 21:09:30 +00:00
|
|
|
|
|
|
|
FunctionEnd
|