]> git.lyx.org Git - lyx.git/blob - development/Win32/packaging/installer/setup/configure.nsh
Fix bug #7362: Typo in installer.
[lyx.git] / development / Win32 / packaging / installer / setup / configure.nsh
1 /*
2
3 configure.nsh
4
5 Write registry information and configure LyX
6
7 */
8
9 Var DistFile
10 Var PathPrefix
11
12 !define SHORTCUT '${APP_NAME} ${APP_SERIES_NAME}.lnk" "$INSTDIR\${APP_RUN}" "" "$INSTDIR\${APP_RUN}" "" "" "" "${APP_INFO}"'
13
14 #--------------------------------
15 # File associations
16
17 Section -FileAssociations
18
19   # Associate .lyx files with LyX for current user of all users
20
21   # Write information about file type
22   !define REG_FILETYPE 'WriteRegStr SHELL_CONTEXT "Software\Classes\${APP_REGNAME_DOC}'
23   
24   ${REG_FILETYPE}" "" "${APP_NAME} Document"
25   ${REG_FILETYPE}\DefaultIcon" "" "$INSTDIR\bin\LyXLauncher.exe,0"
26   ${REG_FILETYPE}\Shell\open\command" "" '"$INSTDIR\${APP_RUN}" "%1"'
27   
28   !define REG_FILEEXT 'WriteRegStr SHELL_CONTEXT "Software\Classes\${APP_EXT}"'
29   
30   ${REG_FILEEXT} "" "${APP_REGNAME_DOC}"
31   ${REG_FILEEXT} "Content Type" "${APP_MIME_TYPE}"  
32   
33   # Refresh shell
34   ${RefreshShellIcons}
35
36 SectionEnd
37
38 #--------------------------------
39 # Registry information
40
41 Section -InstallData
42
43   # Registry information
44   WriteRegStr SHELL_CONTEXT ${APP_REGKEY} "" $INSTDIR
45   WriteRegStr SHELL_CONTEXT ${APP_REGKEY} "Version" "${APP_VERSION_NUMBER}"
46
47   WriteRegStr SHELL_CONTEXT ${APP_REGKEY_SETUP} "LaTeX Path" $PathLaTeX
48
49   # Start Menu shortcut
50   # There is only one shortcut to the application, so it should be in the main group
51   SetOutPath "$INSTDIR\bin"
52   CreateShortCut "$SMPROGRAMS\${SHORTCUT}
53     
54   # Uninstaller information
55   !define REG_UNINSTALL 'WriteRegStr SHELL_CONTEXT "Software\Microsoft\Windows\CurrentVersion\Uninstall\${SETUP_UNINSTALLER_KEY}"'
56   
57   ${If} $MultiUser.InstallMode == "CurrentUser"
58     ${REG_UNINSTALL} "DisplayName" "${APP_NAME} ${APP_VERSION} $(TEXT_INSTALL_CURRENTUSER)"
59   ${Else}
60     ${REG_UNINSTALL} "DisplayName" "${APP_NAME} ${APP_VERSION}"
61   ${EndIf}
62   
63   ${REG_UNINSTALL} "UninstallString" '"$INSTDIR\${SETUP_UNINSTALLER}"'
64   ${REG_UNINSTALL} "DisplayVersion" "${APP_VERSION}"
65   ${REG_UNINSTALL} "DisplayIcon" "$INSTDIR\bin\LyXLauncher,0"
66   ${REG_UNINSTALL} "URLUpdateInfo" "http://www.lyx.org/"
67   ${REG_UNINSTALL} "URLInfoAbout" "http://www.lyx.org/about/"
68   ${REG_UNINSTALL} "Publisher" "LyX Team"
69   ${REG_UNINSTALL} "HelpLink" "http://www.lyx.org/internet/mailing.php"  
70   
71 SectionEnd
72
73 #--------------------------------
74 # Write LyX configuration file
75
76 Section -Configure
77
78   # Set path prefix in lyxrc.dist
79
80   # Install standard lyxrc.dist file
81   SetOutPath "$INSTDIR\Resources"
82   File "${FILES_DEPS}\Resources\lyxrc.dist"
83
84   # Append path prefix
85   FileOpen $DistFile "$INSTDIR\Resources\lyxrc.dist" a
86
87   # $$ represents a literal $ in an NSIS string
88   StrCpy $PathPrefix "$$LyXDir\bin;$$LyXDir\python;$$LyXDir\imagemagick;$$LyXDir\ghostscript"
89   
90   ${If} $PathLaTeX != ""
91     StrCpy $PathPrefix "$PathPrefix;$PathLaTeX"
92   ${EndIf}
93   ${If} $PathBibTeXEditor != ""
94     StrCpy $PathPrefix "$PathPrefix;$PathBibTeXEditor"
95   ${EndIf}  
96
97   FileWrite $DistFile '\path_prefix "$PathPrefix"$\r$\n'
98
99   FileClose $DistFile
100
101 SectionEnd
102
103 #--------------------------------
104 # LaTeX files
105
106 Var UpdateFNDBReturn
107
108 Section -LaTeXFiles
109
110   # Install files in local root
111
112   ${If} $PathLaTeXLocal != ""
113     # dvipost
114     SetOutPath "$PathLaTeXLocal\tex\latex\dvipost"
115     File "${FILES_DVIPOST_PKG}\dvipost.sty"
116     # LyX files in Resources\tex
117     SetOutPath "$PathLaTeXLocal\tex\latex\lyx"
118     CopyFiles /SILENT "$INSTDIR\Resources\tex\*.*" "$PathLaTeXLocal\tex\latex\lyx"
119   ${EndIf}
120
121   # Update file name database
122
123   ${If} $PathLaTeX != ""
124     DetailPrint $(TEXT_CONFIGURE_MIKTEXFNDB)
125     nsExec::ExecToLog '"$PathLaTeX\initexmf.exe" --update-fndb'
126     Pop $UpdateFNDBReturn # Return value
127   ${EndIf}
128
129 SectionEnd
130
131 #--------------------------------
132 # Postscript printer for metafile to EPS converter
133
134 Section -PSPrinter
135
136   ${If} $MultiUser.Privileges == "Admin"
137     ${OrIf} $MultiUser.Privileges == "Power"
138
139     # Delete printer
140     ExecWait '$PrinterConf /q /dl /n "Metafile to EPS Converter"'
141     # Install printer and driver
142     ExecWait '$PrinterConf /if /f "$WINDIR\inf\ntprint.inf" /b "Metafile to EPS Converter" /r "FILE:" /m "MS Publisher Imagesetter"'
143     # Restore DEVMODE with proper settings
144     ExecWait '$PrinterConf /q /Sr /n "Metafile to EPS Converter" /a "$INSTDIR\bin\metafile2eps.dat" g'
145
146   ${EndIf}
147
148 SectionEnd
149
150 #--------------------------------
151 # Run the LyX configure.py script, so MiKTeX can download its packages
152
153 Var ConfigureReturn
154
155 Section -ConfigureScript
156
157   SetOutPath "$INSTDIR\Resources"
158   DetailPrint $(TEXT_CONFIGURE_LYX)
159   nsExec::ExecToLog '"$INSTDIR\python\python.exe" "$INSTDIR\Resources\configure.py"'
160   Pop $ConfigureReturn # Return value
161
162 SectionEnd
163
164 #--------------------------------
165 # Desktop shortcut
166
167 Function CheckDesktopShortcut
168
169   # Enable desktop icon creation when there is an icon already
170   # Old shortcuts need to be updated
171   
172   ${If} ${FileExists} "$DESKTOP\${APP_NAME} ${APP_SERIES_NAME}.lnk"
173     ${NSD_SetState} $mui.FinishPage.ShowReadme ${BST_CHECKED}
174   ${EndIf}
175
176 FunctionEnd
177
178 Function CreateDesktopShortcut
179
180   # Desktop icon creation is an option on the finish page
181   SetOutPath "$INSTDIR\bin"
182   CreateShortCut "$DESKTOP\${SHORTCUT}
183
184 FunctionEnd