installer fixes

- LaTeX.nsh: fix handling of MiKTeX if LyX is installed without admin privileges
- configure.nsh: remove unused code
This commit is contained in:
Uwe Stöhr 2012-06-26 03:05:59 +02:00
parent 2e8ed3b3b5
commit 9146acb9fd
2 changed files with 53 additions and 47 deletions

View File

@ -31,12 +31,14 @@ Function LaTeXActions
${endif} ${endif}
${endif} ${endif}
${if} $PathLaTeX == "" # check if MiKTeX is installed only for the current user ${if} $PathLaTeX != ""
StrCpy $MiKTeXUser "HKLM" # needed later to configure MiKTeX
${else} # check if MiKTeX is installed only for the current user
ReadRegStr $String HKCU "Environment" "Path" ReadRegStr $String HKCU "Environment" "Path"
StrCpy $Search "miktex" StrCpy $Search "miktex"
Call LaTeXCheck # function from LyXUtils.nsh Call LaTeXCheck # function from LyXUtils.nsh
${if} $PathLaTeX != "" ${if} $PathLaTeX != ""
StrCpy $MiKTeXUser "HKCU" # needed later to configure MiKTeX StrCpy $MiKTeXUser "HKCU"
${endif} ${endif}
${endif} ${endif}
${if} $LaTeXName == "" # check for the MiKTeX version ${if} $LaTeXName == "" # check for the MiKTeX version
@ -117,7 +119,9 @@ FunctionEnd
ReadRegStr $String HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path" ReadRegStr $String HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path"
StrCpy $Search "miktex" StrCpy $Search "miktex"
Call LaTeXCheck # function from LyXUtils.nsh Call LaTeXCheck # function from LyXUtils.nsh
${if} $PathLaTeX == "" ${if} $PathLaTeX != ""
StrCpy $MiKTeXUser "HKLM"
${else}
StrCpy $MiKTeXUser "HKCU" StrCpy $MiKTeXUser "HKCU"
ReadRegStr $String HKCU "Environment" "Path" ReadRegStr $String HKCU "Environment" "Path"
StrCpy $Search "miktex" StrCpy $Search "miktex"
@ -125,7 +129,7 @@ FunctionEnd
${endif} ${endif}
${if} $PathLaTeX != "" ${if} $PathLaTeX != ""
# set package repository (MiKTeX's primary package repository) # set package repository (MiKTeX's primary package repository)
WriteRegStr HKLM "SOFTWARE\MiKTeX.org\MiKTeX" "OnlyWithLyX" "Yes${APP_SERIES_KEY}" # special entry to tell the uninstaller that it was installed with LyX WriteRegStr $MiKTeXUser "SOFTWARE\MiKTeX.org\MiKTeX" "OnlyWithLyX" "Yes${APP_SERIES_KEY}" # special entry to tell the uninstaller that it was installed with LyX
StrCpy $LaTeXInstalled "MiKTeX" StrCpy $LaTeXInstalled "MiKTeX"
StrCpy $MiKTeXVersion ${MiKTeXDeliveredVersion} StrCpy $MiKTeXVersion ${MiKTeXDeliveredVersion}
${else} ${else}
@ -149,8 +153,8 @@ Function ConfigureMiKTeX
# install LyX's LaTeX class and style files and a Perl interpreter # install LyX's LaTeX class and style files and a Perl interpreter
${if} $PathLaTeX != "" ${if} $PathLaTeX != ""
${if} $MultiUser.Privileges != "Admin" ${if} $MultiUser.Privileges == "Admin"
${orif} $MultiUser.Privileges != "Power" ${orif} $MultiUser.Privileges == "Power"
StrCpy $PathLaTeXLocal "$PathLaTeX" -11 # delete "\miktex\bin" StrCpy $PathLaTeXLocal "$PathLaTeX" -11 # delete "\miktex\bin"
${else} ${else}
StrCpy $PathLaTeXLocal "$APPDATA\MiKTeX\$MiKTeXVersion" StrCpy $PathLaTeXLocal "$APPDATA\MiKTeX\$MiKTeXVersion"
@ -167,16 +171,38 @@ Function ConfigureMiKTeX
${endif} ${endif}
# only install a Perl interpreter if it is not already installed # only install a Perl interpreter if it is not already installed
${ifnot} ${FileExists} "$PathLaTeXLocal\miktex\bin\perl.exe" # this is only possible if miktex and LyX is installed with the same privileges
SetOutPath "$PathLaTeXLocal" ${if} $MultiUser.Privileges != "Admin"
File /r ${FILES_MIKTEX} ${andif} $MultiUser.Privileges != "Power"
${if} $PathLaTeX != "$LOCALAPPDATA\MiKTeX\$MiKTeXVersion\miktex\bin"
${ifnot} ${FileExists} "$PathLaTeX\perl.exe"
# FIXME: output a translatable message in this case
MessageBox MB_OK "LyX's multiple index feature will not work because MiKTeX was installed with admin privileges but you don't have them."
${endif}
${else}
${ifnot} ${FileExists} "$PathLaTeX\perl.exe"
SetOutPath "$PathLaTeXLocal"
File /r ${FILES_MIKTEX}
${endif}
${endif}
${else}
${ifnot} ${FileExists} "$PathLaTeX\perl.exe"
SetOutPath "$PathLaTeXLocal"
File /r ${FILES_MIKTEX}
${endif}
${endif} ${endif}
# refresh MiKTeX's file name database (do this always to assure everything is in place) # refresh MiKTeX's file name database (do this always to assure everything is in place)
${if} $MiKTeXUser != "HKCU" # call the admin version when the user is admin ${if} $MultiUser.Privileges != "Admin"
nsExec::ExecToLog '"$PathLaTeX\initexmf --admin --update-fndb"' ${andif} $MultiUser.Privileges != "Power"
${else} # call the non-admin version
nsExec::ExecToLog '"$PathLaTeX\initexmf --update-fndb"' nsExec::ExecToLog "$PathLaTeX\initexmf --update-fndb"
${else}
${if} $MiKTeXUser != "HKCU" # call the admin version
nsExec::ExecToLog "$PathLaTeX\initexmf --admin --update-fndb"
${else}
nsExec::ExecToLog "$PathLaTeX\initexmf --update-fndb"
${endif}
${endif} ${endif}
Pop $UpdateFNDBReturn # Return value Pop $UpdateFNDBReturn # Return value
@ -213,12 +239,20 @@ Function UpdateMiKTeX
StrCpy $0 $PathLaTeX -4 # remove "\bin" StrCpy $0 $PathLaTeX -4 # remove "\bin"
# the update wizard is either started by the copystart_admin.exe # the update wizard is either started by the copystart_admin.exe
# or the miktex-update.exe (since MiKTeX 2.8) # or the miktex-update.exe (since MiKTeX 2.8)
ExecWait '"$PathLaTeX\copystart_admin.exe" "$0\config\update.dat"' # run MiKTeX's update wizard ${if} $MultiUser.Privileges != "Admin"
${if} $MiKTeXUser != "HKCU" # call the admin version when the user is admin ${andif} $MultiUser.Privileges != "Power"
ExecWait '"$PathLaTeX\internal\miktex-update_admin.exe"' # run MiKTeX's update wizard # call the non-admin version
${else} ExecWait '"$PathLaTeX\copystart.exe" "$0\config\update.dat"'
ExecWait '"$PathLaTeX\internal\miktex-update.exe"' # run MiKTeX's update wizard ExecWait '"$PathLaTeX\internal\miktex-update.exe"'
${endif} ${else}
${if} $MiKTeXUser != "HKCU" # call the admin version
ExecWait '"$PathLaTeX\copystart_admin.exe" "$0\config\update.dat"'
ExecWait '"$PathLaTeX\internal\miktex-update_admin.exe"' # run MiKTeX's update wizard
${else}
ExecWait '"$PathLaTeX\copystart.exe" "$0\config\update.dat"'
ExecWait '"$PathLaTeX\internal\miktex-update.exe"'
${endif}
${endif}
UpdateLater: UpdateLater:
${endif} ${endif}

View File

@ -163,34 +163,6 @@ Section -Configure
SectionEnd SectionEnd
#--------------------------------
# LaTeX files
/*Var UpdateFNDBReturn
Section -LaTeXFiles
# Install files in local root
${If} $PathLaTeXLocal != ""
# dvipost
SetOutPath "$PathLaTeXLocal\tex\latex\dvipost"
File "${FILES_DVIPOST_PKG}\dvipost.sty"
# LyX files in Resources\tex
SetOutPath "$PathLaTeXLocal\tex\latex\lyx"
CopyFiles /SILENT "$INSTDIR\Resources\tex\*.*" "$PathLaTeXLocal\tex\latex\lyx"
${EndIf}
# Update file name database
${If} $PathLaTeX != ""
DetailPrint $(TEXT_CONFIGURE_MIKTEXFNDB)
nsExec::ExecToLog '"$PathLaTeX\initexmf.exe" --update-fndb'
Pop $UpdateFNDBReturn # Return value
${EndIf}
SectionEnd*/
#-------------------------------- #--------------------------------
# Postscript printer for metafile to EPS converter # Postscript printer for metafile to EPS converter