2007-04-16 22:33:53 +00:00
|
|
|
Function LaTeXActions
|
2007-05-01 17:55:54 +00:00
|
|
|
# tests if MiKTeX is installed
|
|
|
|
# reads the PATH variable via the registry because NSIS' "$%Path%" variable is not updated when the PATH changes
|
2007-04-16 22:33:53 +00:00
|
|
|
|
|
|
|
ReadRegStr $String HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path"
|
|
|
|
StrCpy $Search "miktex"
|
2007-05-01 17:55:54 +00:00
|
|
|
Call LaTeXCheck # sets the path to the latex.exe to $LatexPath # Function from LyXUtils.nsh
|
|
|
|
# check if MiKTeX 2.4 or 2.5 is installed
|
2007-04-16 22:33:53 +00:00
|
|
|
StrCpy $String ""
|
|
|
|
ReadRegStr $String HKLM "Software\MiK\MiKTeX\CurrentVersion\MiKTeX" "Install Root"
|
|
|
|
${if} $String != ""
|
2007-05-01 17:55:54 +00:00
|
|
|
StrCpy $MiKTeXVersion "2.4" # needed later for the configuration of MiKTeX
|
2007-04-16 22:33:53 +00:00
|
|
|
StrCpy $LaTeXName "MiKTeX 2.4"
|
|
|
|
${endif}
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
${if} $LatexPath == "" # check if MiKTeX is installed only for the current user
|
|
|
|
# check for MiKTeX 2.5
|
2007-04-16 22:33:53 +00:00
|
|
|
ReadRegStr $String HKCU "Environment" "Path"
|
|
|
|
StrCpy $Search "miktex"
|
2007-05-01 17:55:54 +00:00
|
|
|
Call LaTeXCheck # function from LyXUtils.nsh
|
2007-04-16 22:33:53 +00:00
|
|
|
${if} $LatexPath != ""
|
2007-05-01 17:55:54 +00:00
|
|
|
StrCpy $MiKTeXUser "HKCU" # needed later to for a message about MiKTeX's install folder write permissions, see InstallActions-*.nsh
|
2007-04-16 22:33:53 +00:00
|
|
|
${endif}
|
2007-05-01 17:55:54 +00:00
|
|
|
# check for MiKTeX 2.4
|
2007-04-16 22:33:53 +00:00
|
|
|
StrCpy $String ""
|
|
|
|
ReadRegStr $String HKCU "Software\MiK\MiKTeX\CurrentVersion\MiKTeX" "Install Root"
|
|
|
|
${if} $String != ""
|
|
|
|
StrCpy $MiKTeXVersion "2.4"
|
|
|
|
StrCpy $LaTeXName "MiKTeX 2.4"
|
|
|
|
${endif}
|
|
|
|
${endif}
|
|
|
|
|
|
|
|
${if} $LatexPath != ""
|
|
|
|
StrCpy $MiKTeXInstalled "yes"
|
|
|
|
${if} $LaTeXName != "MiKTeX 2.4"
|
|
|
|
StrCpy $LaTeXName "MiKTeX 2.5"
|
|
|
|
${endif}
|
|
|
|
${endif}
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
# test if TeXLive is installed
|
|
|
|
# as described at TeXLives' homepage there should be an entry in the PATH
|
2007-04-16 22:33:53 +00:00
|
|
|
${if} $LatexPath == ""
|
|
|
|
ReadRegStr $String HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path"
|
|
|
|
StrCpy $Search "TeXLive"
|
2007-05-01 17:55:54 +00:00
|
|
|
Call LaTeXCheck # function from LyXUtils.nsh
|
2007-04-16 22:33:53 +00:00
|
|
|
${endif}
|
2007-05-01 17:55:54 +00:00
|
|
|
# check for the current user Path variable (the case when it is a live CD/DVD)
|
2007-04-16 22:33:53 +00:00
|
|
|
${if} $LatexPath == ""
|
|
|
|
ReadRegStr $String HKCU "Environment" "Path"
|
|
|
|
StrCpy $Search "texlive"
|
|
|
|
StrCpy $2 "TeXLive"
|
2007-05-01 17:55:54 +00:00
|
|
|
Call LaTeXCheck # function from LyXUtils.nsh
|
2007-04-16 22:33:53 +00:00
|
|
|
${endif}
|
2007-05-01 17:55:54 +00:00
|
|
|
# check if the variable TLroot exists (the case when it is installed using the program "tlpmgui")
|
2007-04-16 22:33:53 +00:00
|
|
|
${if} $LatexPath == ""
|
|
|
|
ReadRegStr $String HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "TLroot"
|
|
|
|
${if} $String == ""
|
2007-05-01 17:55:54 +00:00
|
|
|
ReadRegStr $String HKCU "Environment" "TLroot" # the case when installed without admin permissions
|
2007-04-16 22:33:53 +00:00
|
|
|
${endif}
|
|
|
|
StrCpy $LatexPath "$String\bin\win32"
|
2007-05-01 17:55:54 +00:00
|
|
|
# check if the latex.exe exists in the $LatexPath folder
|
|
|
|
!insertmacro FileCheck $5 "latex.exe" "$LatexPath" # macro from LyXUtils.nsh
|
2007-04-16 22:33:53 +00:00
|
|
|
${if} $5 == "False"
|
|
|
|
StrCpy $LatexPath ""
|
|
|
|
${endif}
|
|
|
|
${endif}
|
|
|
|
${if} $LatexPath != ""
|
|
|
|
${andif} $LaTeXName != "MiKTeX 2.4"
|
|
|
|
${andif} $LaTeXName != "MiKTeX 2.5"
|
|
|
|
StrCpy $LaTeXName "TeXLive"
|
|
|
|
${endif}
|
|
|
|
|
|
|
|
FunctionEnd
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
# ------------------------------
|
2007-04-16 22:33:53 +00:00
|
|
|
|
|
|
|
Function ConfigureMiKTeX
|
2007-05-01 17:55:54 +00:00
|
|
|
# installs the LaTeX class files that are delivered with LyX
|
|
|
|
# and enable MiKTeX's automatic package installation
|
2007-04-16 22:33:53 +00:00
|
|
|
|
|
|
|
StrCpy $String $LatexPath
|
|
|
|
StrCpy $Search "miktex\bin"
|
|
|
|
StrLen $3 $String
|
2007-05-01 17:55:54 +00:00
|
|
|
Call StrPoint # search the LaTeXPath for the phrase "miktex\bin" (function from LyXUtils.nsh)
|
|
|
|
${if} $Pointer != "-1" # if something was found
|
|
|
|
IntOp $Pointer $Pointer - 1 # jump before the first "\" of "\miktex\bin"
|
|
|
|
StrCpy $String $String "$Pointer" # $String is now the part before "\miktex\bin"
|
2007-05-02 19:20:12 +00:00
|
|
|
# install LyX's special LaTeX class files
|
2007-04-16 22:33:53 +00:00
|
|
|
CreateDirectory "$String\tex\latex\lyx"
|
|
|
|
SetOutPath "$String\tex\latex\lyx"
|
|
|
|
File "${ClassFileDir}\lyxchess.sty"
|
|
|
|
File "${ClassFileDir}\lyxskak.sty"
|
|
|
|
CreateDirectory "$String\tex\latex\revtex"
|
|
|
|
SetOutPath "$String\tex\latex\revtex"
|
|
|
|
File "${ClassFileDir}\revtex.cls"
|
|
|
|
CreateDirectory "$String\tex\latex\hollywood"
|
|
|
|
SetOutPath "$String\tex\latex\hollywood"
|
|
|
|
File "${ClassFileDir}\hollywood.cls"
|
|
|
|
CreateDirectory "$String\tex\latex\broadway"
|
|
|
|
SetOutPath "$String\tex\latex\broadway"
|
|
|
|
File "${ClassFileDir}\broadway.cls"
|
2007-05-01 17:55:54 +00:00
|
|
|
# install LaTeX-package dvipost (dvipost is not available for MiKTeX)
|
|
|
|
SetOutPath "$String\tex\latex\" # Should there be a final \ before "?
|
2007-04-16 22:33:53 +00:00
|
|
|
File /r "${DVIPostFileDir}"
|
|
|
|
|
|
|
|
${if} $MiKTeXVersion == "2.4"
|
2007-05-01 17:55:54 +00:00
|
|
|
# refresh MiKTeX's file name database
|
2007-04-16 22:33:53 +00:00
|
|
|
ExecWait "$String\miktex\bin\initexmf --update-fndb"
|
2007-05-01 17:55:54 +00:00
|
|
|
# delete MiKTeX 2.4's dvipng executable as it is an old broken version. Then install a working one.
|
2007-04-16 22:33:53 +00:00
|
|
|
Delete "$String\miktex\bin\dvipng.exe"
|
2007-05-01 17:55:54 +00:00
|
|
|
# Install a new one
|
2007-04-16 22:33:53 +00:00
|
|
|
SetOutPath "$String\miktex\bin"
|
|
|
|
File "${PRODUCT_DIR}\LyX\external\dvipng.exe"
|
2007-05-01 17:55:54 +00:00
|
|
|
# enable package installation without asking (1=Yes, 0=No, 2=Always Ask Before Installing)
|
2007-04-16 22:33:53 +00:00
|
|
|
WriteRegStr HKCU "SOFTWARE\MiK\MiKTeX\CurrentVersion\MiKTeX" "InstallPackagesOnTheFly" "1"
|
|
|
|
WriteRegStr HKCU "SOFTWARE\MiK\MiKTeX\CurrentVersion\MPM\Settings" "" ""
|
2007-05-01 17:55:54 +00:00
|
|
|
# Setting package repository (MiKTeX's primary package repository)
|
2007-04-16 22:33:53 +00:00
|
|
|
WriteRegStr HKCU "SOFTWARE\MiK\MiKTeX\CurrentVersion\MPM" "RemotePackageRepository" "${MiKTeXRepo}"
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
${else} # if MiKTeX 2.5
|
|
|
|
# refresh MiKTeX's file name database
|
2007-04-16 22:33:53 +00:00
|
|
|
ExecWait "$LaTeXPath\initexmf --update-fndb"
|
2007-05-01 17:55:54 +00:00
|
|
|
# enable package installation without asking (t = Yes, f = No)
|
|
|
|
WriteRegStr HKCU "SOFTWARE\MiKTeX.org\MiKTeX\2.5\MPM" "AutoInstall" "1" # if only for curent user
|
2007-04-16 22:33:53 +00:00
|
|
|
WriteRegStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "MIKTEX_AUTOINSTALL" "t"
|
2007-05-01 17:55:54 +00:00
|
|
|
# set package repository (MiKTeX's primary package repository)
|
|
|
|
WriteRegStr HKCU "SOFTWARE\MiKTeX.org\MiKTeX\2.5\MPM" "RemoteRepository" "${MiKTeXRepo}" # if only for curent user
|
|
|
|
WriteRegStr HKCU "SOFTWARE\MiKTeX.org\MiKTeX\2.5\MPM" "RepositoryType" "remote" # if only for curent user
|
2007-04-16 22:33:53 +00:00
|
|
|
WriteRegStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "MIKTEX_REPOSITORY" "${MiKTeXRepo}"
|
|
|
|
${endif}
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
# enable MiKTeX's automatic package installation
|
2007-04-16 22:33:53 +00:00
|
|
|
ExecWait '$LaTeXPath\mpm.com --update-fndb'
|
2007-05-01 17:55:54 +00:00
|
|
|
# the following feature is planned to be used for a possible CD-version
|
|
|
|
# copy LaTeX-packages needed by LyX
|
|
|
|
# SetOutPath "$INSTDIR"
|
|
|
|
# File /r "${LaTeXPackagesDir}"
|
|
|
|
${endif} # end ${if} $Pointer
|
2007-04-16 22:33:53 +00:00
|
|
|
|
|
|
|
FunctionEnd
|