1 # this file contains the main installer section
3 # The '-' makes the section invisible.
4 Section "-Installation actions" SecInstallation
6 # dummy actions to avoid NSIS warnings
13 File /r "${PRODUCT_SOURCEDIR}\bin"
14 File /r "${PRODUCT_SOURCEDIR}\etc"
15 File /r "${PRODUCT_SOURCEDIR}\Resources"
17 # install GhostScript if not already installed
20 # install ImageMagick if not already installed
23 # install Aspell if not already installed
24 Call InstallAspell # function from Aspell.nsh
26 # install Aiksaurus if not already installed
29 # install the LaTeX class files that are delivered with LyX
30 # and enable MiKTeX's automatic package installation
31 Call ConfigureMiKTeX # Function from LaTeX.nsh
33 # install Aspell dictionaries
34 ${if} $LangCode == "nb_NO"
35 StrCpy $LangCode "no_NO" # we only have a norwegian dictionary available
37 Call InstallAspellDictionary # function from Aspell.nsh
40 Call ConfigureLyX # Function from ConfigLyX.nsh
42 # delete unnecessary files
43 ${if} $DelPythonFiles == "True"
44 Delete $INSTDIR\bin\python.exe
45 Delete $INSTDIR\bin\python25.dll
46 Delete $INSTDIR\bin\Python-License.txt
47 RMDir /r $INSTDIR\bin\Lib
48 RMDir /r $INSTDIR\bin\DLLs
50 RMDir /r $INSTDIR\external
53 WriteUninstaller "${PRODUCT_UNINSTALL_EXE}"
55 # run LyX's configure script
56 # create a bat-file to start configure in a console window so that the user see the progress
57 # of the configuration and to have a signal when the configuration is ready to start LyX
58 # this is important when LyX is installed together with MiKTeX or when LyX is installed for the first
59 # time on a computer, because the installation of missing LaTeX-files required by LyX could last minutes
60 # a batch file is needed because simply calling ExecWait '"$PythonPath\python.exe" "$INSTDIR\Resources\configure.py"'
61 # creates the config files in $PythonPath
62 ${if} $PythonPath == ""
63 StrCpy $PythonPath "$INSTDIR\bin"
65 StrCpy $1 $INSTDIR 2 # get drive letter
66 FileOpen $R1 "$INSTDIR\Resources\configLyX.bat" w
67 FileWrite $R1 '$1$\r$\n\
68 cd $INSTDIR\Resources\$\r$\n\
69 "$PythonPath\python.exe" configure.py'
71 MessageBox MB_OK|MB_ICONINFORMATION "$(LatexConfigInfo)"
72 ExecWait '"$INSTDIR\Resources\configLyX.bat"'
73 Delete "$INSTDIR\Resources\configLyX.bat"
75 # ask to update MiKTeX
76 ${if} $MiKTeXInstalled == "yes"
77 MessageBox MB_YESNO|MB_ICONINFORMATION "$(MiKTeXInfo)" IDYES UpdateNow IDNO UpdateLater
79 StrCpy $0 $LaTeXPath -4 # remove "\bin"
80 ExecWait '"$LaTeXPath\copystart.exe" "$0\config\update.dat"' # run MiKTeX's update wizard
84 # save MiKTeX's install path to be able to remove LyX's LaTeX-files in the uninstaller
85 FileOpen $R1 "$INSTDIR\Resources\uninstallPaths.dat" w
86 FileWrite $R1 '$LaTeXPath'
89 # prepare variables for uninstaller
90 StrCpy $MiKTeXVersionVar ${MiKTeXDeliveredVersion}
91 StrCpy $JabRefVersionVar ${JabRefVersion}
95 # -------------------------------------------
99 # if GhostScript is not installed
100 ${if} $GhostscriptPath == ""
101 # register Ghostscript
102 WriteRegStr HKLM "SOFTWARE\GPL Ghostscript\${GhostscriptVersion}" "GS_DLL" "${GhostscriptDir}\bin\gsdll32.dll"
103 WriteRegStr HKLM "SOFTWARE\GPL Ghostscript\${GhostscriptVersion}" "GS_LIB" "${GhostscriptDir}\lib;${GhostscriptDir}\fonts;${GhostscriptDir}\Resource"
105 WriteRegStr HKLM "SOFTWARE\GPL Ghostscript" "OnlyWithLyX" "Yes${PRODUCT_VERSION_SHORT}" # special entry to tell the uninstaller that it was installed with LyX
106 StrCpy $GhostscriptPath "${GhostscriptDir}\bin"
108 # delete unnecessary files
109 RMDir /r ${GhostscriptDir}
114 # -------------------------------------------
118 # if ImageMagick is not installed
119 ${if} $ImageMagickPath == ""
120 # register ImageMagick
121 WriteRegStr HKLM "SOFTWARE\Classes\Applications" "AutoRun" "${ImageMagickDir}\convert.exe $$"
122 WriteRegStr HKLM "SOFTWARE\ImageMagick\${ImageMagickVersion}\Q:16" "BinPath" "${ImageMagickDir}"
123 WriteRegStr HKLM "SOFTWARE\ImageMagick\${ImageMagickVersion}\Q:16" "CoderModulesPath" "${ImageMagickDir}\modules\coders"
124 WriteRegStr HKLM "SOFTWARE\ImageMagick\${ImageMagickVersion}\Q:16" "ConfigurePath" "${ImageMagickDir}\config"
125 WriteRegStr HKLM "SOFTWARE\ImageMagick\${ImageMagickVersion}\Q:16" "FilterModulesPath" "${ImageMagickDir}\modules\filters"
126 WriteRegStr HKLM "SOFTWARE\ImageMagick\${ImageMagickVersion}\Q:16" "LibPath" "${ImageMagickDir}"
128 WriteRegStr HKLM "SOFTWARE\ImageMagick\Current" "BinPath" "${ImageMagickDir}"
129 WriteRegStr HKLM "SOFTWARE\ImageMagick\Current" "CoderModulesPath" "${ImageMagickDir}\modules\coders"
130 WriteRegStr HKLM "SOFTWARE\ImageMagick\Current" "ConfigurePath" "${ImageMagickDir}\config"
131 WriteRegStr HKLM "SOFTWARE\ImageMagick\Current" "FilterModulesPath" "${ImageMagickDir}\modules\filters"
132 WriteRegStr HKLM "SOFTWARE\ImageMagick\Current" "LibPath" "${ImageMagickDir}"
133 WriteRegDWORD HKLM "SOFTWARE\ImageMagick\Current" "QuantumDepth" 0x00000010
134 WriteRegStr HKLM "SOFTWARE\ImageMagick\Current" "Version" "${ImageMagickVersion}"
136 WriteRegStr HKLM "Software\ImageMagick" "OnlyWithLyX" "Yes${PRODUCT_VERSION_SHORT}" # special entry to tell the uninstaller that it was installed with LyX
137 StrCpy $ImageMagickPath ${ImageMagickDir}
139 # delete unnecessary files
140 RMDir /r ${ImageMagickDir}
145 # -------------------------------------------
149 # if Aiksaurus is not installed
150 ${if} $AiksaurusPath == ""
151 # extract Aiksaurus' program files
152 SetOutPath "$INSTDIR\external"
153 File /r "${PRODUCT_SOURCEDIR}\${AiksaurusInstall}"
154 # copy the files and register Aiksaurus
155 CopyFiles "$INSTDIR\${AiksaurusInstall}" "$APPDATA"
156 # WriteRegStr HKLM "Software\Aiksaurus" "OnlyWithLyX" "Yes${PRODUCT_VERSION_SHORT}" # special entry to tell the uninstaller that it was installed with LyX
157 # WriteRegStr HKLM "Software\Aiksaurus" "Data Path" "${AiksaurusDir}"