2007-04-14 11:04:53 +00:00
|
|
|
; Lyx for Windows, NSIS v2 series installer script
|
|
|
|
|
2007-04-24 22:08:27 +00:00
|
|
|
; File LyXInstaller-update.nsi
|
2007-04-14 11:04:53 +00:00
|
|
|
; 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
|
|
|
|
|
|
|
|
; Author Uwe Stöhr
|
|
|
|
; Full author contact details are available in file CREDITS or copy at
|
|
|
|
; http://www.lyx.org/about/credits.php
|
|
|
|
|
|
|
|
; This script requires NSIS 2.25 and newer
|
|
|
|
; http://nsis.sourceforge.net/
|
|
|
|
;--------------------------------
|
|
|
|
|
|
|
|
; Do a Cyclic Redundancy Check to make sure the installer
|
|
|
|
; was not corrupted by the download.
|
|
|
|
CRCCheck force
|
|
|
|
|
|
|
|
; Make the installer as small as possible.
|
2007-04-15 22:48:41 +00:00
|
|
|
SetCompressor lzma
|
2007-04-14 11:04:53 +00:00
|
|
|
|
|
|
|
;--------------------------------
|
|
|
|
; You should need to change only these macros...
|
|
|
|
|
2007-04-24 22:08:27 +00:00
|
|
|
!define INSTALLER_VERSION "Update"
|
|
|
|
!define INSTALLER2_VERSION "Small"
|
|
|
|
!define INSTALLER3_VERSION "Complete"
|
|
|
|
|
|
|
|
; load the settings
|
|
|
|
!include "Settings.nsh"
|
|
|
|
|
2007-04-14 11:04:53 +00:00
|
|
|
;--------------------------------
|
2007-04-24 22:08:27 +00:00
|
|
|
; variables only used in this installer version
|
2007-04-14 11:04:53 +00:00
|
|
|
|
|
|
|
Var INSTDIR_NEW
|
2007-04-30 00:55:50 +00:00
|
|
|
; Variables used by all installer versions
|
|
|
|
Var AspellInstallYes
|
|
|
|
Var AspellBaseReg
|
|
|
|
Var AspellMessage
|
|
|
|
Var ImageMagickPath
|
|
|
|
Var JabRefInstalled
|
|
|
|
Var JabRefVersionVar
|
|
|
|
Var LatexPath
|
|
|
|
Var MiKTeXInstalled
|
|
|
|
Var MiKTeXVersionVar
|
|
|
|
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
|
|
|
|
Var RunNumber
|
|
|
|
Var StartmenuFolder
|
|
|
|
Var String
|
|
|
|
Var Search
|
|
|
|
Var UserList
|
|
|
|
Var UserName
|
2007-04-14 11:04:53 +00:00
|
|
|
|
|
|
|
;--------------------------------
|
|
|
|
; load some NSIS libraries
|
|
|
|
!include "MUI.nsh"
|
|
|
|
!include "LogicLib.nsh"
|
|
|
|
!include "FileFunc.nsh"
|
|
|
|
!include "StrFunc.nsh"
|
2007-04-15 10:22:49 +00:00
|
|
|
!include "TextFunc.nsh"
|
|
|
|
!insertmacro LineFind
|
2007-04-14 11:04:53 +00:00
|
|
|
!include "WordFunc.nsh"
|
|
|
|
!insertmacro WordReplace
|
|
|
|
|
|
|
|
; Set of various macros and functions
|
|
|
|
!include "LyXUtils.nsh"
|
|
|
|
|
2007-04-15 10:22:49 +00:00
|
|
|
; Use the Abiword macros to help set up associations with the file extension in the Registry.
|
|
|
|
; Grabbed from
|
|
|
|
; http://abiword.pchasm.org/source/cvs/abiword-cvs/abi/src/pkg/win/setup/NSISv2/abi_util_fileassoc.nsh
|
|
|
|
!include "abi_util_fileassoc.nsh"
|
|
|
|
|
2007-04-14 11:04:53 +00:00
|
|
|
; list with modified files
|
|
|
|
!include "Updated.nsh"
|
|
|
|
|
|
|
|
; list with deleted files
|
|
|
|
!include "Deleted.nsh"
|
|
|
|
|
2007-04-30 00:55:50 +00:00
|
|
|
; Function for page to install Aspell dictionaries
|
|
|
|
!include "Aspell.nsh"
|
|
|
|
|
2007-04-14 11:04:53 +00:00
|
|
|
;--------------------------------
|
|
|
|
|
|
|
|
; Remember the installer language
|
|
|
|
!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}"
|
|
|
|
|
|
|
|
; Welcome page
|
|
|
|
!define MUI_WELCOMEPAGE_TEXT "$(WelcomePageText)"
|
|
|
|
!insertmacro MUI_PAGE_WELCOME
|
|
|
|
|
|
|
|
; Show the license.
|
|
|
|
!insertmacro MUI_PAGE_LICENSE "${PRODUCT_LICENSE_FILE}"
|
|
|
|
|
|
|
|
; Define which components to install.
|
|
|
|
!insertmacro MUI_PAGE_COMPONENTS
|
|
|
|
|
|
|
|
; Specify where to install program shortcuts.
|
|
|
|
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "SHCTX"
|
|
|
|
!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
|
|
|
|
|
|
|
|
; Watch the components being installed.
|
|
|
|
!insertmacro MUI_PAGE_INSTFILES
|
|
|
|
|
|
|
|
; Finish page
|
|
|
|
!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
|
|
|
|
|
|
|
|
; The uninstaller.
|
|
|
|
!insertmacro MUI_UNPAGE_COMPONENTS
|
|
|
|
!insertmacro MUI_UNPAGE_INSTFILES
|
|
|
|
|
|
|
|
;--------------------------------
|
|
|
|
; Languages
|
|
|
|
|
2007-04-19 00:55:52 +00:00
|
|
|
!insertmacro MUI_LANGUAGE "English" ; first language is the default language
|
2007-04-14 11:04:53 +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"
|
|
|
|
!insertmacro MUI_LANGUAGE "Slovak"
|
|
|
|
!insertmacro MUI_LANGUAGE "Spanish"
|
|
|
|
!insertmacro MUI_LANGUAGE "Swedish"
|
|
|
|
!insertmacro MUI_LANGUAGE "Turkish"
|
|
|
|
|
|
|
|
!include "lyx_languages\english.nsh"
|
|
|
|
!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"
|
|
|
|
!include "lyx_languages\slovak.nsh"
|
|
|
|
!include "lyx_languages\spanish.nsh"
|
|
|
|
!include "lyx_languages\swedish.nsh"
|
|
|
|
!include "lyx_languages\turkish.nsh"
|
|
|
|
|
|
|
|
LicenseData "$(LyXLicenseData)"
|
|
|
|
|
|
|
|
;--------------------------------
|
|
|
|
; Reserve Files
|
|
|
|
|
|
|
|
; These files are inserted before other files in the data block
|
|
|
|
!insertmacro MUI_RESERVEFILE_LANGDLL
|
|
|
|
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
|
|
|
|
|
|
|
|
;--------------------------------
|
|
|
|
; Installer sections
|
|
|
|
|
|
|
|
Section "!${PRODUCT_NAME}" SecCore
|
|
|
|
SectionIn RO
|
|
|
|
SectionEnd
|
2007-04-30 00:55:50 +00:00
|
|
|
Section "$(SecFileAssocTitle)" SecFileAssoc
|
|
|
|
StrCpy $CreateFileAssociations "true"
|
|
|
|
SectionEnd
|
2007-04-14 11:04:53 +00:00
|
|
|
Section "$(SecDesktopTitle)" SecDesktop
|
|
|
|
StrCpy $CreateDesktopIcon "true"
|
|
|
|
SectionEnd
|
|
|
|
|
|
|
|
; Section descriptions
|
|
|
|
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
|
|
|
!insertmacro MUI_DESCRIPTION_TEXT ${SecCore} "$(SecCoreDescription)"
|
|
|
|
!insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} "$(SecDesktopDescription)"
|
|
|
|
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
|
|
|
|
2007-04-19 00:55:52 +00:00
|
|
|
; the installation section
|
|
|
|
!include "InstallActions-update.nsh"
|
|
|
|
|
2007-04-14 11:04:53 +00:00
|
|
|
;--------------------------------
|
|
|
|
; This hook function is called internally by NSIS on installer startup
|
|
|
|
Function .onInit
|
|
|
|
|
2007-04-19 00:55:52 +00:00
|
|
|
; Check that LyX is not currently running
|
|
|
|
FindProcDLL::FindProc "lyx.exe"
|
|
|
|
${if} $R0 == "1"
|
|
|
|
MessageBox MB_OK|MB_ICONSTOP "$(UnInstallRunning)"
|
|
|
|
Abort
|
|
|
|
${endif}
|
|
|
|
|
|
|
|
; set the installer language to the Windows locale language
|
2007-04-14 11:04:53 +00:00
|
|
|
System::Call "kernel32::GetUserDefaultLangID()i.a"
|
|
|
|
|
|
|
|
; Check that the installer is not currently running
|
|
|
|
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}
|
|
|
|
FindProcDLL::FindProc "${INSTALLER3_EXE}"
|
|
|
|
${if} $R0 == "1"
|
|
|
|
MessageBox MB_OK|MB_ICONSTOP "$(InstallRunning)"
|
|
|
|
Abort
|
|
|
|
${endif}
|
|
|
|
|
2007-04-19 00:55:52 +00:00
|
|
|
; check where LyX is installed
|
2007-04-14 11:04:53 +00:00
|
|
|
ReadRegStr $0 HKLM "${PRODUCT_UNINST_KEY_OLD}" "DisplayIcon"
|
2007-04-15 22:03:42 +00:00
|
|
|
${if} $0 != ""
|
|
|
|
SetShellVarContext all
|
|
|
|
StrCpy $ProductRootKey "HKLM"
|
|
|
|
${endif}
|
2007-04-14 11:04:53 +00:00
|
|
|
${if} $0 == ""
|
|
|
|
ReadRegStr $0 HKCU "${PRODUCT_UNINST_KEY_OLD}" "DisplayIcon"
|
2007-04-15 22:03:42 +00:00
|
|
|
${if} $0 != ""
|
|
|
|
SetShellVarContext current
|
|
|
|
StrCpy $ProductRootKey "HKCU"
|
|
|
|
${endif}
|
2007-04-14 11:04:53 +00:00
|
|
|
${if} $0 == ""
|
|
|
|
MessageBox MB_OK|MB_ICONSTOP "$(UpdateNotAllowed)"
|
|
|
|
Abort
|
|
|
|
${endif}
|
2007-04-15 22:03:42 +00:00
|
|
|
${endif} ; end if $0 == 0
|
|
|
|
${if} $0 != "" ; if it is found
|
2007-04-14 11:04:53 +00:00
|
|
|
StrCpy $INSTDIR $0
|
|
|
|
StrCpy $INSTDIR $INSTDIR -12 ; delete the string "\bin\lyx.exe" or "\bin\lyx.bat"
|
|
|
|
${endif}
|
|
|
|
|
2007-04-19 00:55:52 +00:00
|
|
|
; abort if the user doesn't have administrator privileges but LyX was installed as admin
|
2007-04-14 11:04:53 +00:00
|
|
|
StrCpy $Answer ""
|
|
|
|
StrCpy $UserName ""
|
|
|
|
!insertmacro IsUserAdmin $Answer $UserName ; macro from LyXUtils.nsh
|
|
|
|
${if} $Answer != "yes"
|
2007-04-15 22:03:42 +00:00
|
|
|
${andif} $ProductRootKey == "HKLM"
|
2007-04-14 11:04:53 +00:00
|
|
|
MessageBox MB_OK|MB_ICONSTOP "$(NotAdmin)"
|
|
|
|
Abort
|
|
|
|
${endif}
|
|
|
|
|
2007-04-15 22:03:42 +00:00
|
|
|
; This can be reset to "true" in section SecDesktop.
|
|
|
|
StrCpy $CreateDesktopIcon "false"
|
|
|
|
|
2007-04-14 11:04:53 +00:00
|
|
|
ClearErrors
|
|
|
|
FunctionEnd
|
|
|
|
|
|
|
|
;--------------------------------
|
|
|
|
|
|
|
|
Function LaunchProduct
|
|
|
|
Exec ${PRODUCT_BAT}
|
|
|
|
FunctionEnd
|
|
|
|
|
|
|
|
;--------------------------------
|
2007-04-19 00:55:52 +00:00
|
|
|
; The Uninstaller
|
2007-04-14 11:04:53 +00:00
|
|
|
|
2007-04-30 00:55:50 +00:00
|
|
|
!include "Uninstall.nsh"
|
2007-04-14 11:04:53 +00:00
|
|
|
|
2007-04-19 00:55:52 +00:00
|
|
|
|
2007-04-14 11:04:53 +00:00
|
|
|
; eof
|