2007-05-01 17:55:54 +00:00
|
|
|
# Lyx for Windows, NSIS v2 series installer script
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
# File LyXInstaller-small.nsi
|
|
|
|
# This file is part of LyX, the document processor.
|
|
|
|
# http://www.lyx.org/
|
|
|
|
# Licence details can be found in the file COPYING or copy at
|
|
|
|
# http://www.lyx.org/about/license.php3
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2007-12-17 23:13:01 +00:00
|
|
|
# Author Uwe Stöhr based on the work of Angus Leeming and ideas of Joost Verburg
|
2007-05-01 17:55:54 +00:00
|
|
|
# Full author contact details are available in file CREDITS or copy at
|
|
|
|
# http://www.lyx.org/about/credits.php
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2007-12-17 23:13:01 +00:00
|
|
|
# This script requires NSIS 2.30 or newer
|
2007-05-01 17:55:54 +00:00
|
|
|
# http://nsis.sourceforge.net/
|
|
|
|
#--------------------------------
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
# Do a Cyclic Redundancy Check to make sure the installer
|
|
|
|
# was not corrupted by the download.
|
2007-02-08 21:09:30 +00:00
|
|
|
CRCCheck force
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
# Make the installer as small as possible.
|
|
|
|
#SetCompressor lzma
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
#--------------------------------
|
|
|
|
# You should need to change only these macros...
|
2007-02-08 21:09:30 +00:00
|
|
|
|
|
|
|
!define INSTALLER_VERSION "Small"
|
2007-04-24 22:08:27 +00:00
|
|
|
!define INSTALLER2_VERSION "Complete"
|
|
|
|
!define INSTALLER3_VERSION "Update"
|
2007-05-02 23:06:01 +00:00
|
|
|
!define INSTALLER_TYPE "NotUpdate"
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
# load the settings
|
2007-04-24 22:08:27 +00:00
|
|
|
!include "Settings.nsh"
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
#--------------------------------
|
|
|
|
# variables only used in this installer version
|
2007-02-08 21:09:30 +00:00
|
|
|
|
|
|
|
Var DelPythonFiles
|
|
|
|
Var GhostscriptPath
|
|
|
|
Var AiksaurusPath
|
|
|
|
Var AspellPath
|
|
|
|
Var Acrobat
|
|
|
|
Var PSVPath
|
2007-06-04 01:05:38 +00:00
|
|
|
Var DelGSDir
|
2007-02-08 21:09:30 +00:00
|
|
|
Var EditorPath
|
|
|
|
Var ImageEditorPath
|
|
|
|
Var BibTeXEditorPath
|
|
|
|
Var LangEncoding
|
|
|
|
Var LangSysEncoding
|
|
|
|
Var MissedProg
|
|
|
|
Var LaTeXName
|
|
|
|
Var MiKTeXVersion
|
|
|
|
Var MiKTeXUser
|
|
|
|
Var State
|
2007-05-25 09:39:18 +00:00
|
|
|
Var SVGPath
|
2007-05-01 17:55:54 +00:00
|
|
|
# Variables used by all installer versions
|
2007-04-30 00:55:50 +00:00
|
|
|
Var AspellInstallYes
|
|
|
|
Var AspellBaseReg
|
|
|
|
Var AspellMessage
|
|
|
|
Var ImageMagickPath
|
|
|
|
Var JabRefInstalled
|
|
|
|
Var LatexPath
|
|
|
|
Var MiKTeXInstalled
|
|
|
|
Var PythonPath
|
|
|
|
Var Answer
|
|
|
|
Var AppPre
|
|
|
|
Var AppSuff
|
|
|
|
Var AppPath
|
|
|
|
Var CreateDesktopIcon
|
|
|
|
Var CreateFileAssociations
|
|
|
|
Var DictCode
|
|
|
|
Var FileName
|
|
|
|
Var LangCode
|
|
|
|
Var LangCodeSys
|
|
|
|
Var LangName
|
|
|
|
Var LangNameSys
|
|
|
|
Var NewString
|
|
|
|
Var OldString
|
|
|
|
Var PathPrefix
|
|
|
|
Var Pointer
|
|
|
|
Var ProductRootKey
|
2007-02-08 21:09:30 +00:00
|
|
|
Var RunNumber
|
2007-04-30 00:55:50 +00:00
|
|
|
Var StartmenuFolder
|
|
|
|
Var String
|
|
|
|
Var Search
|
|
|
|
Var UserList
|
|
|
|
Var UserName
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
#--------------------------------
|
|
|
|
# load some NSIS libraries
|
2007-02-08 21:09:30 +00:00
|
|
|
!include "MUI.nsh"
|
|
|
|
!include "LogicLib.nsh"
|
|
|
|
!include "FileFunc.nsh"
|
|
|
|
!include "StrFunc.nsh"
|
2007-05-25 09:39:18 +00:00
|
|
|
!include "TextFunc.nsh"
|
|
|
|
!insertmacro LineFind
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
# Set of various macros and functions
|
2007-02-08 21:09:30 +00:00
|
|
|
!include "LyXUtils.nsh"
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
# Functions to check and configure the LaTeX-system
|
2007-04-16 22:33:53 +00:00
|
|
|
!include "LaTeX.nsh"
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
# Function to check if needed programs are missing or not
|
2007-02-08 21:09:30 +00:00
|
|
|
!include "MissingPrograms.nsh"
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
# Function for page to manually select LaTeX's installation folder
|
2007-02-08 21:09:30 +00:00
|
|
|
!include "LaTeXFolder.nsh"
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
# Functions for page to set installer language
|
|
|
|
# and LyX's menu language
|
2007-02-08 21:09:30 +00:00
|
|
|
!include "LanguageSettings.nsh"
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
# Function to configure LyX
|
2007-04-16 22:33:53 +00:00
|
|
|
!include "ConfigLyX.nsh"
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2007-05-15 22:43:05 +00:00
|
|
|
# Function to configure needed third-party programs
|
|
|
|
!include "InstallThirdPartyProgs.nsh"
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
# Function for page to install Aspell dictionaries
|
2007-04-16 22:33:53 +00:00
|
|
|
!include "Aspell.nsh"
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
#--------------------------------
|
|
|
|
# Remember the installer language
|
2007-02-08 21:09:30 +00:00
|
|
|
!define MUI_LANGDLL_REGISTRY_ROOT "HKCU"
|
|
|
|
!define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
|
|
|
|
!define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
|
|
|
|
|
|
|
|
!define MUI_ABORTWARNING
|
|
|
|
!define MUI_HEADERIMAGE
|
|
|
|
!define MUI_HEADERIMAGE_BITMAP "${PRODUCT_DIR}\icons\lyx_logo_hi.bmp"
|
|
|
|
!define MUI_ICON "${PRODUCT_DIR}\icons\lyx.ico"
|
|
|
|
!define MUI_UNICON "${PRODUCT_DIR}\icons\lyx.ico"
|
|
|
|
!define MUI_WELCOMEFINISHPAGE_BITMAP "${VERSION_BITMAP}"
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
# Welcome page
|
2007-02-08 21:09:30 +00:00
|
|
|
!define MUI_WELCOMEPAGE_TEXT "$(WelcomePageText)"
|
|
|
|
!insertmacro MUI_PAGE_WELCOME
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
# Show the license.
|
2007-02-08 21:09:30 +00:00
|
|
|
!insertmacro MUI_PAGE_LICENSE "${PRODUCT_LICENSE_FILE}"
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
# Specify the installation directory.
|
2007-02-08 21:09:30 +00:00
|
|
|
!insertmacro MUI_PAGE_DIRECTORY
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
# Specify LyX's menu language.
|
2007-02-08 21:09:30 +00:00
|
|
|
Page custom SelectMenuLanguage SelectMenuLanguage_LeaveFunction
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
# Define which components to install.
|
2007-02-08 21:09:30 +00:00
|
|
|
!insertmacro MUI_PAGE_COMPONENTS
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
# Specify where to install program shortcuts.
|
2007-02-08 21:09:30 +00:00
|
|
|
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "${PRODUCT_ROOT_KEY}"
|
|
|
|
!define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
|
|
|
|
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
|
|
|
|
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "LyX ${PRODUCT_VERSION}"
|
|
|
|
!insertmacro MUI_PAGE_STARTMENU ${PRODUCT_NAME} $StartmenuFolder
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
# Select latex.exe manually
|
2007-02-08 21:09:30 +00:00
|
|
|
Page custom LatexFolder LatexFolder_LeaveFunction
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
# Check for needed programs
|
2007-02-08 21:09:30 +00:00
|
|
|
Page custom MissingProgramsPage MissingProgramsPage_LeaveFunction
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
# Watch the components being installed.
|
2007-02-08 21:09:30 +00:00
|
|
|
!insertmacro MUI_PAGE_INSTFILES
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
# Finish page
|
2007-02-08 21:09:30 +00:00
|
|
|
!define MUI_FINISHPAGE_RUN
|
|
|
|
!define MUI_FINISHPAGE_TEXT "$(FinishPageMessage)"
|
|
|
|
!define MUI_FINISHPAGE_RUN_TEXT "$(FinishPageRun)"
|
|
|
|
!define MUI_FINISHPAGE_RUN_FUNCTION "LaunchProduct"
|
|
|
|
!insertmacro MUI_PAGE_FINISH
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
# The uninstaller.
|
2007-02-08 21:09:30 +00:00
|
|
|
!insertmacro MUI_UNPAGE_COMPONENTS
|
|
|
|
!insertmacro MUI_UNPAGE_INSTFILES
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
#--------------------------------
|
|
|
|
# Languages
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
!insertmacro MUI_LANGUAGE "English" # first language is the default language
|
2007-05-28 11:27:16 +00:00
|
|
|
!insertmacro MUI_LANGUAGE "Czech"
|
2007-02-08 21:09:30 +00:00
|
|
|
!insertmacro MUI_LANGUAGE "Danish"
|
|
|
|
!insertmacro MUI_LANGUAGE "Dutch"
|
|
|
|
!insertmacro MUI_LANGUAGE "French"
|
|
|
|
!insertmacro MUI_LANGUAGE "German"
|
|
|
|
!insertmacro MUI_LANGUAGE "Galician"
|
|
|
|
!insertmacro MUI_LANGUAGE "Hungarian"
|
|
|
|
!insertmacro MUI_LANGUAGE "Italian"
|
|
|
|
!insertmacro MUI_LANGUAGE "Norwegian"
|
|
|
|
!insertmacro MUI_LANGUAGE "Polish"
|
|
|
|
!insertmacro MUI_LANGUAGE "Portuguese"
|
2008-03-02 21:41:03 +00:00
|
|
|
!insertmacro MUI_LANGUAGE "Romanian"
|
2007-02-08 21:09:30 +00:00
|
|
|
!insertmacro MUI_LANGUAGE "Slovak"
|
|
|
|
!insertmacro MUI_LANGUAGE "Spanish"
|
|
|
|
!insertmacro MUI_LANGUAGE "Swedish"
|
|
|
|
!insertmacro MUI_LANGUAGE "Turkish"
|
|
|
|
|
|
|
|
!include "lyx_languages\english.nsh"
|
2007-05-28 11:27:16 +00:00
|
|
|
!include "lyx_languages\czech.nsh"
|
2007-02-08 21:09:30 +00:00
|
|
|
!include "lyx_languages\danish.nsh"
|
|
|
|
!include "lyx_languages\dutch.nsh"
|
|
|
|
!include "lyx_languages\french.nsh"
|
|
|
|
!include "lyx_languages\german.nsh"
|
|
|
|
!include "lyx_languages\galician.nsh"
|
|
|
|
!include "lyx_languages\hungarian.nsh"
|
|
|
|
!include "lyx_languages\italian.nsh"
|
|
|
|
!include "lyx_languages\norwegian.nsh"
|
|
|
|
!include "lyx_languages\polish.nsh"
|
|
|
|
!include "lyx_languages\portuguese.nsh"
|
2008-03-02 21:41:03 +00:00
|
|
|
!include "lyx_languages\romanian.nsh"
|
2007-02-08 21:09:30 +00:00
|
|
|
!include "lyx_languages\slovak.nsh"
|
|
|
|
!include "lyx_languages\spanish.nsh"
|
|
|
|
!include "lyx_languages\swedish.nsh"
|
|
|
|
!include "lyx_languages\turkish.nsh"
|
|
|
|
|
|
|
|
LicenseData "$(LyXLicenseData)"
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
#--------------------------------
|
|
|
|
# Reserve Files
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
# These files are inserted before other files in the data block
|
2007-02-08 21:09:30 +00:00
|
|
|
!insertmacro MUI_RESERVEFILE_LANGDLL
|
|
|
|
ReserveFile "io_ui_language.ini"
|
|
|
|
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
#--------------------------------
|
|
|
|
# Installer sections
|
2007-02-08 21:09:30 +00:00
|
|
|
|
|
|
|
Section "!${PRODUCT_NAME}" SecCore
|
|
|
|
SectionIn RO
|
|
|
|
SectionEnd
|
|
|
|
Section "$(SecAllUsersTitle)" SecAllUsers
|
|
|
|
SetShellVarContext all
|
|
|
|
StrCpy $ProductRootKey "HKLM"
|
|
|
|
SectionEnd
|
|
|
|
Section "$(SecFileAssocTitle)" SecFileAssoc
|
|
|
|
StrCpy $CreateFileAssociations "true"
|
|
|
|
SectionEnd
|
|
|
|
Section "$(SecDesktopTitle)" SecDesktop
|
|
|
|
StrCpy $CreateDesktopIcon "true"
|
|
|
|
SectionEnd
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
# Section descriptions
|
2007-02-08 21:09:30 +00:00
|
|
|
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
|
|
|
!insertmacro MUI_DESCRIPTION_TEXT ${SecCore} "$(SecCoreDescription)"
|
|
|
|
!insertmacro MUI_DESCRIPTION_TEXT ${SecAllUsers} "$(SecAllUsersDescription)"
|
|
|
|
!insertmacro MUI_DESCRIPTION_TEXT ${SecFileAssoc} "$(SecFileAssocDescription)"
|
|
|
|
!insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} "$(SecDesktopDescription)"
|
|
|
|
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
# the installation section
|
2007-05-15 22:43:05 +00:00
|
|
|
!include "InstallActions-complete-small.nsh"
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
#--------------------------------
|
|
|
|
# This hook function is called internally by NSIS on installer startup
|
2007-02-08 21:09:30 +00:00
|
|
|
Function .onInit
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
# set the installer language to the Windows locale language
|
2007-02-08 21:09:30 +00:00
|
|
|
System::Call "kernel32::GetUserDefaultLangID()i.a"
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
# check that the installer is not currently running
|
2007-02-08 21:09:30 +00:00
|
|
|
System::Call 'kernel32::CreateMutexA(i 0, i 0, t "${INSTALLER_EXE}.Instance") i .r1 ?e'
|
|
|
|
Pop $R0
|
|
|
|
${if} $R0 != "0"
|
|
|
|
MessageBox MB_OK|MB_ICONSTOP "$(InstallRunning)"
|
|
|
|
Abort
|
|
|
|
${endif}
|
|
|
|
FindProcDLL::FindProc "${INSTALLER2_EXE}"
|
|
|
|
${if} $R0 == "1"
|
|
|
|
MessageBox MB_OK|MB_ICONSTOP "$(InstallRunning)"
|
|
|
|
Abort
|
|
|
|
${endif}
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
# check if LyX is already installed
|
2007-02-08 21:09:30 +00:00
|
|
|
ReadRegStr $0 HKLM "${PRODUCT_UNINST_KEY}" "Publisher"
|
|
|
|
${if} $0 != ""
|
|
|
|
MessageBox MB_OK|MB_ICONSTOP "$(StillInstalled)"
|
|
|
|
Abort
|
|
|
|
${endif}
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
# default settings
|
|
|
|
# these can be reset to "all" in section SecAllUsers
|
2007-02-08 21:09:30 +00:00
|
|
|
SetShellVarContext current
|
|
|
|
StrCpy $ProductRootKey "HKCU"
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
# this can be reset to "true" in section SecDesktop
|
2007-02-08 21:09:30 +00:00
|
|
|
StrCpy $CreateDesktopIcon "false"
|
|
|
|
StrCpy $CreateFileAssociations "false"
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
# if the user does *not* have administrator privileges, abort
|
2007-02-08 21:09:30 +00:00
|
|
|
StrCpy $Answer ""
|
|
|
|
StrCpy $UserName ""
|
2007-05-01 17:55:54 +00:00
|
|
|
!insertmacro IsUserAdmin $Answer $UserName # macro from LyXUtils.nsh
|
2007-02-08 21:09:30 +00:00
|
|
|
${if} $Answer == "yes"
|
|
|
|
!define ENABLE 0x00000001
|
|
|
|
SectionGetFlags ${SecAllUsers} $0
|
|
|
|
IntOp $0 $0 | ${ENABLE}
|
|
|
|
SectionSetFlags ${SecAllUsers} $0
|
|
|
|
!undef ENABLE
|
|
|
|
${else}
|
|
|
|
MessageBox MB_OK|MB_ICONSTOP "$(NotAdmin)"
|
|
|
|
Abort
|
|
|
|
${endif}
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
# check the LaTeX-system
|
|
|
|
Call LaTeXActions # Function from LaTeX.nsh
|
2007-04-16 22:33:53 +00:00
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
# check which programs are installed or not
|
|
|
|
Call MissingPrograms # function from MissingPrograms.nsh
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
# used later in the function LatexFolder
|
2007-02-08 21:09:30 +00:00
|
|
|
StrCpy $State "0"
|
|
|
|
|
|
|
|
ClearErrors
|
|
|
|
FunctionEnd
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
#--------------------------------
|
2007-02-08 21:09:30 +00:00
|
|
|
|
|
|
|
Function LaunchProduct
|
|
|
|
Exec ${PRODUCT_BAT}
|
|
|
|
FunctionEnd
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
#--------------------------------
|
|
|
|
# The Uninstaller
|
2007-02-08 21:09:30 +00:00
|
|
|
|
|
|
|
!include "Uninstall.nsh"
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
# eof
|