]> git.lyx.org Git - features.git/commitdiff
Win installer: code review
authorUwe Stöhr <uwestoehr@lyx.org>
Wed, 6 Dec 2017 14:31:10 +0000 (15:31 +0100)
committerUwe Stöhr <uwestoehr@lyx.org>
Wed, 6 Dec 2017 14:31:10 +0000 (15:31 +0100)
- use https in URLs
- remove unused code
- use variables if possible
- LyX 2.3.x won't support Windows Vista because Qt 5.9 does not and other third-party programs will follow soon

development/Win32/packaging/installer/include/declarations.nsh
development/Win32/packaging/installer/include/gui.nsh
development/Win32/packaging/installer/include/init.nsh
development/Win32/packaging/installer/settings.nsh
development/Win32/packaging/installer/setup/configure.nsh
development/Win32/packaging/installer/setup/install.nsh
development/Win32/packaging/installer/setup/uninstall.nsh

index 1720eb0fe61c80632731438f248bfe8c015f97f3..82d428cea6ca811434ae923e6e8219df1ff66fd2 100644 (file)
@@ -44,7 +44,7 @@ Configuration of LyX installer
 
 !define APP_NAME "LyX"
 !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)
 !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}"
@@ -53,11 +53,11 @@ Configuration of LyX installer
 !define APP_DIR "${APP_NAME} ${APP_SERIES_NAME}"
 !define APP_DIR_USERDATA "${APP_NAME}${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}"
 !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_WIKI "http://wiki.lyx.org"
+!define APP_WIKI "https://wiki.lyx.org"
 !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
   !define APP_SETUPTYPE "Standard"
 !else if ${SETUPTYPE} == BUNDLE
index b5fdb441e4d4fea6cc64dec145dd8955c000fb9e..b077677f424f18f1ff7816949558aad3a3240b84 100644 (file)
@@ -47,7 +47,7 @@ BrandingText " "
 
 # Specify where to install program shortcuts.
 !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
 
 !if ${SETUPTYPE} != BUNDLE
@@ -70,7 +70,7 @@ BrandingText " "
 !define MUI_FINISHPAGE_SHOWREADME_FUNCTION StartLyX
 !define MUI_FINISHPAGE_SHOWREADME_TEXT $(FinishPageRun)
 !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
 !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} "FileVersion" "${APP_VERSION}"
 VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "${APP_COPYRIGHT}"
-VIAddVersionKey /LANG=${LANG_ENGLISH} "CompanyName" "LyX Team"
-# Fixme: LyX should register the name LyX as trademark
+VIAddVersionKey /LANG=${LANG_ENGLISH} "CompanyName" "${APP_NAME} Team"
+# Fixme: LyX should register the name "LyX" as trademark
 VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalTrademarks" ""
index bc85927bc75e3ce80730c92fcef7f3c869df8f32..f30c5b389645d616be27ff24d4565d659ab52de5 100644 (file)
@@ -599,7 +599,8 @@ Function .onInit
   ${if} $R0 == "5.0" # 2000
   ${orif} $R0 == "5.1" # XP
   ${orif} $R0 == "5.2" # 2003
-    MessageBox MB_OK|MB_ICONSTOP "${APP_NAME} ${APP_VERSION} requires Windows Vista or newer." /SD IDOK
+  ${orif} $R0 == "6.0" # Vista
+    MessageBox MB_OK|MB_ICONSTOP "${APP_NAME} ${APP_VERSION} requires Windows 7 or newer." /SD IDOK
     Quit
   ${endif}
   
@@ -620,7 +621,7 @@ Function .onInit
   !endif
   
   # Check that LyX is not currently running
-  FindProcDLL::FindProc "lyx.exe"
+  FindProcDLL::FindProc "${BIN_LYX}"
   ${if} $R0 == "1"
    MessageBox MB_OK|MB_ICONSTOP "$(UnInstallRunning)" /SD IDOK
    Abort
@@ -650,7 +651,7 @@ Function .onInit
    # because he won't have a chance to deny this
    StrCpy $4 $0 -10 # remove '\bin\lyx,0'
    # (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"
     Goto ForceInstallation
    ${endif}
@@ -1429,7 +1430,7 @@ Function un.onInit
   !insertmacro MULTIUSER_UNINIT
 
   # Check that LyX is not currently running
-  FindProcDLL::FindProc "lyx.exe"
+  FindProcDLL::FindProc "${BIN_LYX}"
   ${if} $R0 == "1"
    MessageBox MB_OK|MB_ICONSTOP "$(UnInstallRunning)" /SD IDOK
    Abort
index d597789c89ae638e7181b557581840714745b21f..28936a63d1b9e0549c44621c6037635bba47ae84 100644 (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.
 
 !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
 !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
 
 #--------------------------------
index aaeca97f476d76e69d39712bde7488180a3a140d..80585073a295ecc480630a3b9a3dbcc1b4708dbe 100644 (file)
@@ -48,9 +48,9 @@ Section -InstallData
   WriteRegStr SHCTX ${APP_UNINST_KEY} "DisplayVersion" "${APP_VERSION}"
   WriteRegStr SHCTX ${APP_UNINST_KEY} "DisplayIcon" "$INSTDIR\bin\lyx,0"
   WriteRegStr SHCTX ${APP_UNINST_KEY} "URLUpdateInfo" "${APP_WEBPAGE}"
-  WriteRegStr SHCTX ${APP_UNINST_KEY} "URLInfoAbout" "http://www.lyx.org/AboutLyX"
-  WriteRegStr SHCTX ${APP_UNINST_KEY} "Publisher" "LyX Team"
-  WriteRegStr SHCTX ${APP_UNINST_KEY} "HelpLink" "http://www.lyx.org/MailingLists"
+  WriteRegStr SHCTX ${APP_UNINST_KEY} "URLInfoAbout" "https://www.lyx.org/AboutLyX"
+  WriteRegStr SHCTX ${APP_UNINST_KEY} "Publisher" "${APP_NAME} Team"
+  WriteRegStr SHCTX ${APP_UNINST_KEY} "HelpLink" "https://www.lyx.org/MailingLists"
   WriteRegDWORD SHCTX ${APP_UNINST_KEY} "NoModify" 0x00000001
   WriteRegDWORD SHCTX ${APP_UNINST_KEY} "NoRepair" 0x00000001
   WriteRegStr SHCTX ${APP_UNINST_KEY} "StartMenu" "$SMPROGRAMS\$StartmenuFolder"
@@ -265,34 +265,13 @@ Section -ConfigureScript
 SectionEnd
 
 #--------------------------------
-# Desktop shortcut
+#
 
 Function StartLyX
 
   # run LyX in a command line window to give the users feedback about
   # the time consuming LaTeX package installation
   
-  #Exec 'cmd /K " "$INSTDIR\bin\lyx.exe""'
   Exec "$INSTDIR\${APP_RUN}"
 
 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*/
-
index 40e014d0ce1445811f81da9714be33bf02a206cc..bc5b38bf6f3394e88b3ab8ddf023c3a1944457c8 100644 (file)
@@ -161,125 +161,3 @@ Section -ProgramFiles SecProgramFiles
   WriteUninstaller "$INSTDIR\${SETUP_UNINSTALLER}"
 
 SectionEnd
-
-#--------------------------------
-# Support code for file downloads
-
-!macro DOWNLOAD_FILE RET ID FILENAME APPEND
-
-  # Downloads a file
-  
-  # RET = Return value (OK if succesful)
-  # ID = Name of the download in settings.nsh
-  # FILENAME = Location to store file
-  # APPEND = Filename to append to server location in settings.nsh
-
-  # Try first time
-  NSISdl::download "${DOWNLOAD_${ID}}${APPEND}" "$PLUGINSDIR\${FILENAME}"
-  Pop ${RET} # Return value (OK if succesful)
-
-  ${If} ${RET} != "success"
-    ${AndIf} ${RET} != "cancel"
-    # Download failed, try once again before giving up
-    # (usally we get a different mirror)
-    NSISdl::download "${DOWNLOAD_${ID}}${APPEND}" "$PLUGINSDIR\${FILENAME}"
-    Pop ${RET}
-  ${EndIf}
-
-!macroend
-
-#--------------------------------
-# External components
-
-#Var PathAllUsers
-#Var PathCurrentUser
-
-!macro EXTERNAL COMPONENT
-
-  # Download/Install the component
-  
-  ${If} $Setup${COMPONENT} == ${TRUE}
-  
-    StrCpy $Path${COMPONENT} "" ;A new one will be installed
-  
-    !ifndef BUNDLESETUP_${COMPONENT}
-      !insertmacro EXTERNAL_DOWNLOAD ${COMPONENT}
-    !else
-      !insertmacro EXTERNAL_INSTALL ${COMPONENT}
-    !endif
-    
-  ${EndIf}
-
-!macroend
-
-!macro EXTERNAL_RUNINSTALLER COMPONENT
-
-  # Run the installer application of the component that does the actual installation.
-
-  install_${COMPONENT}:
-      
-    ExecWait '"$PLUGINSDIR\${COMPONENT}Setup.exe"'
-    
-    # Updates the path environment variable of the installer process to the latest system value
-#    ReadRegStr $PathAllUsers HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" Path
-#    ReadRegStr $PathCurrentUser HKCU "Environment" Path
-#    System::Call 'kernel32::SetEnvironmentVariableA(t, t) i("Path", "$PathAllUsers;$PathCurrentUser").'
-
-    Call Search${COMPONENT}
-    
-    ${If} $Path${COMPONENT} == ""  
-      MessageBox MB_YESNO|MB_ICONEXCLAMATION $(TEXT_NOTINSTALLED_${COMPONENT}) IDYES install_${COMPONENT}
-    ${EndIf}
-      
-    Delete "$PLUGINSDIR\${COMPONENT}Setup.exe"
-     
-!macroend
-
-!macro EXTERNAL_DOWNLOAD COMPONENT
-
-  download_${COMPONENT}:
-
-    !insertmacro DOWNLOAD_FILE $DownloadResult "${COMPONENT}" "${COMPONENT}Setup.exe" ""
-    ${If} $DownloadResult != "success"
-      ${AndIf} $DownloadResult != "cancel"
-      # Download failed after trying twice - ask user
-      MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(TEXT_DOWNLOAD_FAILED_${COMPONENT}) ($DownloadResult)" IDYES download_${COMPONENT}
-      Goto noinstall_${COMPONENT}
-    ${EndIf}
-      
-    !insertmacro EXTERNAL_RUNINSTALLER ${COMPONENT}
-      
-  noinstall_${COMPONENT}:
-
-!macroend
-
-!macro EXTERNAL_INSTALL COMPONENT
-
-  # Extract
-  File /oname=$PLUGINSDIR\${COMPONENT}Setup.exe ${FILES_BUNDLE}\${INSTALL_${COMPONENT}}
-    
-  !insertmacro EXTERNAL_RUNINSTALLER ${COMPONENT}
-    
-!macroend
-
-
-# Sections for external components
-
-#Section -LaTeX ExternalLaTeX
-#  !insertmacro EXTERNAL LaTeX
-#SectionEnd
-
-/*Function InitExternal
-
-  # Get sizes of external component installers
-  
-  #SectionGetSize ${ExternalLaTeX} $SizeLaTeX
-  
-  # Add download size
-  
-  !ifndef BUNDLESETUP_MIKTEX
-    IntOp $SizeLaTeX $SizeLaTeX + ${SIZE_DOWNLOAD_LATEX}
-  !endif
-
-FunctionEnd*/
index 35e4df13217829349b5acb63fc5e935e22e1ba61..8767c6e0fafca91b09e35daac996aba2ece0638f 100644 (file)
@@ -63,7 +63,7 @@ Section "un.LyX" un.SecUnProgramFiles
    ${endif}
   ${endif}
   ${if} $MultiUser.Privileges == "Admin"
-   DeleteRegKey HKCR "LyX.Document"
+   DeleteRegKey HKCR "${APP_NAME}.Document"
   ${endif}
 
   # Uninstaller itself
@@ -77,9 +77,9 @@ Section "un.LyX" un.SecUnProgramFiles
   DeleteRegKey SHCTX "${APP_REGKEY_SETUP}"
   DeleteRegKey SHCTX "${APP_REGKEY}"
   DeleteRegKey SHCTX "${APP_UNINST_KEY}"
-  DeleteRegKey HKCR "Applications\lyx.exe"
-  DeleteRegValue HKCR "LyX.Document\Shell\open\command" ""
-  DeleteRegValue HKCR "LyX.Document\DefaultIcon" ""
+  DeleteRegKey HKCR "Applications\${BIN_LYX}"
+  DeleteRegValue HKCR "${APP_NAME}.Document\Shell\open\command" ""
+  DeleteRegValue HKCR "${APP_NAME}.Document\DefaultIcon" ""
   
   # File associations
   ReadRegStr $FileAssociation SHELL_CONTEXT "Software\Classes\${APP_EXT}" ""
@@ -115,7 +115,7 @@ Section /o "un.$(UnLyXPreferencesTitle)" un.SecUnPreferences
  StrCpy $AppSubfolder ${APP_DIR_USERDATA}
  Call un.DelAppPathSub # function from LyXUtils.nsh
  # remove registry settings
- DeleteRegKey HKCU "Software\LyX\LyX${APP_SERIES_NAME}"
+ DeleteRegKey HKCU "Software\${APP_NAME}\${APP_NAME}${APP_SERIES_NAME}"
   
 SectionEnd