lyx_mirror/development/Win32/packaging/installer/include/init.nsh
Joost Verburg d1a3055578 lots of installer improvements:
* use nsDialogs instead of InstallOptions for custom wizard pages, faster & easier to customize
* upgrade to Modern UI 2
* use MultiUser.nsh to support multiple installation modes (all users / current user) in a much more simple way
* use LangFile.nsh for the language files, again less scripting required
* simplified installer structure
* more meaningful variable names
* more comments
* minor fixes

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24062 a592a061-630c-0410-9148-cb99ea01b6c8
2008-03-30 21:37:53 +00:00

86 lines
1.7 KiB
Plaintext

/*
init.nsh
Initialization function
*/
#--------------------------------
# Installer initialization
Function .onInit
${IfNot} ${IsNT}
${OrIfNot} ${AtLeastWin2000}
MessageBox MB_OK|MB_ICONSTOP "${APP_NAME} ${APP_VERSION} requires Windows 2000 or later."
Quit
${EndIf}
!insertmacro MULTIUSER_INIT
${unless} ${silent}
Banner::show /NOUNLOAD "Checking system"
${EndIf}
Call SearchExternal
Call InitExternal
${unless} ${silent}
Banner::destroy
${EndIf}
FunctionEnd
Function un.onInit
!insertmacro MULTIUSER_UNINIT
FunctionEnd
#--------------------------------
# User initialization
Var ComponentPath
Var LyXPath
Var LyXLangName
# COMPONENT can be LaTeX ImageMagick and Ghostscript
!macro EXTERNAL_INIT COMPONENT
# 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"
# BIN_LATEX etc are defined in settings.nsh
${If} ${FileExists} "$ComponentPath\${BIN_${COMPONENT}}"
# set variables like PathLaTeX
StrCpy $Path${COMPONENT} $ComponentPath
${EndIf}
!macroend
Function InitUser
# Get directories of components from registry
ReadRegStr $LyXPath SHELL_CONTEXT "${APP_REGKEY}" ""
${If} $LyXPath != ""
StrCpy $INSTDIR $LyXPath
${EndIf}
!insertmacro EXTERNAL_INIT LaTeX
!insertmacro EXTERNAL_INIT ImageMagick
!insertmacro EXTERNAL_INIT Ghostscript
# Get LyX language
ReadRegStr $LyXLangName SHELL_CONTEXT "${APP_REGKEY_SETUP}" "LyX Language"
${If} $LyXLangName != ""
StrCpy $LangName $LyXLangName
${EndIf}
FunctionEnd