]> git.lyx.org Git - features.git/blob - development/Win32/packaging/installer/LyXWinInstaller/InstallActions-small.nsh
installer:
[features.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 SectionEnd
90
91 # -------------------------------------------
92
93 Function Ghostscript
94
95   # if GhostScript is not installed
96   ${if} $GhostscriptPath == ""
97    # register Ghostscript
98    WriteRegStr HKLM "SOFTWARE\GPL Ghostscript\${GhostscriptVersion}" "GS_DLL" "${GhostscriptDir}\bin\gsdll32.dll"
99    WriteRegStr HKLM "SOFTWARE\GPL Ghostscript\${GhostscriptVersion}" "GS_LIB" "${GhostscriptDir}\lib;${GhostscriptDir}\fonts;${GhostscriptDir}\Resource"
100    
101    WriteRegStr HKLM "SOFTWARE\GPL Ghostscript" "OnlyWithLyX" "Yes${PRODUCT_VERSION_SHORT}" # special entry to tell the uninstaller that it was installed with LyX
102    StrCpy $GhostscriptPath "${GhostscriptDir}\bin"
103   ${else}
104    # delete unnecessary files
105    RMDir /r ${GhostscriptDir}   
106   ${endif}
107
108 FunctionEnd
109
110 # -------------------------------------------
111
112 Function ImageMagick
113
114   # if ImageMagick is not installed
115   ${if} $ImageMagickPath == ""
116    # register ImageMagick
117    WriteRegStr HKLM "SOFTWARE\Classes\Applications" "AutoRun" "${ImageMagickDir}\convert.exe $$"
118    WriteRegStr HKLM "SOFTWARE\ImageMagick\${ImageMagickVersion}\Q:16" "BinPath" "${ImageMagickDir}"
119    WriteRegStr HKLM "SOFTWARE\ImageMagick\${ImageMagickVersion}\Q:16" "CoderModulesPath" "${ImageMagickDir}\modules\coders"
120    WriteRegStr HKLM "SOFTWARE\ImageMagick\${ImageMagickVersion}\Q:16" "ConfigurePath" "${ImageMagickDir}\config"
121    WriteRegStr HKLM "SOFTWARE\ImageMagick\${ImageMagickVersion}\Q:16" "FilterModulesPath" "${ImageMagickDir}\modules\filters"
122    WriteRegStr HKLM "SOFTWARE\ImageMagick\${ImageMagickVersion}\Q:16" "LibPath" "${ImageMagickDir}"
123    
124    WriteRegStr HKLM "SOFTWARE\ImageMagick\Current" "BinPath" "${ImageMagickDir}"
125    WriteRegStr HKLM "SOFTWARE\ImageMagick\Current" "CoderModulesPath" "${ImageMagickDir}\modules\coders"
126    WriteRegStr HKLM "SOFTWARE\ImageMagick\Current" "ConfigurePath" "${ImageMagickDir}\config"
127    WriteRegStr HKLM "SOFTWARE\ImageMagick\Current" "FilterModulesPath" "${ImageMagickDir}\modules\filters"
128    WriteRegStr HKLM "SOFTWARE\ImageMagick\Current" "LibPath" "${ImageMagickDir}"
129    WriteRegDWORD HKLM "SOFTWARE\ImageMagick\Current" "QuantumDepth" 0x00000010   
130    WriteRegStr HKLM "SOFTWARE\ImageMagick\Current" "Version" "${ImageMagickVersion}"
131    
132    WriteRegStr HKLM "Software\ImageMagick" "OnlyWithLyX" "Yes${PRODUCT_VERSION_SHORT}" # special entry to tell the uninstaller that it was installed with LyX
133    StrCpy $ImageMagickPath ${ImageMagickDir}
134   ${else}
135    # delete unnecessary files
136    RMDir /r ${ImageMagickDir}
137   ${endif}
138
139 FunctionEnd
140
141 # -------------------------------------------
142
143 Function Aiksaurus
144
145   # if Aiksaurus is not installed
146   ${if} $AiksaurusPath == ""
147    # extract Aiksaurus' program files
148    SetOutPath "$INSTDIR\external"
149    File /r "${PRODUCT_SOURCEDIR}\${AiksaurusInstall}"
150    # copy the files and register Aiksaurus
151    CopyFiles "$INSTDIR\${AiksaurusInstall}" "$APPDATA"
152 #   WriteRegStr HKLM "Software\Aiksaurus" "OnlyWithLyX" "Yes${PRODUCT_VERSION_SHORT}" # special entry to tell the uninstaller that it was installed with LyX
153 #   WriteRegStr HKLM "Software\Aiksaurus" "Data Path" "${AiksaurusDir}"
154   ${endif}
155
156 FunctionEnd
157