commit 426ecc52a45c217802c4547dcadc03da5372a8a3
Author: Uwe Stöhr <uwesto...@lyx.org>
Date:   Sun Mar 4 21:40:16 2018 +0100

    Win installer: workaround for the MiKTeX update bug
---
 .../Win32/packaging/installer/ChangeLog.txt        |    2 +
 .../Win32/packaging/installer/include/LaTeX.nsh    |   53 +++++++++++++++++---
 development/Win32/packaging/installer/settings.nsh |    3 +-
 3 files changed, 48 insertions(+), 10 deletions(-)

diff --git a/development/Win32/packaging/installer/ChangeLog.txt 
b/development/Win32/packaging/installer/ChangeLog.txt
index 61cd73d..31f4735 100644
--- a/development/Win32/packaging/installer/ChangeLog.txt
+++ b/development/Win32/packaging/installer/ChangeLog.txt
@@ -2,6 +2,7 @@
 - installs LyX 2.3.0
 - fix installation of Arabic spell checker
 - updated to MiKTeX 2.9 build 6615
+- updated to ImageMagick 7.0.7-24
 - new thesaurus for Arabic
 - updated thesaurus for Ukrainian
 - updated spell checker dictionaries for Arabic, Breton and Ukrainian
@@ -11,6 +12,7 @@ Changelog for LyX-230-RC2:
 - installs LyX 2.3.0 RC2
 - updated to Qt 5.9.4
 - updated to ImageMagick 7.0.7-22
+- updated to NSIS 3.0.3
 
 
 Changelog for LyX-230-RC1:
diff --git a/development/Win32/packaging/installer/include/LaTeX.nsh 
b/development/Win32/packaging/installer/include/LaTeX.nsh
index 63de0e1..399ef18 100644
--- a/development/Win32/packaging/installer/include/LaTeX.nsh
+++ b/development/Win32/packaging/installer/include/LaTeX.nsh
@@ -388,21 +388,58 @@ FunctionEnd
 Function UpdateMiKTeX
  # asks to update MiKTeX
 
-  MessageBox MB_YESNO|MB_ICONINFORMATION "$(MiKTeXInfo)" /SD IDNO IDYES 
UpdateNow IDNO UpdateLater
-  UpdateNow:
-  # the update wizard is started by the miktex-update.exe
+  # only for the 2.3.0 installer: force a silent update of MiKTeX then restore
+  # MiKTeX's inernal links
+  # The reason is that MikTeX uses a new package handling system LyX must use
+  # Due to a bug in the old MikTeX package handling the update to the new 
package
+  # handling might fail and users cannot use LaTeX at all afterwards - they 
then
+  # would have no other choice than to reinstall MiKTeX
+  # This case is fixed by forcing the restoration of the internal links
+  #MessageBox MB_YESNO|MB_ICONINFORMATION "$(MiKTeXInfo)" #/SD IDNO IDYES 
UpdateNow IDNO UpdateLater
+  #UpdateNow:
+  # graphical update:
+  #MessageBox MB_OK|MB_ICONINFORMATION 'To assure that LyX can create PDF 
files the MiKTeX update program must be run two times.$\r$\n\
+  # Please click in the MiKTeX update program only on the "Next" button.$\r$\n\
+  # If "Next" is disabled, click on "Cancel" or "Finish".'
+  #${if} $MultiUser.Privileges != "Admin"
+  #${andif} $MultiUser.Privileges != "Power"
+  # # call the non-admin version
+  # nsExec::ExecToLog '"$PathLaTeX\internal\miktex-update.exe"'
+  #${else}
+  # ${if} $MiKTeXUser != "HKCU" # call the admin version
+  #  nsExec::ExecToLog '"$PathLaTeX\internal\miktex-update_admin.exe"'
+  # ${else}
+  #   nsExec::ExecToLog '"$PathLaTeX\internal\miktex-update.exe"'
+  # ${endif}
+  #${endif}
+  # silent update:
+  MessageBox MB_OK|MB_ICONINFORMATION "MiKTeX must be updated to assure that 
LyX can create PDF files.$\r$\n\
+   This update can take several minutes, depending on your Internet 
speed.$\r$\n\
+   Please do not close the LyX installer until it is finished!" /SD IDOK
   ${if} $MultiUser.Privileges != "Admin"
   ${andif} $MultiUser.Privileges != "Power"
    # call the non-admin version
-    ExecWait '"$PathLaTeX\internal\miktex-update.exe"'
+   nsExec::ExecToLog '"$PathLaTeX\mpm.exe" "--update"'
   ${else}
    ${if} $MiKTeXUser != "HKCU" # call the admin version
-    ExecWait '"$PathLaTeX\internal\miktex-update_admin.exe"'
+    nsExec::ExecToLog '"$PathLaTeX\mpm.exe" "--admin" "--update"'
    ${else}
-     ExecWait '"$PathLaTeX\internal\miktex-update.exe"'
+     nsExec::ExecToLog '"$PathLaTeX\mpm.exe" "--update"'
    ${endif}
   ${endif}
-  UpdateLater:
+  # restore possibly broken internal MiKTeX links after the update
+  # suggested by the MikTeX maintainer: 
https://github.com/MiKTeX/miktex/issues/82
+  ${if} $MultiUser.Privileges != "Admin"
+  ${andif} $MultiUser.Privileges != "Power"
+   # call the non-admin version
+   nsExec::ExecToLog '"$PathLaTeX\initexmf.exe" "--mklinks" "--force"'
+  ${else}
+   ${if} $MiKTeXUser != "HKCU" # call the admin version
+    nsExec::ExecToLog '"$PathLaTeX\initexmf.exe" "--admin" "--mklinks" 
"--force"'
+   ${else}
+     nsExec::ExecToLog '"$PathLaTeX\initexmf.exe" "--mklinks" "--force"'
+   ${endif}
+  ${endif}
+  #UpdateLater:
 
 FunctionEnd
-
diff --git a/development/Win32/packaging/installer/settings.nsh 
b/development/Win32/packaging/installer/settings.nsh
index aa7ca16..7d25cb7 100644
--- a/development/Win32/packaging/installer/settings.nsh
+++ b/development/Win32/packaging/installer/settings.nsh
@@ -14,7 +14,7 @@ These typically need to be modified for each LyX release
 !define APP_VERSION_REVISION 0
 !define APP_VERSION_EMERGENCY "" # use "1" for an emergency release of LyX 
otherwise ""
 !define APP_EMERGENCY_DOT "" # use "." for an emergency release of LyX 
otherwise ""
-!define APP_VERSION_BUILD 1 # Start with 1 for the installer releases of each 
version
+!define APP_VERSION_BUILD 3 # Start with 1 for the installer releases of each 
version
 
 !define APP_VERSION 
"${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}.${APP_VERSION_REVISION}${APP_EMERGENCY_DOT}${APP_VERSION_EMERGENCY}"
 # Version to display
 
@@ -54,4 +54,3 @@ These typically need to be modified for each LyX release
 !if ${SETUPTYPE} == BUNDLE
  !define MiKTeXInstall "$INSTDIR\external\basic-miktex-2.9.6615.exe"
 !endif
-

Reply via email to