installer: handle different ImageMagick-versions in the update installer

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_5_X@20919 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Uwe Stöhr 2007-10-11 20:27:07 +00:00
parent dd60fe4480
commit 1508a0ea8f
7 changed files with 220 additions and 12 deletions

View File

@ -3,10 +3,12 @@
- support to set Portuguese as LyX's menu language
- support to set Catalan as LyX's menu language
- LyX is build using the Qt 4.3.2 libraries, this should solve
some problems users had on Windows Vista
- this installer release comes with an update installer that allows
you to update LyX 1.5.1 to LyX 1.5.2 without the need to uninstall LyX 1.5.1
you to update LyX 1.5.1 to LyX 1.5.2 without the need to uninstall
LyX 1.5.1
- updated to MiKTeX 2.6 (version 2831)
- updated to ImageMagick 6.3.6-1

View File

@ -101,7 +101,7 @@ Section "-Installation actions" SecInstallation
WriteUninstaller "${PRODUCT_UNINSTALL_EXE}"
# test if Python is installed
# only use an existing python when it is version 2.5 because many Compaq and Dell PC are delivered
# only use an existing python when it is version 2.5 because some Compaq and Dell PC are delivered
# with outdated Python interpreters
ReadRegStr $PythonPath HKLM "Software\Python\PythonCore\2.5\InstallPath" ""
${if} $PythonPath == ""
@ -226,7 +226,44 @@ Function RefreshRegUninst
# ImageMagick
ReadRegStr $0 SHCTX "Software\ImageMagick" "OnlyWithLyX"
${if} $0 == "Yes${PRODUCT_VERSION_SHORT_OLD}"
# set the new path
WriteRegStr HKLM "SOFTWARE\ImageMagick" "OnlyWithLyX" "Yes${PRODUCT_VERSION_SHORT}"
ReadRegStr $0 HKLM "Software\ImageMagick\Current" "BinPath"
${WordReplace} $0 "${PRODUCT_VERSION_OLD}" "LyX ${PRODUCT_VERSION}" "+" $0 # macro from WordFunc.nsh
WriteRegStr HKLM "SOFTWARE\ImageMagick\Current" "BinPath" "$0"
ReadRegStr $0 HKLM "Software\ImageMagick\Current" "CoderModulesPath"
${WordReplace} $0 "${PRODUCT_VERSION_OLD}" "LyX ${PRODUCT_VERSION}" "+" $0
WriteRegStr HKLM "SOFTWARE\ImageMagick\Current" "CoderModulesPath" "$0"
ReadRegStr $0 HKLM "Software\ImageMagick\Current" "ConfigurePath"
${WordReplace} $0 "${PRODUCT_VERSION_OLD}" "LyX ${PRODUCT_VERSION}" "+" $0
WriteRegStr HKLM "SOFTWARE\ImageMagick\Current" "ConfigurePath" "$0"
ReadRegStr $0 HKLM "Software\ImageMagick\Current" "FilterModulesPath"
${WordReplace} $0 "${PRODUCT_VERSION_OLD}" "LyX ${PRODUCT_VERSION}" "+" $0
WriteRegStr HKLM "SOFTWARE\ImageMagick\Current" "FilterModulesPath" "$0"
ReadRegStr $0 HKLM "Software\ImageMagick\Current" "LibPath"
${WordReplace} $0 "${PRODUCT_VERSION_OLD}" "LyX ${PRODUCT_VERSION}" "+" $0
WriteRegStr HKLM "SOFTWARE\ImageMagick\Current" "LibPath" "$0"
WriteRegStr HKLM "SOFTWARE\ImageMagick\Current" "Version" "${ImageMagickVersion}"
${COPY_REGISTRY_KEY} HKLM "Software\ImageMagick\${ImageMagickVersion_Old}" \
HKLM "Software\ImageMagick\${ImageMagickVersion}" # macro from registry.nsh
DeleteRegKey HKLM "Software\ImageMagick\${ImageMagickVersion_Old}"
# set the new path
ReadRegStr $0 HKLM "Software\ImageMagick\${ImageMagickVersion}\Q:16" "BinPath"
${WordReplace} $0 "${PRODUCT_VERSION_OLD}" "LyX ${PRODUCT_VERSION}" "+" $0
WriteRegStr HKLM "SOFTWARE\ImageMagick\${ImageMagickVersion}\Q:16" "BinPath" "$0"
ReadRegStr $0 HKLM "Software\ImageMagick\${ImageMagickVersion}\Q:16" "CoderModulesPath"
${WordReplace} $0 "${PRODUCT_VERSION_OLD}" "LyX ${PRODUCT_VERSION}\Q:16" "+" $0
WriteRegStr HKLM "SOFTWARE\ImageMagick\${ImageMagickVersion}\Q:16" "CoderModulesPath" "$0"
ReadRegStr $0 HKLM "Software\ImageMagick\${ImageMagickVersion}\Q:16" "ConfigurePath"
${WordReplace} $0 "${PRODUCT_VERSION_OLD}" "LyX ${PRODUCT_VERSION}" "+" $0
WriteRegStr HKLM "SOFTWARE\ImageMagick\${ImageMagickVersion}\Q:16" "ConfigurePath" "$0"
ReadRegStr $0 HKLM "Software\ImageMagick\${ImageMagickVersion}\Q:16" "FilterModulesPath"
${WordReplace} $0 "${PRODUCT_VERSION_OLD}" "LyX ${PRODUCT_VERSION}" "+" $0
WriteRegStr HKLM "SOFTWARE\ImageMagick\${ImageMagickVersion}\Q:16" "FilterModulesPath" "$0"
ReadRegStr $0 HKLM "Software\ImageMagick\${ImageMagickVersion}\Q:16" "LibPath"
${WordReplace} $0 "${PRODUCT_VERSION_OLD}" "LyX ${PRODUCT_VERSION}" "+" $0
WriteRegStr HKLM "SOFTWARE\ImageMagick\${ImageMagickVersion}\Q:16" "LibPath" "$0"
${endif}
# Ghostscript and GSview

View File

@ -10,7 +10,7 @@
# 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
# This script requires NSIS 2.30 or newer
# http://nsis.sourceforge.net/
#--------------------------------
@ -80,6 +80,8 @@ Var UserName
!insertmacro LineFind
!include "WordFunc.nsh"
!insertmacro WordReplace
!include "registry.nsh"
!insertmacro COPY_REGISTRY_KEY
# Set of various macros and functions
!include "LyXUtils.nsh"

View File

@ -9,7 +9,7 @@ http://developer.berlios.de/projects/lyxwininstall/
---
General
To compile the installer scripts you need at least NSIS version 2.25.
To compile the installer scripts you need at least NSIS version 2.30.
The installer scripts needs the plugins "FindProc" and "InetLoad".
To use them, copy the files "FindProcDLL.dll" and "InetLoad.dll" from the

View File

@ -9,7 +9,7 @@ http://developer.berlios.de/projects/lyxwininstall/
---
General
To compile the installer scripts you need at least NSIS version 2.25.
To compile the installer scripts you need at least NSIS version 2.30.
The installer scripts needs the plugins "FindProc" and "InetLoad".
To use them copy the files "FindProcDLL.dll" and "InetLoad.dll" from the

View File

@ -19,12 +19,12 @@
!define PRODUCT_INFO_URL "http://www.lyx.org/"
!define LAUNCHER_EXE "$INSTDIR\bin\LyXLauncher.exe"
BrandingText "LyXWinInstaller v3.19 - ${INSTALLER_VERSION}"
BrandingText "LyXWinInstaller v3.20 - ${INSTALLER_VERSION}"
# to check later if this installer version is running at the same time
!define INSTALLER_EXE "LyX-${PRODUCT_VERSION_SHORT}-3-19-AltInstaller-${INSTALLER_VERSION}.exe"
!define INSTALLER2_EXE "LyX-${PRODUCT_VERSION_SHORT}-3-19-AltInstaller-${INSTALLER2_VERSION}.exe"
!define INSTALLER3_EXE "LyX-${PRODUCT_VERSION_SHORT}-3-19-AltInstaller-${INSTALLER3_VERSION}.exe"
!define INSTALLER_EXE "LyX-${PRODUCT_VERSION_SHORT}-3-20-AltInstaller-${INSTALLER_VERSION}.exe"
!define INSTALLER2_EXE "LyX-${PRODUCT_VERSION_SHORT}-3-20-AltInstaller-${INSTALLER2_VERSION}.exe"
!define INSTALLER3_EXE "LyX-${PRODUCT_VERSION_SHORT}-3-20-AltInstaller-${INSTALLER3_VERSION}.exe"
!define VERSION_BITMAP "${PRODUCT_DIR}\icons\lyx_logo_vert${PRODUCT_VERSION_SHORT}.bmp"
# Replaced by HKLM or HKCU depending on SetShellVarContext.
@ -38,11 +38,12 @@ BrandingText "LyXWinInstaller v3.19 - ${INSTALLER_VERSION}"
# definitions for the Update installer
!if ${INSTALLER_VERSION} == "Update"
!define PRODUCT_UNINST_KEY_OLD "Software\Microsoft\Windows\CurrentVersion\Uninstall\LyX150svn"
!define PRODUCT_UNINST_KEY_OLD "Software\Microsoft\Windows\CurrentVersion\Uninstall\LyX151"
!define PRODUCT_VERSION_OLD "LyX 1.5.1"
!define PRODUCT_UNINSTALL_EXE_OLD "$INSTDIR\LyXWinUninstall.exe"
!define PRODUCT_VERSION_SHORT_OLD "151"
!define JabRefVersion "2.2" # could be an older version
!define ImageMagickVersion_Old "6.3.5" # could be an older version
!define MiKTeXDeliveredVersion "2.6" # could be an older version
!endif
@ -56,14 +57,14 @@ BrandingText "LyXWinInstaller v3.19 - ${INSTALLER_VERSION}"
!if ${INSTALLER_VERSION} == "Complete"
!define GSviewInstall "external\gsv48w32.exe"
!define JabRefInstall "external\JabRef-2.2-Setup.exe"
!define MiKTeXInstall "$INSTDIR\external\basic-miktex-2.6.2742.exe"
!define MiKTeXInstall "$INSTDIR\external\basic-miktex-2.6.2831.exe"
!define JabRefVersion "2.2"
!define MiKTeXDeliveredVersion "2.6"
!endif
!define ClassFileDir "${PRODUCT_SOURCEDIR}\Resources\tex"
!define ImageMagickVersion "6.3.5"
!define ImageMagickVersion "6.3.6"
# for some odd reason the ImageMagick folder may not be a subfolder of $INSTDIR\bin!
!define ImageMagickDir "$INSTDIR\etc\ImageMagick"
!define GhostscriptDir "$INSTDIR\etc\Ghostscript"

View File

@ -0,0 +1,166 @@
!ifndef REGISTRY_NSH
!define REGISTRY_NSH
!include "${NSISDIR}\Examples\System\system.nsh"
!define HKEY_CLASSES_ROOT_ENUM 0x80000000
!define HKEY_CURRENT_USER_ENUM 0x80000001
!define HKEY_LOCAL_MACHINE_ENUM 0x80000002
!define HKEY_USERS_ENUM 0x80000003
!define HKEY_PERFORMANCE_DATA_ENUM 0x80000004
!define HKEY_CURRENT_CONFIG_ENUM 0x80000005
!define HKEY_DYN_DATA_ENUM 0x80000006
!define KEY_ALL_ACCESS 0x0002003F
!define RegCreateKeyEx 'advapi32::RegCreateKeyEx(i, t, i, t, i, i, i, *i, *i) i'
!define RegOpenKeyEx 'advapi32::RegOpenKeyEx(i, t, i, i, *i) i'
!define RegCloseKey 'advapi32::RegCloseKey(i) i'
!define SHCopyKey 'shlwapi::SHCopyKey(i, t, i, i) i'
####################################################################################################
!macro SET_HKEY_ENUM HKEY_NAME HKEY_ENUM LABEL
StrCmp ${HKEY_NAME} HKCR 0 +3
StrCpy ${HKEY_ENUM} ${HKEY_CLASSES_ROOT_ENUM}
GoTo ${LABEL}
StrCmp ${HKEY_NAME} HKEY_CLASSES_ROOT 0 +3
StrCpy ${HKEY_ENUM} ${HKEY_CLASSES_ROOT_ENUM}
GoTo ${LABEL}
StrCmp ${HKEY_NAME} HKCU 0 +3
StrCpy ${HKEY_ENUM} ${HKEY_CURRENT_USER_ENUM}
GoTo ${LABEL}
StrCmp ${HKEY_NAME} HKEY_CURRENT_USER 0 +3
StrCpy ${HKEY_ENUM} ${HKEY_CURRENT_USER_ENUM}
GoTo ${LABEL}
StrCmp ${HKEY_NAME} HKLM 0 +3
StrCpy ${HKEY_ENUM} ${HKEY_LOCAL_MACHINE_ENUM}
GoTo ${LABEL}
StrCmp ${HKEY_NAME} HKEY_LOCAL_MACHINE 0 +3
StrCpy ${HKEY_ENUM} ${HKEY_LOCAL_MACHINE_ENUM}
GoTo ${LABEL}
StrCmp ${HKEY_NAME} HKU 0 +3
StrCpy ${HKEY_ENUM} ${HKEY_USERS_ENUM}
GoTo ${LABEL}
StrCmp ${HKEY_NAME} HKEY_USERS 0 +3
StrCpy ${HKEY_ENUM} ${HKEY_USERS_ENUM}
GoTo ${LABEL}
StrCmp ${HKEY_NAME} HKPD 0 +3
StrCpy ${HKEY_ENUM} ${HKEY_PERFORMANCE_DATA_ENUM}
GoTo ${LABEL}
StrCmp ${HKEY_NAME} HKEY_PERFORMANCE_DATA 0 +3
StrCpy ${HKEY_ENUM} ${HKEY_PERFORMANCE_DATA_ENUM}
GoTo ${LABEL}
StrCmp ${HKEY_NAME} HKCC 0 +3
StrCpy ${HKEY_ENUM} ${HKEY_CURRENT_CONFIG_ENUM}
GoTo ${LABEL}
StrCmp ${HKEY_NAME} HKEY_CURRENT_CONFIG 0 +3
StrCpy ${HKEY_ENUM} ${HKEY_CURRENT_CONFIG_ENUM}
GoTo ${LABEL}
StrCmp ${HKEY_NAME} HKDD 0 +3
StrCpy ${HKEY_ENUM} ${HKEY_DYN_DATA_ENUM}
GoTo ${LABEL}
StrCmp ${HKEY_NAME} HKEY_DYN_DATA 0 +3
StrCpy ${HKEY_ENUM} ${HKEY_DYN_DATA_ENUM}
${LABEL}:
!macroend
####################################################################################################
!macro COPY_REGISTRY_KEY_BASE TYPE
!ifndef ${TYPE}COPY_REGISTRY_KEY_DEFINE
!define ${TYPE}COPY_REGISTRY_KEY_DEFINE
Function ${TYPE}CopyRegistryKey
Exch $1 ;Target subkey
Exch
Exch $2 ;Target key name
Exch
Exch 2
Exch $3 ;Source subkey
Exch
Exch 2
Exch 3
Exch $4 ;Source key name
Push $5 ;Source key handle
Push $6 ;Target key handle
Push $7 ;return value
Push $8 ;HKEY enum for target key
Push $9 ;HKEY enum for source key
!insertmacro SET_HKEY_ENUM $2 $8 next
!insertmacro SET_HKEY_ENUM $4 $9 next2
SetPluginUnload alwaysoff
StrCpy $5 0
System::Call '${RegOpenKeyEx}(i r9, t r3, 0, ${KEY_ALL_ACCESS}, .r5) .r7'
StrCmp $7 0 continue
DetailPrint "Registry key $4\$3 not found."
StrCpy $1 $7
GoTo done
continue:
StrCpy $6 0
System::Call '${RegCreateKeyEx}(i r8, t r1, 0, 0, 0, ${KEY_ALL_ACCESS}, 0, .r6, 0) .r7'
StrCmp $7 0 copy
MessageBox MB_OK|MB_ICONSTOP "Error $7 opening registry key $2\$1."
StrCpy $1 $7
GoTo done
copy:
System::Call '${SHCopyKey}(i r5, "", i r6, 0) .r7'
StrCmp $7 0 +2
MessageBox MB_OK|MB_ICONSTOP "Error $7 copying registry key."
StrCpy $1 $7
done:
System::Call '${RegCloseKey}(i r5) .r7'
System::Call '${RegCloseKey}(i r6) .r7'
SetPluginUnload manual
System::Free 0
Pop $9
Pop $8
Pop $7
Pop $6
Pop $5
Pop $4
Pop $3
Pop $2
Exch $1
FunctionEnd
!endif
!macroend
####################################################################################################
!macro COPY_REGISTRY_KEY
!insertmacro COPY_REGISTRY_KEY_BASE ""
!macroend
####################################################################################################
!macro UN.COPY_REGISTRY_KEY
!insertmacro COPY_REGISTRY_KEY_BASE "Un."
!macroend
####################################################################################################
!macro CALL_COPY_REGISTRY_KEY_BASE TYPE SOURCEROOTKEY SOURCESUBKEY TARGETROOTKEY TARGETSUBKEY
!ifdef ${TYPE}COPY_REGISTRY_KEY_DEFINE
Push $R1
ReadRegStr $R1 "${TARGETROOTKEY}" "${TARGETSUBKEY}" ""
IfErrors 0 +2
WriteRegStr "${TARGETROOTKEY}" "${TARGETSUBKEY}" "" ""
Pop $R1
Push "${SOURCEROOTKEY}"
Push "${SOURCESUBKEY}"
Push "${TARGETROOTKEY}"
Push "${TARGETSUBKEY}"
Call ${TYPE}CopyRegistryKey
!else
!error "Macro ${TYPE}COPY_REGISTRY_KEY not inserted"
!endif
!macroend
####################################################################################################
!macro CALL_COPY_REGISTRY_KEY SOURCEROOTKEY SOURCESUBKEY TARGETROOTKEY TARGETSUBKEY
!insertmacro CALL_COPY_REGISTRY_KEY_BASE "" "${SOURCEROOTKEY}" "${SOURCESUBKEY}" "${TARGETROOTKEY}" "${TARGETSUBKEY}"
!macroend
####################################################################################################
!macro CALL_UN.COPY_REGISTRY_KEY SOURCEROOTKEY SOURCESUBKEY TARGETROOTKEY TARGETSUBKEY
!insertmacro CALL_COPY_REGISTRY_KEY_BASE "Un." "${SOURCEROOTKEY}" "${SOURCESUBKEY}" "${TARGETROOTKEY}" "${TARGETSUBKEY}"
!macroend
####################################################################################################
!define COPY_REGISTRY_KEY "!insertmacro CALL_COPY_REGISTRY_KEY"
!define UN.COPY_REGISTRY_KEY "!insertmacro UN.CALL_COPY_REGISTRY_KEY"
!endif