lyx_mirror/development/Win32/packaging/installer/include/init.nsh
Joost Verburg f9e5128e31 lots of installer improvements:
* Add option to bundle required ImageMagick/Ghostscript files without the need to modify registry keys that belong to the original applications. This allows for full support for installation by limited users, gives different users the possibility to have a different setup of all LyX tools and reduces download size. The necessary files will be included in the dependency package.
* Python, ImageMagick and Ghostscript will now all be compiled using the same MSVC compiler and can use the same C runtimes. This reduces the installer size.
* Compile Python files during installation to improve performance. Limited users may not have access to the installation folders so the files cannot be compiled afterwards.
* Only the settings that typically need to be changed for LyX releases are now in settings.nsh.
* Rename launcher executable to LyXLauncher.exe to match the alternative installer.
* Minor fixes and cleanup.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24574 a592a061-630c-0410-9148-cb99ea01b6c8
2008-05-01 18:33:36 +00:00

102 lines
2.2 KiB
Plaintext

/*
init.nsh
Initialization function
*/
#--------------------------------
# Installer initialization
!macro PRINTER_INIT
${If} ${AtLeastWinVista}
StrCpy $PrinterConf "printui.exe"
${Else}
StrCpy $PrinterConf "rundll32.exe printui.dll,PrintUIEntry"
${EndIf}
!macroend
Function .onInit
${IfNot} ${IsNT}
${OrIfNot} ${AtLeastWin2000}
MessageBox MB_OK|MB_ICONSTOP "${APP_NAME} ${APP_VERSION} requires Windows 2000 or later."
Quit
${EndIf}
!insertmacro PRINTER_INIT
!insertmacro MULTIUSER_INIT
${IfNot} ${Silent}
!ifndef BUNDLE_IMAGEMAGICK & BUNDLE_GHOSTSCRIPT
# 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"
${AndIf} $MultiUser.Privileges != "Power"
MessageBox MB_OK|MB_ICONEXCLAMATION $(TEXT_NO_PRIVILEDGES)
${EndIf}
!endif
# Show banner while installer is intializating
Banner::show /NOUNLOAD "Checking system"
${EndIf}
Call SearchExternal
Call InitExternal
${IfNot} ${Silent}
Banner::destroy
${EndIf}
FunctionEnd
Function un.onInit
!insertmacro PRINTER_INIT
!insertmacro MULTIUSER_UNINIT
FunctionEnd
#--------------------------------
# User initialization
Var ComponentPath
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
!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