651ba3cb2ac33da07e00e4dff66f5f694b24a311
1 ; #######################################
2 ; Inkscape NSIS installer project file
3 ; Used as of 0.40
4 ; #######################################
6 ; #######################################
7 ; DEFINES
8 ; #######################################
9 !define PRODUCT_NAME "Inkscape"
10 !define PRODUCT_VERSION "0.47+devel"
11 !define PRODUCT_REVISION 3
12 !define PRODUCT_VERSION_4 "0.47.0.3"
13 !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\inkscape.exe"
14 !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
15 ;!define DUMMYINSTALL ; Define this to make it build quickly, not including any of the files or code in the sections, for quick testing of features of the installer and development thereof.
17 ; #######################################
18 ; MUI SETTINGS
19 ; #######################################
20 ; MUI 1.67 compatible ------
21 SetCompressor /SOLID lzma
22 SetCompressorDictSize 32
23 RequestExecutionLevel admin
24 !include "MUI.nsh"
25 !include "LogicLib.nsh"
26 !include "sections.nsh"
27 !define MUI_ABORTWARNING
28 !define MUI_ICON "..\..\inkscape.ico";${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
29 !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
30 !define MUI_HEADERIMAGE
31 !define MUI_HEADERIMAGE_BITMAP "header.bmp"
32 !define MUI_WELCOMEFINISHPAGE_BITMAP "welcomefinish.bmp"
33 !define MUI_COMPONENTSPAGE_SMALLDESC
35 ;..................................................................................................
36 ;Following two definitions required. Uninstall log will use these definitions.
37 ;You may use these definitions also, when you want to set up the InstallDirRagKey,
38 ;store the language selection, store Start Menu folder etc.
39 ;Enter the windows uninstall reg sub key to add uninstall information to Add/Remove Programs also.
41 !define INSTDIR_REG_ROOT HKLM
42 !define INSTDIR_REG_KEY ${PRODUCT_UNINST_KEY}
44 ;include the Uninstall log header
45 !include AdvUninstLog.nsh
46 !insertmacro INTERACTIVE_UNINSTALL
48 ;For md5dll and messagebox
49 !addplugindir .
51 !include FileFunc.nsh
52 !insertmacro GetParameters
53 !insertmacro GetOptions
54 !insertmacro un.GetParent
56 ; Welcome page
57 !insertmacro MUI_PAGE_WELCOME
58 ; License page
59 ; !define MUI_LICENSEPAGE_RADIOBUTTONS
60 LicenseForceSelection off
61 !define MUI_LICENSEPAGE_BUTTON $(lng_LICENSE_BUTTON)
62 !define MUI_LICENSEPAGE_TEXT_BOTTOM $(lng_LICENSE_BOTTOM_TEXT)
63 !insertmacro MUI_PAGE_LICENSE "..\..\Copying"
64 !insertmacro MUI_PAGE_COMPONENTS
65 ; InstType $(lng_Full)
66 ; InstType $(lng_Optimal)
67 ; InstType $(lng_Minimal)
68 ; Directory page
69 !insertmacro MUI_PAGE_DIRECTORY
70 ; Instfiles page
71 !insertmacro MUI_PAGE_INSTFILES
72 ; Finish page
73 !define MUI_FINISHPAGE_RUN "$INSTDIR\inkscape.exe"
74 !insertmacro MUI_PAGE_FINISH
76 ; Uninstaller pages
77 !insertmacro MUI_UNPAGE_CONFIRM
78 UninstPage custom un.CustomPageUninstall
79 !insertmacro MUI_UNPAGE_INSTFILES
80 ShowUninstDetails hide
81 !insertmacro MUI_UNPAGE_FINISH
83 ; #######################################
84 ; STRING LOCALIZATION
85 ; #######################################
86 ; Thanks to Adib Taraben and Luca Bruno for getting this started
87 ; Add your translation here! :-)
88 ; I had wanted to list the languages alphabetically, but apparently
89 ; the first is the default. So putting English first is just being
90 ; practical. It is not chauvinism or hubris, I swear! ;-)
91 ; default language first
93 ; Language files
94 !insertmacro MUI_RESERVEFILE_LANGDLL
95 !include English.nsh
96 !include Breton.nsh
97 !include Catalan.nsh
98 !include Czech.nsh
99 !include Finnish.nsh
100 !include French.nsh
101 !include Galician.nsh
102 !include German.nsh
103 !include Italian.nsh
104 !include Japanese.nsh
105 !include Polish.nsh
106 !include Russian.nsh
107 !include Slovak.nsh
108 !include Slovenian.nsh
109 !include Spanish.nsh
110 !include SimpChinese.nsh
111 !include TradChinese.nsh
113 ReserveFile "inkscape.nsi.uninstall"
114 ReserveFile "${NSISDIR}\Plugins\UserInfo.dll"
115 !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
117 ; #######################################
118 ; SETTINGS
119 ; #######################################
121 Name "${PRODUCT_NAME}"
122 Caption "$(lng_Caption)"
123 BrandingText "$(lng_Caption)"
124 !ifndef PRODUCT_REVISION
125 OutFile "Inkscape-${PRODUCT_VERSION}.exe"
126 !else
127 OutFile "Inkscape-${PRODUCT_VERSION}-${PRODUCT_REVISION}.exe"
128 !endif
129 InstallDir "$PROGRAMFILES\Inkscape"
130 InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
132 VIProductVersion "${PRODUCT_VERSION_4}"
133 VIAddVersionKey ProductName "${PRODUCT_NAME}"
134 VIAddVersionKey Comments "Licensed under the GNU GPL"
135 VIAddVersionKey CompanyName "inkscape.org"
136 VIAddVersionKey LegalCopyright "© 2009 Inkscape"
137 VIAddVersionKey FileDescription "${PRODUCT_NAME}"
138 VIAddVersionKey FileVersion "${PRODUCT_VERSION_4}"
139 VIAddVersionKey ProductVersion "${PRODUCT_VERSION_4}"
140 VIAddVersionKey InternalName "${PRODUCT_NAME}"
142 Var askMultiUser
143 Var filename
144 Var MultiUser
145 Var User
146 Var CMDARGS
148 ; #######################################
149 ; I N S T A L L E R S E C T I O N S
150 ; #######################################
152 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
154 ;;;;;;;;;;;;;;;;;;;;;;;;;;
155 ; Delete prefs
156 ; code originally taken from the vlc project
157 ;;;;;;;;;;;;;;;;;;;;;;;;;;
158 !macro delprefs
159 StrCpy $0 0
160 DetailPrint "Deleting personal preferences..."
161 DetailPrint "Finding all users..."
162 ${Do}
163 ; FIXME
164 ; this will loop through all the logged users and "virtual" windows users
165 ; (it looks like users are only present in HKEY_USERS when they are logged in)
166 ClearErrors
167 EnumRegKey $1 HKU "" $0
168 ${IfThen} $1 == "" ${|} ${ExitDo} ${|}
169 IntOp $0 $0 + 1
170 ReadRegStr $2 HKU "$1\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" AppData
171 ${IfThen} $2 == "" ${|} ${Continue} ${|}
172 DetailPrint "Removing $2\Inkscape"
173 Delete "$2\Inkscape\preferences.xml"
174 Delete "$2\Inkscape\extension-errors.log"
175 RMDir "$2\Inkscape"
176 ${Loop}
177 !macroend
180 ;--------------------------------
181 ; Installer Sections
182 Section -removeInkscape
183 !ifndef DUMMYINSTALL
184 ;remove the old Inkscape shortcuts from the startmenu
185 ;just in case they are still there
186 SetShellVarContext current
187 Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
188 Delete "$SMPROGRAMS\Inkscape\Inkscape.lnk"
189 RMDir "$SMPROGRAMS\Inkscape"
190 Delete "$SMPROGRAMS\Inkscape.lnk"
191 SetShellVarContext all
192 Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
193 Delete "$SMPROGRAMS\Inkscape\Inkscape.lnk"
194 RMDir "$SMPROGRAMS\Inkscape"
195 Delete "$SMPROGRAMS\Inkscape.lnk"
196 !endif
197 SectionEnd
199 Section $(lng_Core) SecCore
200 SectionIn 1 2 3 RO
201 !ifndef DUMMYINSTALL
202 DetailPrint "Installing Inkscape core files..."
203 SetOutPath $INSTDIR
204 !insertmacro UNINSTALL.LOG_OPEN_INSTALL
205 SetOverwrite on
206 SetAutoClose false
208 File /a "..\..\inkscape\ink*.exe"
209 File /a "..\..\inkscape\AUTHORS"
210 File /a "..\..\inkscape\COPYING"
211 File /a "..\..\inkscape\COPYING.LIB"
212 File /a "..\..\inkscape\NEWS"
213 File /a "..\..\inkscape\gspawn-win32-helper.exe"
214 File /a "..\..\inkscape\gspawn-win32-helper-console.exe"
215 File /nonfatal /a "..\..\inkscape\HACKING.txt"
216 File /a "..\..\inkscape\README"
217 File /nonfatal /a "..\..\inkscape\README.txt"
218 File /a "..\..\inkscape\TRANSLATORS"
219 File /nonfatal /a /r "..\..\inkscape\data"
220 File /nonfatal /a /r "..\..\inkscape\doc"
221 File /nonfatal /a /r "..\..\inkscape\plugins"
222 File /nonfatal /a /r /x *.??*.???* /x "examples" /x "tutorials" "..\..\inkscape\share"
223 !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
224 ; this files are added because it slips through the filter
225 SetOutPath $INSTDIR\share\clipart
226 !insertmacro UNINSTALL.LOG_OPEN_INSTALL
227 File /a "..\..\inkscape\share\clipart\inkscape.logo.svg"
228 ;File /a "..\..\inkscape\share\clipart\inkscape.logo.classic.svg"
229 !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
230 SetOutPath $INSTDIR\share\icons
231 !insertmacro UNINSTALL.LOG_OPEN_INSTALL
232 File /a "..\..\inkscape\share\icons\inkscape.file.png"
233 File /a "..\..\inkscape\share\icons\inkscape.file.svg"
234 !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
235 SetOutPath $INSTDIR\modules
236 !insertmacro UNINSTALL.LOG_OPEN_INSTALL
237 File /nonfatal /a /r "..\..\inkscape\modules\*.*"
238 !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
239 SetOutPath $INSTDIR\python
240 !insertmacro UNINSTALL.LOG_OPEN_INSTALL
241 File /nonfatal /a /r "..\..\inkscape\python\*.*"
242 !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
243 !endif
244 SectionEnd
246 Section $(lng_GTKFiles) SecGTK
247 SectionIn 1 2 3 RO
248 !ifndef DUMMYINSTALL
249 DetailPrint "Installing GTK files..."
250 SetOutPath $INSTDIR
251 !insertmacro UNINSTALL.LOG_OPEN_INSTALL
252 SetOverwrite on
253 File /a /r "..\..\inkscape\*.dll"
254 File /a /r /x "locale" "..\..\inkscape\lib"
255 File /a /r "..\..\inkscape\etc"
256 !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
257 !endif
258 SectionEnd
260 Section -SetCurrentUserOnly
261 !ifndef DUMMYINSTALL
262 StrCpy $MultiUser 0
263 SetShellVarContext current
264 !endif
265 SectionEnd
267 Section $(lng_Alluser) SecAlluser
268 SectionIn 1 2 3
269 !ifndef DUMMYINSTALL
270 ; disable this option in Win95/Win98/WinME
271 StrCpy $MultiUser 1
272 DetailPrint "Installing in administrator mode (registry root will be HKLM)"
273 SetShellVarContext all
274 !endif
275 SectionEnd
277 SectionGroup $(lng_Shortcuts) SecShortcuts
279 Section $(lng_Desktop) SecDesktop
280 !ifndef DUMMYINSTALL
281 CreateShortCut "$DESKTOP\Inkscape.lnk" "$INSTDIR\inkscape.exe"
282 !endif
283 SectionEnd
285 Section $(lng_Quicklaunch) SecQuicklaunch
286 !ifndef DUMMYINSTALL
287 ${IfThen} $QUICKLAUNCH != $TEMP ${|} CreateShortCut "$QUICKLAUNCH\Inkscape.lnk" "$INSTDIR\inkscape.exe" ${|}
288 !endif
289 SectionEnd
291 Section $(lng_SVGWriter) SecSVGWriter
292 SectionIn 1 2 3
293 !ifndef DUMMYINSTALL
294 DetailPrint "Associating SVG files with Inkscape"
295 ReadRegStr $0 HKCR ".svg" ""
296 ${If} $0 == ""
297 StrCpy $0 svgfile
298 WriteRegStr HKCR ".svg" "" $0
299 WriteRegStr HKCR "svgfile" "" "Scalable Vector Graphics file"
300 ${EndIf}
301 WriteRegStr HKCR "$0\shell\edit\command" "" `"$INSTDIR\Inkscape.exe" "%1"`
303 ReadRegStr $0 HKCR ".svgz" ""
304 ${If} $0 == ""
305 StrCpy $0 svgfile
306 WriteRegStr HKCR ".svgz" "" $0
307 WriteRegStr HKCR "svgfile" "" "Scalable Vector Graphics file"
308 ${EndIf}
309 WriteRegStr HKCR "$0\shell\edit\command" "" `"$INSTDIR\Inkscape.exe" "%1"`
310 !endif
311 SectionEnd
313 Section $(lng_ContextMenu) SecContextMenu
314 SectionIn 1 2 3
315 !ifndef DUMMYINSTALL
316 DetailPrint "Adding Inkscape to SVG file context menu"
317 ReadRegStr $0 HKCR ".svg" ""
318 ${If} $0 == ""
319 StrCpy $0 svgfile
320 WriteRegStr HKCR ".svg" "" $0
321 WriteRegStr HKCR "svgfile" "" "Scalable Vector Graphics file"
322 ${EndIf}
323 WriteRegStr HKCR "$0\shell\${PRODUCT_NAME}\command" "" `"$INSTDIR\Inkscape.exe" "%1"`
325 ReadRegStr $0 HKCR ".svgz" ""
326 ${If} $0 == ""
327 StrCpy $0 svgfile
328 WriteRegStr HKCR ".svgz" "" $0
329 WriteRegStr HKCR "svgfile" "" "Scalable Vector Graphics file"
330 ${EndIf}
331 WriteRegStr HKCR "$0\shell\${PRODUCT_NAME}\command" "" `"$INSTDIR\Inkscape.exe" "%1"`
332 !endif
333 SectionEnd
335 SectionGroupEnd
337 Section /o $(lng_DeletePrefs) SecPrefs
338 !ifndef DUMMYINSTALL
339 !insertmacro delprefs
340 !endif
341 SectionEnd
343 SectionGroup $(lng_Addfiles) SecAddfiles
345 Section $(lng_Examples) SecExamples
346 SectionIn 1 2
347 !ifndef DUMMYINSTALL
348 SetOutPath $INSTDIR\share
349 !insertmacro UNINSTALL.LOG_OPEN_INSTALL
350 File /nonfatal /a /r /x "*.??*.???*" "..\..\inkscape\share\examples"
351 !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
352 !endif
353 SectionEnd
355 Section $(lng_Tutorials) SecTutorials
356 SectionIn 1 2
357 !ifndef DUMMYINSTALL
358 SetOutPath $INSTDIR\share
359 !insertmacro UNINSTALL.LOG_OPEN_INSTALL
360 File /nonfatal /a /r /x "*.??*.???*" "..\..\inkscape\share\tutorials"
361 !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
362 !endif
363 SectionEnd
365 SectionGroupEnd
367 SectionGroup $(lng_Languages) SecLanguages
368 !macro Language SecName lng
369 Section /o $(lng_${lng}) Sec${SecName}
370 ;SectionIn 1 2 3
371 !ifndef DUMMYINSTALL
372 SetOutPath $INSTDIR
373 !insertmacro UNINSTALL.LOG_OPEN_INSTALL
374 File /nonfatal /a "..\..\inkscape\*.${lng}.txt" ; FIXME: remove this? No such files.
375 !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
376 SetOutPath $INSTDIR\locale
377 !insertmacro UNINSTALL.LOG_OPEN_INSTALL
378 File /nonfatal /a /r "..\..\inkscape\locale\${lng}"
379 !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
380 SetOutPath $INSTDIR\lib\locale
381 !insertmacro UNINSTALL.LOG_OPEN_INSTALL
382 File /nonfatal /a /r "..\..\inkscape\lib\locale\${lng}"
383 !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
384 SetOutPath $INSTDIR\share\clipart
385 !insertmacro UNINSTALL.LOG_OPEN_INSTALL
386 File /nonfatal /a /r "..\..\inkscape\share\clipart\*.${lng}.svg"
387 !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
388 ; the keyboard tables
389 SetOutPath $INSTDIR\share\screens
390 !insertmacro UNINSTALL.LOG_OPEN_INSTALL
391 File /nonfatal /a /r "..\..\inkscape\share\screens\*.${lng}.svg"
392 !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
393 SetOutPath $INSTDIR\share\templates
394 !insertmacro UNINSTALL.LOG_OPEN_INSTALL
395 File /nonfatal /a /r "..\..\inkscape\share\templates\*.${lng}.svg"
396 !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
397 SetOutPath $INSTDIR\doc
398 !insertmacro UNINSTALL.LOG_OPEN_INSTALL
399 File /nonfatal /a /r "..\..\inkscape\doc\keys.${lng}.xml"
400 File /nonfatal /a /r "..\..\inkscape\doc\keys.${lng}.html"
401 !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
402 SectionGetFlags ${SecTutorials} $R1
403 IntOp $R1 $R1 & ${SF_SELECTED}
404 ${If} $R1 >= ${SF_SELECTED}
405 SetOutPath $INSTDIR\share\tutorials
406 !insertmacro UNINSTALL.LOG_OPEN_INSTALL
407 File /nonfatal /a "..\..\inkscape\share\tutorials\*.${lng}.*"
408 !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
409 ${EndIf}
410 !endif
411 SectionEnd
412 !macroend
414 !insertmacro Language Amharic am
415 !insertmacro Language Arabic ar
416 !insertmacro Language Azerbaijani az
417 !insertmacro Language Byelorussian be
418 !insertmacro Language Bulgarian bg
419 !insertmacro Language Bengali bn
420 !insertmacro Language Breton br
421 !insertmacro Language Catalan ca
422 !insertmacro Language CatalanValencia ca@valencia
423 !insertmacro Language Czech cs
424 !insertmacro Language Danish da
425 !insertmacro Language German de
426 !insertmacro Language Dzongkha dz
427 !insertmacro Language Greek el
428 !insertmacro Language EnglishAustralian en_AU
429 !insertmacro Language EnglishCanadian en_CA
430 !insertmacro Language EnglishBritain en_GB
431 !insertmacro Language EnglishPiglatin en_US@piglatin
432 !insertmacro Language Esperanto eo
433 !insertmacro Language Spanish es
434 !insertmacro Language SpanishMexico es_MX
435 !insertmacro Language Estonian et
436 !insertmacro Language Basque eu
437 !insertmacro Language French fr
438 !insertmacro Language Finnish fi
439 !insertmacro Language Irish ga
440 !insertmacro Language Gallegan gl
441 !insertmacro Language Hebrew he
442 !insertmacro Language Croatian hr
443 !insertmacro Language Hungarian hu
444 !insertmacro Language Indonesian id
445 !insertmacro Language Italian it
446 !insertmacro Language Japanese ja
447 !insertmacro Language Khmer km
448 !insertmacro Language Korean ko
449 !insertmacro Language Lithuanian lt
450 !insertmacro Language Mongolian mn
451 !insertmacro Language Macedonian mk
452 !insertmacro Language NorwegianBokmal nb
453 !insertmacro Language Nepali ne
454 !insertmacro Language Dutch nl
455 !insertmacro Language NorwegianNynorsk nn
456 !insertmacro Language Panjabi pa
457 !insertmacro Language Polish pl
458 !insertmacro Language Portuguese pt
459 !insertmacro Language PortugueseBrazil pt_BR
460 !insertmacro Language Romanian ro
461 !insertmacro Language Russian ru
462 !insertmacro Language Kinyarwanda rw
463 !insertmacro Language Slovak sk
464 !insertmacro Language Slovenian sl
465 !insertmacro Language Albanian sq
466 !insertmacro Language Serbian sr
467 !insertmacro Language SerbianLatin sr@latin
468 !insertmacro Language Swedish sv
469 !insertmacro Language Thai th
470 !insertmacro Language Turkish tr
471 !insertmacro Language Ukrainian uk
472 !insertmacro Language Vietnamese vi
473 !insertmacro Language ChineseSimplified zh_CN
474 !insertmacro Language ChineseTaiwan zh_TW
475 SectionGroupEnd
478 Section -FinalizeInstallation
479 !ifndef DUMMYINSTALL
480 DetailPrint "Finalizing installation"
481 ${IfThen} $MultiUser = 1 ${|} SetShellVarContext all ${|}
482 ${IfThen} $MultiUser != 1 ${|} SetShellVarContext current ${|}
484 WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\inkscape.exe"
485 WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "MultiUser" $MultiUser
486 WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "askMultiUser" $askMultiUser
487 WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "User" $User
489 ; start menu entries
490 CreateShortcut "$SMPROGRAMS\Inkscape.lnk" "$INSTDIR\inkscape.exe"
492 ; uninstall settings
493 ; WriteUninstaller "$INSTDIR\uninst.exe"
494 WriteRegExpandStr SHCTX "${PRODUCT_UNINST_KEY}" "UninstallString" "${UNINST_EXE}"
495 WriteRegExpandStr SHCTX "${PRODUCT_UNINST_KEY}" "InstallDir" $INSTDIR
496 WriteRegExpandStr SHCTX "${PRODUCT_UNINST_KEY}" "InstallLocation" $INSTDIR
497 WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayName" "${PRODUCT_NAME} ${PRODUCT_VERSION}"
498 WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\Inkscape.exe,0"
499 WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
500 WriteRegDWORD SHCTX "${PRODUCT_UNINST_KEY}" "NoModify" 1
501 WriteRegDWORD SHCTX "${PRODUCT_UNINST_KEY}" "NoRepair" 1
503 ;create/update log always within .onInstSuccess function
504 !insertmacro UNINSTALL.LOG_UPDATE_INSTALL
506 DetailPrint "Creating MD5 checksums"
507 ClearErrors
508 FileOpen $0 $INSTDIR\Uninstall.dat r
509 FileOpen $9 $INSTDIR\Uninstall.log w
510 ${IfNot} ${Errors}
511 ${Do}
512 ClearErrors
513 FileRead $0 $1
514 ${IfThen} ${Errors} ${|} ${ExitDo} ${|}
515 StrCpy $1 $1 -2
516 md5dll::GetMD5File /NOUNLOAD $1
517 Pop $2
518 ${IfThen} $2 != "" ${|} FileWrite $9 "$2 $1$\r$\n" ${|}
519 ${Loop}
520 ${EndIf}
521 FileClose $0
522 FileClose $9
523 ; Not needed any more
524 Delete $INSTDIR\Uninstall.dat
525 !endif
526 SectionEnd
528 ; Last the Descriptions
529 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
530 !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} $(lng_CoreDesc)
531 !insertmacro MUI_DESCRIPTION_TEXT ${SecGTK} $(lng_GTKFilesDesc)
532 !insertmacro MUI_DESCRIPTION_TEXT ${SecShortcuts} $(lng_ShortcutsDesc)
533 !insertmacro MUI_DESCRIPTION_TEXT ${SecAlluser} $(lng_AlluserDesc)
534 !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} $(lng_DesktopDesc)
535 !insertmacro MUI_DESCRIPTION_TEXT ${SecQuicklaunch} $(lng_QuicklaunchDesc)
536 !insertmacro MUI_DESCRIPTION_TEXT ${SecSVGWriter} $(lng_SVGWriterDesc)
537 !insertmacro MUI_DESCRIPTION_TEXT ${SecContextMenu} $(lng_ContextMenuDesc)
538 !insertmacro MUI_DESCRIPTION_TEXT ${SecPrefs} $(lng_DeletePrefsDesc)
539 !insertmacro MUI_DESCRIPTION_TEXT ${SecAddfiles} $(lng_AddfilesDesc)
540 !insertmacro MUI_DESCRIPTION_TEXT ${SecExamples} $(lng_ExamplesDesc)
541 !insertmacro MUI_DESCRIPTION_TEXT ${SecTutorials} $(lng_TutorialsDesc)
542 !insertmacro MUI_DESCRIPTION_TEXT ${SecLanguages} $(lng_LanguagesDesc)
543 !insertmacro MUI_FUNCTION_DESCRIPTION_END
545 !macro Parameter key Section
546 ${GetOptions} $CMDARGS "/${key}=" $1
547 ${If} $1 == "OFF"
548 SectionGetFlags ${Section} $0
549 IntOp $2 ${SF_SELECTED} ~
550 IntOp $0 $0 & $2
551 SectionSetFlags ${Section} $0
552 ${EndIf}
553 ${If} $1 == "ON"
554 SectionGetFlags ${Section} $0
555 IntOp $0 $0 | ${SF_SELECTED}
556 SectionSetFlags ${Section} $0
557 ${EndIf}
558 !macroend
560 Function .onInit
561 !insertmacro MUI_LANGDLL_DISPLAY
563 !macro LanguageAutoSelect SecName LocaleID
564 ${If} $LANGUAGE = ${LocaleID}
565 SectionGetFlags ${Sec${SecName}} $0
566 IntOp $0 $0 | ${SF_SELECTED}
567 SectionSetFlags ${Sec${SecName}} $0
568 ${EndIf}
569 !macroend
571 ;!insertmacro LanguageAutoSelect English 1033
572 !insertmacro LanguageAutoSelect Breton 1150
573 !insertmacro LanguageAutoSelect Catalan 1027
574 !insertmacro LanguageAutoSelect Czech 1029
575 !insertmacro LanguageAutoSelect Finnish 1035
576 !insertmacro LanguageAutoSelect French 1036
577 !insertmacro LanguageAutoSelect Gallegan 1110 ; Galician, but section is called Gallegan
578 !insertmacro LanguageAutoSelect German 1031
579 !insertmacro LanguageAutoSelect Italian 1040
580 !insertmacro LanguageAutoSelect Japanese 1041
581 !insertmacro LanguageAutoSelect Polish 1045
582 !insertmacro LanguageAutoSelect Russian 1049
583 !insertmacro LanguageAutoSelect Slovak 1051
584 !insertmacro LanguageAutoSelect Slovenian 1060
585 !insertmacro LanguageAutoSelect Spanish 1034
586 !insertmacro LanguageAutoSelect ChineseTaiwan 1028 ; TradChinese, but section is called ChineseTaiwan
588 ${GetParameters} $CMDARGS
589 ;prepare log always within .onInit function
590 !insertmacro UNINSTALL.LOG_PREPARE_INSTALL
592 ;Extract InstallOptions INI files
593 StrCpy $AskMultiUser "1"
594 StrCpy $MultiUser "0"
595 ; this resets AskMultiUser if Win95/98/ME
596 ClearErrors
597 ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
598 ${If} ${Errors}
599 ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber
600 StrCpy $R0 $R0 1
601 ${IfThen} $R0 = 4 ${|} StrCpy $AskMultiUser 0 ${|}
602 ${EndIf}
604 ; hide all user section if ME/9x
605 ${IfThen} $AskMultiUser != 1 ${|} SectionSetText ${SecAlluser} "" ${|}
607 ; hide if quick launch if not available
608 ${IfThen} $QUICKLAUNCH == $TEMP ${|} SectionSetText ${SecQuicklaunch} "" ${|}
610 ;check if user is admin
611 ClearErrors
612 UserInfo::GetName
613 ${If} ${Errors}
614 ; This one means you don't need to care about admin or
615 ; not admin because Windows 9x doesn't either
616 ${IfCmd} MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(lng_NOT_SUPPORTED)$(lng_OK_CANCEL_DESC)" /SD IDOK IDCANCEL ${||} Quit ${|}
617 ${Else}
618 Pop $User
619 UserInfo::GetAccountType
620 Pop $1
621 ${If} $1 != "Admin"
622 ${AndIf} ${Cmd} ${|} MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(lng_NO_ADMIN)$(lng_OK_CANCEL_DESC)" /SD IDOK IDCANCEL ${|}
623 Quit
624 ${EndIf}
625 ${EndIf}
627 ;check for previous installation
628 ReadRegStr $0 HKLM "${PRODUCT_DIR_REGKEY}" "User"
629 ${IfThen} $0 == "" ${|} ReadRegStr $0 HKCU "${PRODUCT_DIR_REGKEY}" "User" ${|}
630 ;check user if applicable
631 ${If} $0 != ""
632 ${AndIf} $0 != $User
633 ${AndIf} ${Cmd} ${|} MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(lng_DIFFERENT_USER)$(lng_OK_CANCEL_DESC)" /SD IDOK IDCANCEL ${|}
634 Quit
635 ${EndIf}
637 ; call uninstall first
638 ; code taken from the vlc project
639 ReadRegStr $R0 HKLM ${PRODUCT_UNINST_KEY} "UninstallString"
640 ReadRegStr $R1 HKLM ${PRODUCT_UNINST_KEY} "DisplayName"
641 ${If} $R0 == ""
642 ReadRegStr $R0 HKCU ${PRODUCT_UNINST_KEY} "UninstallString"
643 ReadRegStr $R1 HKCU ${PRODUCT_UNINST_KEY} "DisplayName"
644 ${EndIf}
645 ${If} $R0 != ""
646 ${AndIf} ${Cmd} ${|} MessageBox MB_YESNO|MB_ICONEXCLAMATION $(lng_WANT_UNINSTALL_BEFORE) /SD IDNO IDYES ${|}
647 ExecWait $R0 ;Was '$R0 _?=$INSTDIR' but we do NOT want it leaving the uninstaller behind.
648 ${EndIf}
650 ; proccess command line parameter
651 !insertmacro Parameter "GTK" ${SecGTK}
652 !insertmacro Parameter "SHORTCUTS" ${secShortcuts}
653 !insertmacro Parameter "ALLUSER" ${SecAlluser}
654 !insertmacro Parameter "DESKTOP" ${SecDesktop}
655 !insertmacro Parameter "QUICKLAUNCH" ${SecQUICKlaunch}
656 !insertmacro Parameter "SVGEDITOR" ${SecSVGWriter}
657 !insertmacro Parameter "CONTEXTMENUE" ${SecContextMenu}
658 !insertmacro Parameter "PREFERENCES" ${SecPrefs}
659 !insertmacro Parameter "ADDFILES" ${SecAddfiles}
660 !insertmacro Parameter "EXAMPLES" ${SecExamples}
661 !insertmacro Parameter "TUTORIALS" ${SecTutorials}
662 !insertmacro Parameter "LANGUAGES" ${SecLanguages}
663 !insertmacro Parameter "am" ${SecAmharic}
664 !insertmacro Parameter "ar" ${SecArabic}
665 !insertmacro Parameter "az" ${SecAzerbaijani}
666 !insertmacro Parameter "be" ${SecByelorussian}
667 !insertmacro Parameter "bg" ${SecBulgarian}
668 !insertmacro Parameter "bn" ${SecBengali}
669 !insertmacro Parameter "br" ${SecBreton}
670 !insertmacro Parameter "ca" ${SecCatalan}
671 !insertmacro Parameter "ca@valencia" ${SecCatalanValencia}
672 !insertmacro Parameter "cs" ${SecCzech}
673 !insertmacro Parameter "da" ${SecDanish}
674 !insertmacro Parameter "de" ${SecGerman}
675 !insertmacro Parameter "dz" ${SecDzongkha}
676 !insertmacro Parameter "el" ${SecGreek}
677 !insertmacro Parameter "en_AU" ${SecEnglishAustralian}
678 !insertmacro Parameter "en_CA" ${SecEnglishCanadian}
679 !insertmacro Parameter "en_GB" ${SecEnglishBritain}
680 !insertmacro Parameter "en_US@piglatin" ${SecEnglishPiglatin}
681 !insertmacro Parameter "eo" ${SecEsperanto}
682 !insertmacro Parameter "es" ${SecSpanish}
683 !insertmacro Parameter "es_MX" ${SecSpanishMexico}
684 !insertmacro Parameter "et" ${SecEstonian}
685 !insertmacro Parameter "eu" ${SecBasque}
686 !insertmacro Parameter "fi" ${SecFinnish}
687 !insertmacro Parameter "fr" ${SecFrench}
688 !insertmacro Parameter "ga" ${SecIrish}
689 !insertmacro Parameter "gl" ${SecGallegan}
690 !insertmacro Parameter "he" ${SecHebrew}
691 !insertmacro Parameter "hr" ${SecCroatian}
692 !insertmacro Parameter "hu" ${SecHungarian}
693 !insertmacro Parameter "id" ${SecIndonesian}
694 !insertmacro Parameter "it" ${SecItalian}
695 !insertmacro Parameter "ja" ${SecJapanese}
696 !insertmacro Parameter "km" ${SecKhmer}
697 !insertmacro Parameter "ko" ${SecKorean}
698 !insertmacro Parameter "lt" ${SecLithuanian}
699 !insertmacro Parameter "mk" ${SecMacedonian}
700 !insertmacro Parameter "mn" ${SecMongolian}
701 !insertmacro Parameter "nb" ${SecNorwegianBokmal}
702 !insertmacro Parameter "ne" ${SecNepali}
703 !insertmacro Parameter "nl" ${SecDutch}
704 !insertmacro Parameter "nn" ${SecNorwegianNynorsk}
705 !insertmacro Parameter "pa" ${SecPanjabi}
706 !insertmacro Parameter "pl" ${SecPolish}
707 !insertmacro Parameter "pt" ${SecPortuguese}
708 !insertmacro Parameter "pt_BR" ${SecPortugueseBrazil}
709 !insertmacro Parameter "ro" ${SecRomanian}
710 !insertmacro Parameter "ru" ${SecRussian}
711 !insertmacro Parameter "rw" ${SecKinyarwanda}
712 !insertmacro Parameter "sk" ${SecSlovak}
713 !insertmacro Parameter "sl" ${SecSlovenian}
714 !insertmacro Parameter "sq" ${SecAlbanian}
715 !insertmacro Parameter "sr" ${SecSerbian}
716 !insertmacro Parameter "sr@latin" ${SecSerbianLatin}
717 !insertmacro Parameter "sv" ${SecSwedish}
718 !insertmacro Parameter "th" ${SecThai}
719 !insertmacro Parameter "tr" ${SecTurkish}
720 !insertmacro Parameter "uk" ${SecUkrainian}
721 !insertmacro Parameter "vi" ${SecVietnamese}
722 !insertmacro Parameter "zh_CN" ${SecChineseSimplified}
723 !insertmacro Parameter "zh_TW" ${SecChineseTaiwan}
725 ClearErrors
726 ${GetOptions} $CMDARGS "/?" $1
727 ${IfNot} ${Errors}
728 MessageBox MB_OK "Possible parameters for installer:$\r$\n \
729 /?: this help screen$\r$\n \
730 /S: silent$\r$\n \
731 /D=(directory): where to install Inkscape$\r$\n \
732 /GTK=(OFF/ON): GTK+ Runtime environment$\r$\n \
733 /SHORTCUTS=(OFF/ON): shortcuts to start Inkscape$\r$\n \
734 /ALLUSER=(OFF/ON): for all users on the computer$\r$\n \
735 /DESKTOP=(OFF/ON): Desktop icon$\r$\n \
736 /QUICKLAUNCH=(OFF/ON): quick launch icon$\r$\n \
737 /SVGEDITOR=(OFF/ON): default SVG editor$\r$\n \
738 /CONTEXTMENUE=(OFF/ON): context menue integration$\r$\n \
739 /PREFERENCES=(OFF/ON): delete users preference files$\r$\n \
740 /ADDFILES=(OFF/ON): additional files$\r$\n \
741 /EXAMPLES=(OFF/ON): examples$\r$\n \
742 /TUTORIALS=(OFF/ON): tutorials$\r$\n \
743 /LANGUAGES=(OFF/ON): translated menues, examples, etc.$\r$\n \
744 /[locale code]=(OFF/ON): e.g am, es, es_MX as in Inkscape supported"
745 Abort
746 ${EndIf}
747 FunctionEnd
749 ; --------------------------------------------------
751 Function un.CustomPageUninstall
752 !insertmacro MUI_HEADER_TEXT "$(lng_UInstOpt)" "$(lng_UInstOpt1)"
753 !insertmacro MUI_INSTALLOPTIONS_WRITE "inkscape.nsi.uninstall" "Field 1" "Text" "$APPDATA\Inkscape\"
754 !insertmacro MUI_INSTALLOPTIONS_WRITE "inkscape.nsi.uninstall" "Field 2" "Text" "$(lng_PurgePrefs)"
755 !insertmacro MUI_INSTALLOPTIONS_DISPLAY "inkscape.nsi.uninstall"
756 !insertmacro MUI_INSTALLOPTIONS_READ $MultiUser "inkscape.nsi.uninstall" "Field 2" "State"
757 FunctionEnd
759 Function un.onInit
760 ;begin uninstall, could be added on top of uninstall section instead
761 ;!insertmacro UNINSTALL.LOG_BEGIN_UNINSTALL
762 ${IfNot} ${FileExists} $INSTDIR\uninstall.log
763 MessageBox MB_OK|MB_ICONEXCLAMATION "$(lng_UninstallLogNotFound)" /SD IDOK
764 Quit
765 ${EndIf}
766 ClearErrors
767 StrCpy $User ""
768 UserInfo::GetName
769 ${IfNot} ${Errors}
770 Pop $0
771 StrCpy $User $0
772 ${EndIf}
773 StrCpy $askMultiUser 1
774 StrCpy $MultiUser 1
776 ; Test if this was a multiuser installation
777 ReadRegStr $0 HKLM "${PRODUCT_DIR_REGKEY}" ""
778 ${If} $0 == "$INSTDIR\inkscape.exe"
779 ReadRegStr $MultiUser HKLM "${PRODUCT_DIR_REGKEY}" "MultiUser"
780 ReadRegStr $askMultiUser HKLM "${PRODUCT_DIR_REGKEY}" "askMultiUser"
781 ReadRegStr $0 HKLM "${PRODUCT_DIR_REGKEY}" "User"
782 ${Else}
783 ReadRegStr $MultiUser HKCU "${PRODUCT_DIR_REGKEY}" "MultiUser"
784 ReadRegStr $askMultiUser HKCU "${PRODUCT_DIR_REGKEY}" "askMultiUser"
785 ReadRegStr $0 HKCU "${PRODUCT_DIR_REGKEY}" "User"
786 ${EndIf}
787 ;check user if applicable
788 ${If} $0 != ""
789 ${AndIf} $0 != $User
790 ${AndIf} ${Cmd} ${|} MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(lng_DIFFERENT_USER)$(lng_OK_CANCEL_DESC)" /SD IDOK IDCANCEL ${|}
791 Quit
792 ${EndIf}
794 !insertmacro MUI_INSTALLOPTIONS_EXTRACT "inkscape.nsi.uninstall"
796 SetShellVarContext all
797 ${IfThen} $MultiUser = 0 ${|} SetShellVarContext current ${|}
798 FunctionEnd
800 Section Uninstall
801 !ifndef DUMMYINSTALL
802 ; remove personal settings
803 Delete "$APPDATA\Inkscape\extension-errors.log"
804 ${If} $MultiUser = 0
805 DetailPrint "Purging personal settings in $APPDATA\Inkscape"
806 ;RMDir /r "$APPDATA\Inkscape"
807 !insertmacro delprefs
808 ${EndIf}
810 ; Remove file associations for svg editor
811 StrCpy $3 "svg"
812 ${For} $2 0 1
813 ${IfThen} $2 = 1 ${|} StrCpy $3 $3z ${|}
814 DetailPrint "Removing file associations for $3 editor"
815 ClearErrors
816 ReadRegStr $0 HKCR ".$3" ""
817 ${IfNot} ${Errors}
818 ReadRegStr $1 HKCR "$0\shell\edit\command" ""
819 ${If} $1 == `"$INSTDIR\Inkscape.exe" "%1"`
820 DeleteRegKey HKCR "$0\shell\edit\command"
821 ${EndIf}
823 ClearErrors
824 ReadRegStr $1 HKCR "$0\shell\open\command" ""
825 ${If} $1 == `"$INSTDIR\Inkscape.exe" "%1"`
826 DeleteRegKey HKCR "$0\shell\open\command"
827 ${EndIf}
829 DeleteRegKey HKCR "$0\shell\${PRODUCT_NAME}"
830 DeleteRegKey /ifempty HKCR "$0\shell\edit"
831 DeleteRegKey /ifempty HKCR "$0\shell\open"
832 DeleteRegKey /ifempty HKCR "$0\shell"
833 DeleteRegKey /ifempty HKCR "$0"
834 DeleteRegKey /ifempty HKCR ".$3"
835 ${EndIf}
836 ${Next}
838 SetShellVarContext all
839 DeleteRegKey SHCTX "${PRODUCT_DIR_REGKEY}"
840 DeleteRegKey SHCTX "${PRODUCT_UNINST_KEY}"
841 Delete "$DESKTOP\Inkscape.lnk"
842 Delete "$QUICKLAUNCH\Inkscape.lnk"
843 Delete "$SMPROGRAMS\Inkscape.lnk"
844 ;just in case they are still there
845 Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
846 Delete "$SMPROGRAMS\Inkscape\Inkscape.lnk"
847 RMDir "$SMPROGRAMS\Inkscape"
849 SetShellVarContext current
850 DeleteRegKey SHCTX "${PRODUCT_DIR_REGKEY}"
851 DeleteRegKey SHCTX "${PRODUCT_UNINST_KEY}"
852 Delete "$DESKTOP\Inkscape.lnk"
853 Delete "$QUICKLAUNCH\Inkscape.lnk"
854 Delete "$SMPROGRAMS\Inkscape.lnk"
855 ;just in case they are still there
856 Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
857 Delete "$SMPROGRAMS\Inkscape\Inkscape.lnk"
858 RMDir "$SMPROGRAMS\Inkscape"
860 InitPluginsDir
861 SetPluginUnload manual
863 ClearErrors
864 FileOpen $0 $INSTDIR\uninstall.log r
865 ${If} ${Errors} ;else uninstallnotfound
866 MessageBox MB_OK|MB_ICONEXCLAMATION "$(lng_UninstallLogNotFound)" /SD IDOK
867 ${Else}
868 ${Do}
869 ClearErrors
870 FileRead $0 $1
871 ${IfThen} ${Errors} ${|} ${ExitDo} ${|}
872 ; cat the line into md5 and filename
873 StrLen $2 $1
874 ${IfThen} $2 <= 35 ${|} ${Continue} ${|}
875 StrCpy $3 $1 32
876 StrCpy $filename $1 $2-36 34 ;remove trailing CR/LF
877 StrCpy $filename $filename -2
878 ; $3 = MD5 when installed, then deletion choice
879 ; $filename = file
880 ; $5 = MD5 now
881 ; $6 = "always"/"never" remove files touched by user
883 ${If} ${FileExists} $filename
884 ${If} $6 == "always"
885 StrCpy $3 2
886 ${Else}
887 md5dll::GetMD5File /NOUNLOAD $filename
888 Pop $5 ;md5 of file
889 ${If} $3 != $5
890 ${AndIf} $6 != "never"
891 ; the md5 sums does not match so we ask
892 messagebox::show MB_DEFBUTTON3|MB_TOPMOST "" "0,103" \
893 "$(lng_FileChanged)" "$(lng_Yes)" "$(lng_AlwaysYes)" "$(lng_No)" "$(lng_AlwaysNo)"
894 Pop $3
895 ${IfThen} $3 = 2 ${|} StrCpy $6 "always" ${|}
896 ${IfThen} $3 = 4 ${|} StrCpy $6 "never" ${|}
897 ${EndIf}
898 ${EndIf}
900 ${If} $3 = 1 ; yes
901 ${OrIf} $3 = 2 ; always
902 ; Remove File
903 ClearErrors
904 Delete $filename
905 ;now recursivly remove the path
906 ${Do}
907 ClearErrors
908 ${un.GetParent} $filename $filename
909 ${IfThen} ${Errors} ${|} ${ExitDo} ${|}
910 RMDir $filename
911 ${IfThen} ${Errors} ${|} ${ExitDo} ${|}
912 ${Loop}
913 ${EndIf}
914 ${EndIf}
915 ${Loop}
916 ${EndIf}
917 FileClose $0
918 Delete "$INSTDIR\uninstall.log"
919 Delete "$INSTDIR\uninstall.exe"
920 ; remove empty directories
921 RMDir "$INSTDIR\data"
922 RMDir "$INSTDIR\doc"
923 RMDir "$INSTDIR\modules"
924 RMDir "$INSTDIR\plugins"
925 RMDir $INSTDIR
926 SetAutoClose false
927 !endif
928 SectionEnd