Win installer: code review

- use https in URLs
- remove some unused code
- use variables if possible
This commit is contained in:
Uwe Stöhr 2017-12-06 15:36:01 +01:00
parent 7ae81dd4d7
commit a5d0909c6d
6 changed files with 22 additions and 43 deletions

View File

@ -44,7 +44,7 @@ Configuration of LyX installer
!define APP_NAME "LyX" !define APP_NAME "LyX"
!define APP_VERSION_NUMBER "${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}.${APP_VERSION_REVISION}.${APP_VERSION_BUILD}" !define APP_VERSION_NUMBER "${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}.${APP_VERSION_REVISION}.${APP_VERSION_BUILD}"
# for the proposed install folder we use the scheme "LyX 2.1" while we need for the registry the scheme "LyX 2.1.4" # for the proposed install folder we use the scheme "LyX 2.2" while we need for the registry the scheme "LyX 2.1.4"
# to check if it is exactly this version (to support side by side installations) # to check if it is exactly this version (to support side by side installations)
!define APP_SERIES_NAME "${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}" !define APP_SERIES_NAME "${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}"
!define APP_SERIES_KEY "${APP_VERSION_MAJOR}${APP_VERSION_MINOR}${APP_VERSION_REVISION}${APP_VERSION_EMERGENCY}" !define APP_SERIES_KEY "${APP_VERSION_MAJOR}${APP_VERSION_MINOR}${APP_VERSION_REVISION}${APP_VERSION_EMERGENCY}"
@ -53,11 +53,11 @@ Configuration of LyX installer
!define APP_DIR "${APP_NAME} ${APP_SERIES_NAME}" !define APP_DIR "${APP_NAME} ${APP_SERIES_NAME}"
!define APP_DIR_USERDATA "${APP_NAME}${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}" !define APP_DIR_USERDATA "${APP_NAME}${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}"
!define APP_INFO "${APP_NAME} - The Document Processor" !define APP_INFO "${APP_NAME} - The Document Processor"
!define APP_WEBPAGE "http://www.lyx.org/" !define APP_WEBPAGE "https://www.lyx.org/"
!define APP_WEBPAGE_INFO "${APP_NAME} Website" !define APP_WEBPAGE_INFO "${APP_NAME} Website"
!define APP_WIKI "http://wiki.lyx.org" !define APP_WIKI "https://wiki.lyx.org"
!define APP_WIKI_INFO "${APP_NAME} Wiki" !define APP_WIKI_INFO "${APP_NAME} Wiki"
!define APP_COPYRIGHT "LyX is Copyright © 1995 by Matthias Ettrich, 1995-${COPYRIGHT_YEAR} by the LyX Team" !define APP_COPYRIGHT "${APP_NAME} is Copyright © 1995 by Matthias Ettrich, 1995-${COPYRIGHT_YEAR} by the ${APP_NAME} Team"
!if ${SETUPTYPE} == STANDARD !if ${SETUPTYPE} == STANDARD
!define APP_SETUPTYPE "Standard" !define APP_SETUPTYPE "Standard"
!else if ${SETUPTYPE} == BUNDLE !else if ${SETUPTYPE} == BUNDLE

View File

@ -47,7 +47,7 @@ BrandingText " "
# Specify where to install program shortcuts. # Specify where to install program shortcuts.
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder" !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "LyX ${APP_SERIES_NAME}" !define MUI_STARTMENUPAGE_DEFAULTFOLDER "${APP_NAME} ${APP_SERIES_NAME}"
!insertmacro MUI_PAGE_STARTMENU ${APP_NAME} $StartmenuFolder !insertmacro MUI_PAGE_STARTMENU ${APP_NAME} $StartmenuFolder
!if ${SETUPTYPE} != BUNDLE !if ${SETUPTYPE} != BUNDLE
@ -70,7 +70,7 @@ BrandingText " "
!define MUI_FINISHPAGE_SHOWREADME_FUNCTION StartLyX !define MUI_FINISHPAGE_SHOWREADME_FUNCTION StartLyX
!define MUI_FINISHPAGE_SHOWREADME_TEXT $(FinishPageRun) !define MUI_FINISHPAGE_SHOWREADME_TEXT $(FinishPageRun)
!define MUI_FINISHPAGE_LINK $(TEXT_FINISH_WEBSITE) !define MUI_FINISHPAGE_LINK $(TEXT_FINISH_WEBSITE)
!define MUI_FINISHPAGE_LINK_LOCATION "http://www.lyx.org/" !define MUI_FINISHPAGE_LINK_LOCATION "https://www.lyx.org/"
#!define MUI_PAGE_CUSTOMFUNCTION_SHOW CheckDesktopShortcut #!define MUI_PAGE_CUSTOMFUNCTION_SHOW CheckDesktopShortcut
!insertmacro MUI_PAGE_FINISH !insertmacro MUI_PAGE_FINISH
@ -97,6 +97,6 @@ VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductVersion" "${APP_NAME} ${APP_VERSIO
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "${APP_INFO}" VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "${APP_INFO}"
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "${APP_VERSION}" VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "${APP_VERSION}"
VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "${APP_COPYRIGHT}" VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "${APP_COPYRIGHT}"
VIAddVersionKey /LANG=${LANG_ENGLISH} "CompanyName" "LyX Team" VIAddVersionKey /LANG=${LANG_ENGLISH} "CompanyName" "${APP_NAME} Team"
# Fixme: LyX should register the name LyX as trademark # Fixme: LyX should register the name "LyX" as trademark
VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalTrademarks" "" VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalTrademarks" ""

View File

@ -620,7 +620,7 @@ Function .onInit
!endif !endif
# Check that LyX is not currently running # Check that LyX is not currently running
FindProcDLL::FindProc "lyx.exe" FindProcDLL::FindProc "${BIN_LYX}"
${if} $R0 == "1" ${if} $R0 == "1"
MessageBox MB_OK|MB_ICONSTOP "$(UnInstallRunning)" /SD IDOK MessageBox MB_OK|MB_ICONSTOP "$(UnInstallRunning)" /SD IDOK
Abort Abort
@ -650,7 +650,7 @@ Function .onInit
# because he won't have a chance to deny this # because he won't have a chance to deny this
StrCpy $4 $0 -10 # remove '\bin\lyx,0' StrCpy $4 $0 -10 # remove '\bin\lyx,0'
# (for FileCheck the variables $0 and $1 cannot be used) # (for FileCheck the variables $0 and $1 cannot be used)
!insertmacro FileCheck $5 "Uninstall-LyX.exe" "$4" # macro from LyXUtils.nsh !insertmacro FileCheck $5 "Uninstall-${APP_NAME}.exe" "$4" # macro from LyXUtils.nsh
${if} $5 == "False" ${if} $5 == "False"
Goto ForceInstallation Goto ForceInstallation
${endif} ${endif}
@ -1429,7 +1429,7 @@ Function un.onInit
!insertmacro MULTIUSER_UNINIT !insertmacro MULTIUSER_UNINIT
# Check that LyX is not currently running # Check that LyX is not currently running
FindProcDLL::FindProc "lyx.exe" FindProcDLL::FindProc "${BIN_LYX}"
${if} $R0 == "1" ${if} $R0 == "1"
MessageBox MB_OK|MB_ICONSTOP "$(UnInstallRunning)" /SD IDOK MessageBox MB_OK|MB_ICONSTOP "$(UnInstallRunning)" /SD IDOK
Abort Abort

View File

@ -26,10 +26,10 @@ These typically need to be modified for each LyX release
# Typical names for the release are "LyX-211-Installer-1.exe" etc. # Typical names for the release are "LyX-211-Installer-1.exe" etc.
!ifndef ExeFile !ifndef ExeFile
!define ExeFile "LyX-${APP_VERSION_MAJOR}${APP_VERSION_MINOR}${APP_VERSION_REVISION}${APP_VERSION_EMERGENCY}-Installer-${APP_VERSION_BUILD}.exe" !define ExeFile "${APP_NAME}-${APP_VERSION_MAJOR}${APP_VERSION_MINOR}${APP_VERSION_REVISION}${APP_VERSION_EMERGENCY}-Installer-${APP_VERSION_BUILD}.exe"
!endif !endif
!ifndef BundleExeFile !ifndef BundleExeFile
!define BundleExeFile "LyX-${APP_VERSION_MAJOR}${APP_VERSION_MINOR}${APP_VERSION_REVISION}${APP_VERSION_EMERGENCY}-Bundle-${APP_VERSION_BUILD}.exe" !define BundleExeFile "${APP_NAME}-${APP_VERSION_MAJOR}${APP_VERSION_MINOR}${APP_VERSION_REVISION}${APP_VERSION_EMERGENCY}-Bundle-${APP_VERSION_BUILD}.exe"
!endif !endif
#-------------------------------- #--------------------------------

View File

@ -48,9 +48,9 @@ Section -InstallData
WriteRegStr SHCTX ${APP_UNINST_KEY} "DisplayVersion" "${APP_VERSION}" WriteRegStr SHCTX ${APP_UNINST_KEY} "DisplayVersion" "${APP_VERSION}"
WriteRegStr SHCTX ${APP_UNINST_KEY} "DisplayIcon" "$INSTDIR\bin\lyx,0" WriteRegStr SHCTX ${APP_UNINST_KEY} "DisplayIcon" "$INSTDIR\bin\lyx,0"
WriteRegStr SHCTX ${APP_UNINST_KEY} "URLUpdateInfo" "${APP_WEBPAGE}" WriteRegStr SHCTX ${APP_UNINST_KEY} "URLUpdateInfo" "${APP_WEBPAGE}"
WriteRegStr SHCTX ${APP_UNINST_KEY} "URLInfoAbout" "http://www.lyx.org/AboutLyX" WriteRegStr SHCTX ${APP_UNINST_KEY} "URLInfoAbout" "https://www.lyx.org/AboutLyX"
WriteRegStr SHCTX ${APP_UNINST_KEY} "Publisher" "LyX Team" WriteRegStr SHCTX ${APP_UNINST_KEY} "Publisher" "${APP_NAME} Team"
WriteRegStr SHCTX ${APP_UNINST_KEY} "HelpLink" "http://www.lyx.org/MailingLists" WriteRegStr SHCTX ${APP_UNINST_KEY} "HelpLink" "https://www.lyx.org/MailingLists"
WriteRegDWORD SHCTX ${APP_UNINST_KEY} "NoModify" 0x00000001 WriteRegDWORD SHCTX ${APP_UNINST_KEY} "NoModify" 0x00000001
WriteRegDWORD SHCTX ${APP_UNINST_KEY} "NoRepair" 0x00000001 WriteRegDWORD SHCTX ${APP_UNINST_KEY} "NoRepair" 0x00000001
WriteRegStr SHCTX ${APP_UNINST_KEY} "StartMenu" "$SMPROGRAMS\$StartmenuFolder" WriteRegStr SHCTX ${APP_UNINST_KEY} "StartMenu" "$SMPROGRAMS\$StartmenuFolder"
@ -267,34 +267,13 @@ Section -ConfigureScript
SectionEnd SectionEnd
#-------------------------------- #--------------------------------
# Desktop shortcut #
Function StartLyX Function StartLyX
# run LyX in a command line window to give the users feedback about # run LyX in a command line window to give the users feedback about
# the time consuming LaTeX package installation # the time consuming LaTeX package installation
#Exec 'cmd /K " "$INSTDIR\bin\lyx.exe""'
Exec "$INSTDIR\${APP_RUN}" Exec "$INSTDIR\${APP_RUN}"
FunctionEnd FunctionEnd
/*Function CheckDesktopShortcut
# Enable desktop icon creation when there is an icon already
# Old shortcuts need to be updated
${If} ${FileExists} "$DESKTOP\${APP_NAME} ${APP_SERIES_NAME}.lnk"
${NSD_SetState} $mui.FinishPage.ShowReadme ${BST_CHECKED}
${EndIf}
FunctionEnd
Function CreateDesktopShortcut
# Desktop icon creation is an option on the finish page
SetOutPath "$INSTDIR\bin"
CreateShortCut "$DESKTOP\${APP_NAME} ${APP_SERIES_NAME}.lnk" "$INSTDIR\${APP_RUN}" "" "$INSTDIR\${APP_RUN}" "" "" "" "${APP_INFO}"
FunctionEnd*/

View File

@ -63,7 +63,7 @@ Section "un.LyX" un.SecUnProgramFiles
${endif} ${endif}
${endif} ${endif}
${if} $MultiUser.Privileges == "Admin" ${if} $MultiUser.Privileges == "Admin"
DeleteRegKey HKCR "LyX.Document" DeleteRegKey HKCR "${APP_NAME}.Document"
${endif} ${endif}
# Uninstaller itself # Uninstaller itself
@ -77,9 +77,9 @@ Section "un.LyX" un.SecUnProgramFiles
DeleteRegKey SHCTX "${APP_REGKEY_SETUP}" DeleteRegKey SHCTX "${APP_REGKEY_SETUP}"
DeleteRegKey SHCTX "${APP_REGKEY}" DeleteRegKey SHCTX "${APP_REGKEY}"
DeleteRegKey SHCTX "${APP_UNINST_KEY}" DeleteRegKey SHCTX "${APP_UNINST_KEY}"
DeleteRegKey HKCR "Applications\lyx.exe" DeleteRegKey HKCR "Applications\${BIN_LYX}"
DeleteRegValue HKCR "LyX.Document\Shell\open\command" "" DeleteRegValue HKCR "${APP_NAME}.Document\Shell\open\command" ""
DeleteRegValue HKCR "LyX.Document\DefaultIcon" "" DeleteRegValue HKCR "${APP_NAME}.Document\DefaultIcon" ""
# File associations # File associations
ReadRegStr $FileAssociation SHELL_CONTEXT "Software\Classes\${APP_EXT}" "" ReadRegStr $FileAssociation SHELL_CONTEXT "Software\Classes\${APP_EXT}" ""
@ -115,7 +115,7 @@ Section /o "un.$(UnLyXPreferencesTitle)" un.SecUnPreferences
StrCpy $AppSubfolder ${APP_DIR_USERDATA} StrCpy $AppSubfolder ${APP_DIR_USERDATA}
Call un.DelAppPathSub # function from LyXUtils.nsh Call un.DelAppPathSub # function from LyXUtils.nsh
# remove registry settings # remove registry settings
DeleteRegKey HKCU "Software\LyX\LyX${APP_SERIES_NAME}" DeleteRegKey HKCU "Software\${APP_NAME}\${APP_NAME}${APP_SERIES_NAME}"
SectionEnd SectionEnd