]> git.lyx.org Git - lyx.git/blob - development/Win32/packaging/installer/LyXWinInstaller/InstallActions-small.nsh
installer updates
[lyx.git] / development / Win32 / packaging / installer / LyXWinInstaller / InstallActions-small.nsh
1 # this file contains the main installer section
2
3 # The '-' makes the section invisible.
4 Section "-Installation actions" SecInstallation
5
6   # dummy actions to avoid NSIS warnings
7   StrCpy $FileName ""
8   StrCpy $NewString ""
9   StrCpy $OldString ""
10   
11   # extract all files
12   SetOutPath "$INSTDIR"
13   File /r "${PRODUCT_SOURCEDIR}\bin"
14   File /r "${PRODUCT_SOURCEDIR}\etc"
15   File /r "${PRODUCT_SOURCEDIR}\Resources"
16
17   # install GhostScript if not already installed
18   Call Ghostscript
19
20   # install ImageMagick if not already installed
21   Call ImageMagick
22
23   # install Aspell if not already installed
24   Call InstallAspell # function from Aspell.nsh
25
26   # install Aiksaurus if not already installed
27   Call Aiksaurus
28
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
32
33   # install Aspell dictionaries
34   ${if} $LangCode == "nb_NO"
35    StrCpy $LangCode "no_NO" # we only have a norwegian dictionary available
36   ${endif}
37   Call InstallAspellDictionary # function from Aspell.nsh
38
39   # configure LyX
40   Call ConfigureLyX # Function from ConfigLyX.nsh
41
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
49   ${endif}
50   RMDir /r $INSTDIR\external
51
52   # create Uninstaller
53   WriteUninstaller "${PRODUCT_UNINSTALL_EXE}"
54
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"
64   ${endif}
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'
70   FileClose $R1
71   MessageBox MB_OK|MB_ICONINFORMATION "$(LatexConfigInfo)"
72   ExecWait '"$INSTDIR\Resources\configLyX.bat"'
73   Delete "$INSTDIR\Resources\configLyX.bat"
74
75   # ask to update MiKTeX
76   ${if} $MiKTeXInstalled == "yes"
77    MessageBox MB_YESNO|MB_ICONINFORMATION "$(MiKTeXInfo)" IDYES UpdateNow IDNO UpdateLater
78    UpdateNow:
79     StrCpy $0 $LaTeXPath -4 # remove "\bin"
80     ExecWait '"$LaTeXPath\copystart.exe" "$0\config\update.dat"' # run MiKTeX's update wizard
81    UpdateLater:
82   ${endif}
83
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'
87   FileClose $R1
88
89   # prepare variables for uninstaller
90   StrCpy $MiKTeXVersionVar ${MiKTeXDeliveredVersion}
91   StrCpy $JabRefVersionVar ${JabRefVersion}
92
93 SectionEnd
94
95 # -------------------------------------------
96
97 Function Ghostscript
98
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"
104    
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"
107   ${else}
108    # delete unnecessary files
109    RMDir /r ${GhostscriptDir}   
110   ${endif}
111
112 FunctionEnd
113
114 # -------------------------------------------
115
116 Function ImageMagick
117
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}"
127    
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}"
135    
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}
138   ${else}
139    # delete unnecessary files
140    RMDir /r ${ImageMagickDir}
141   ${endif}
142
143 FunctionEnd
144
145 # -------------------------------------------
146
147 Function Aiksaurus
148
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}"
158   ${endif}
159
160 FunctionEnd
161