X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=packaging%2Fwin32%2Finkscape.nsi;h=5bcd99ee0f8b79ef0928536986152083d5a22592;hb=16d76d26e4fa5c295d19cc7544f9aeebd8325d76;hp=320b90fca62d57677779c10e0012f40d3ac306f3;hpb=8f0abea2698215e9e87e03669867134cbd7a0bd1;p=inkscape.git diff --git a/packaging/win32/inkscape.nsi b/packaging/win32/inkscape.nsi old mode 100644 new mode 100755 index 320b90fca..5bcd99ee0 --- a/packaging/win32/inkscape.nsi +++ b/packaging/win32/inkscape.nsi @@ -1,1165 +1,1005 @@ -; ####################################### -; Inkscape NSIS installer project file -; Used as of 0.40 -; ####################################### - -; ####################################### -; DEFINES -; ####################################### -!define PRODUCT_NAME "Inkscape" -!define PRODUCT_VERSION "0.43+devel" -!define PRODUCT_PUBLISHER "Inkscape Organization" -!define PRODUCT_WEB_SITE "http://www.inkscape.org" -!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\inkscape.exe" -!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" - - - -; ####################################### -; MUI SETTINGS -; ####################################### -; MUI 1.67 compatible ------ +; Instructions for compilers +; ========================== +; This file generates the Inkscape installer, which is currently the +; preferred deployment method on Windows. +; 1. Install NSIS 2.46 or later on Windows (2.45 has a !searchparse bug +; which breaks it and earlier doesn't support Windows 7 properly, and +; cross-compilation probably won't work due to some !system magic) +; 2. Compile Inkscape (http://wiki.inkscape.org/wiki/index.php/Win32Port) +; 3. Compile this file with NSIS. There should be no need to set version +; numbers in this file as it gets them from the Bazaar branch info and +; ..\..\src\inkscape-version.cpp. However, if the version number comes +; out wrong or this script didn't compile properly then you can define +; INKSCAPE_VERSION by uncommenting the next line and setting the correct +; value: +; !define INKSCAPE_VERSION "0.48" +; If you ever need to do a second, third or Nth release of the build or +; of the installer, then change the RELEASE_REVISION value below: + !define RELEASE_REVISION 1 + +; There should never be any need for packagers to touch anything below +; this line. That's my job - Chris Morgan + +; Installer code {{{1 +; Compression and admin requirement {{{2 SetCompressor /SOLID lzma -!include "MUI.nsh" -!include "sections.nsh" +SetCompressorDictSize 32 +RequestExecutionLevel admin + +; Include required files {{{2 +!include RequireLatestNSIS.nsh +!include ifexist.nsh +!include VersionCompleteXXXX.nsh +!include LogicLib.nsh +!include Sections.nsh + +!macro !redef VAR VAL + !define _!redef_${VAR} `${VAL}` + !ifdef ${VAR} + !undef ${VAR} + !endif + !define ${VAR} `${VAL}` + !undef _!redef_${VAR} +!macroend +!define !redef `!insertmacro !redef` + +; Advanced Uninstall Log {{{3 +; We're abusing this script terribly and it's time to fix the broken uninstaller. +; However, for the moment, this is what we're using. +!define INSTDIR_REG_ROOT HKLM +!define INSTDIR_REG_KEY "${UNINST_KEY}" +!include AdvUninstLog.nsh +!insertmacro INTERACTIVE_UNINSTALL + +; Initialise NSIS plug-ins {{{3 +; The plugins used are md5dll and messagebox +!addplugindir . + +; FileFunc bits and pieces {{{3 +!include FileFunc.nsh +!insertmacro GetParameters +!insertmacro GetOptions +!insertmacro un.GetParent + +; User interface {{{3 +!include MUI.nsh +; MUI Configuration {{{4 !define MUI_ABORTWARNING -!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico" +!define MUI_ICON ..\..\inkscape.ico !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico" !define MUI_HEADERIMAGE -!define MUI_HEADERIMAGE_BITMAP "header.bmp" +!define MUI_HEADERIMAGE_BITMAP header.bmp +!define MUI_WELCOMEFINISHPAGE_BITMAP welcomefinish.bmp !define MUI_COMPONENTSPAGE_SMALLDESC - -; Welcome page +; Pages {{{4 +; Installer pages {{{5 +; Welcome page {{{6 !insertmacro MUI_PAGE_WELCOME -; License page -; !define MUI_LICENSEPAGE_RADIOBUTTONS +; License page {{{6 LicenseForceSelection off -!define MUI_LICENSEPAGE_BUTTON $(lng_LICENSE_BUTTON) -!define MUI_LICENSEPAGE_TEXT_BOTTOM $(lng_LICENSE_BOTTOM_TEXT) -!insertmacro MUI_PAGE_LICENSE "..\..\Copying" +;!define MUI_LICENSEPAGE_RADIOBUTTONS +!define MUI_LICENSEPAGE_BUTTON "$(^NextBtn)" +!define MUI_LICENSEPAGE_TEXT_BOTTOM "$(LICENSE_BOTTOM_TEXT)" +!insertmacro MUI_PAGE_LICENSE ..\..\Copying +; Components page {{{6 !insertmacro MUI_PAGE_COMPONENTS -; InstType $(lng_Full) -; InstType $(lng_Optimal) -; InstType $(lng_Minimal) -; Directory page +; InstType "$(Full)" +; InstType "$(Optimal)" +; InstType "$(Minimal)" +; Directory page {{{6 !insertmacro MUI_PAGE_DIRECTORY -; Instfiles page +; Instfiles page {{{6 !insertmacro MUI_PAGE_INSTFILES -; Finish page +; Finish page {{{6 !define MUI_FINISHPAGE_RUN "$INSTDIR\inkscape.exe" !insertmacro MUI_PAGE_FINISH -; Uninstaller pages +; Uninstaller pages {{{5 !insertmacro MUI_UNPAGE_CONFIRM UninstPage custom un.CustomPageUninstall !insertmacro MUI_UNPAGE_INSTFILES ShowUninstDetails hide !insertmacro MUI_UNPAGE_FINISH -; ####################################### -; STRING LOCALIZATION -; ####################################### -; Thanks to Adib Taraben and Luca Bruno for getting this started -; Add your translation here! :-) -; I had wanted to list the languages alphabetically, but apparently -; the first is the default. So putting English first is just being -; practical. It is not chauvinism or hubris, I swear! ;-) -; default language first - -; Language files -!include "english.nsh" -;!include "catalan.nsh" -!include "czech.nsh" -!include "french.nsh" -!include "german.nsh" -!include "italian.nsh" -;!include "polish.nsh" -!include "spanish.nsh" - -ReserveFile "inkscape.nsi.uninstall" - +; Localization {{{3 +; See also the "Languages sections" SectionGroup lower down. +!insertmacro MUI_RESERVEFILE_LANGDLL +;TODO: check if `!insertmacro LANGFILE "English" "English"`-style lines are needed (don't think it should be due to MUI_LANGUAGE) +!echo `Loading language files...` +!verbose push +!verbose 3 +!insertmacro MUI_LANGUAGE "English" +!insertmacro LANGFILE_INCLUDE "languages\English.nsh" +!macro INKLANGFILE _LANG + !insertmacro MUI_LANGUAGE "${_LANG}" + !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "languages\${_LANG}.nsh" "languages\English.nsh" +!macroend +!insertmacro INKLANGFILE Breton +!insertmacro INKLANGFILE Catalan +!insertmacro INKLANGFILE Czech +!insertmacro INKLANGFILE Finnish +!insertmacro INKLANGFILE French +!insertmacro INKLANGFILE Galician +!insertmacro INKLANGFILE German +!insertmacro INKLANGFILE Italian +!insertmacro INKLANGFILE Japanese +!insertmacro INKLANGFILE Polish +!insertmacro INKLANGFILE Romanian +!insertmacro INKLANGFILE Russian +!insertmacro INKLANGFILE Slovak +!insertmacro INKLANGFILE Slovenian +!insertmacro INKLANGFILE Spanish +!insertmacro INKLANGFILE SimpChinese +!insertmacro INKLANGFILE TradChinese +!verbose pop + +ReserveFile inkscape.nsi.uninstall +ReserveFile "${NSISDIR}\Plugins\UserInfo.dll" +!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS ; ####################################### ; SETTINGS ; ####################################### -Name "${PRODUCT_NAME} ${PRODUCT_VERSION}" -Caption $(lng_Caption) -OutFile "Inkscape-${PRODUCT_VERSION}-1.win32.exe" +; Product details (version, name, registry keys etc.) {{{2 +; Find the version number in inkscape-version.cpp (e.g. 0.47+devel) {{{3 +!ifndef INKSCAPE_VERSION + ; Official release format (no newlines) + !searchparse /noerrors /file ..\..\src\inkscape-version.cpp `namespace Inkscape { char const *version_string = "` INKSCAPE_VERSION ` r` BZR_REVISION `"; }` + !ifndef INKSCAPE_VERSION + ; Other format; sorry, it has to be done in two steps. + !searchparse /noerrors /file ..\..\src\inkscape-version.cpp `char const *version_string = "` INKSCAPE_VERSION `";` + !searchparse /noerrors `${INKSCAPE_VERSION}` `` INKSCAPE_VERSION ` r` BZR_REVISION + !ifndef INKSCAPE_VERSION + !error "INKSCAPE_VERSION not defined and unable to get version number from ..\..\src\inkscape-version.cpp!" + !endif + !endif +!endif +!echo `Got version number from ..\..\src\inkscape-version.cpp: ${INKSCAPE_VERSION}` +!define FILENAME Inkscape-${INKSCAPE_VERSION} +!define BrandingText `Inkscape ${INKSCAPE_VERSION}` + +; Check for the Bazaar revision number for lp:inkscape {{{3 +${!ifexist} ..\..\.bzr\branch\last-revision + !if `${BZR_REVISION}` == `` + !undef BZR_REVISION + !endif + !ifndef BZR_REVISION + !searchparse /noerrors /file ..\..\.bzr\branch\last-revision "" BZR_REVISION " " + !endif +!endif + +; Check for devel builds and clear up bzr revision number define {{{3 +!searchparse /noerrors ${INKSCAPE_VERSION} "" INKSCAPE_VERSION_NUMBER "+devel" +!if ${INKSCAPE_VERSION_NUMBER} != ${INKSCAPE_VERSION} + !define DEVEL +!endif +!if `${BZR_REVISION}` == `` + !undef BZR_REVISION +!endif + +; Handle display version number and complete X.X version numbers into X.X.X.X {{{3 +!ifdef DEVEL & BZR_REVISION + ${!redef} FILENAME `${FILENAME}-r${BZR_REVISION}` + ${!redef} BrandingText `${BrandingText} r${BZR_REVISION}` + !define VERSION_X.X.X.X_REVISION ${BZR_REVISION} +; Handle the installer revision number {{{4 +!else ifdef RELEASE_REVISION + ${!redef} FILENAME `${FILENAME}-${RELEASE_REVISION}` + ${!redef} BrandingText `${BrandingText}, revision ${BZR_REVISION}` + !define VERSION_X.X.X.X_REVISION ${RELEASE_REVISION} +!else + !define VERSION_X.X.X.X_REVISION 0 +!endif + +${VersionCompleteXXXN} ${INKSCAPE_VERSION_NUMBER} VERSION_X.X.X.X ${VERSION_X.X.X.X_REVISION} + +; Product definitions {{{3 +!define PRODUCT_NAME "Inkscape" ; TODO: fix up the language files to not use this and kill this line +!define INSTDIR_KEY "Software\Microsoft\Windows\CurrentVersion\App Paths\inkscape.exe" +!define UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\Inkscape" +;!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. +!define _FILENAME ${FILENAME}.exe +!undef FILENAME +!define FILENAME ${_FILENAME} +!undef _FILENAME + +; Product information {{{3 +Name `Inkscape` +Caption `Inkscape - $(CaptionDescription)` +BrandingText `${BrandingText}` +OutFile `${FILENAME}` InstallDir "$PROGRAMFILES\Inkscape" -InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" "" -ShowInstDetails hide -ShowUnInstDetails hide - -var askMultiUser +InstallDirRegKey HKLM "${INSTDIR_KEY}" "" + +; Version information {{{3 +VIProductVersion ${VERSION_X.X.X.X} +VIAddVersionKey ProductName Inkscape +VIAddVersionKey Comments "Licensed under the GNU GPL" +VIAddVersionKey CompanyName inkscape.org +VIAddVersionKey LegalCopyright "© 2009 Inkscape" +VIAddVersionKey FileDescription Inkscape +VIAddVersionKey FileVersion ${VERSION_X.X.X.X} +VIAddVersionKey ProductVersion ${VERSION_X.X.X.X} +VIAddVersionKey InternalName Inkscape + +; Variables {{{2 +Var askMultiUser +Var filename Var MultiUser -var User - -; ####################################### -; I N S T A L L E R S E C T I O N S -; ####################################### - -; Turn off old selected section -; GetWindowsVersion -; -; Based on Yazno's function, http://yazno.tripod.com/powerpimpit/ -; Updated by Joost Verburg -; Updated for Windows 98 SE by Matthew Win Tibbals 5-21-03 -; -; Returns on top of stack -; -; Windows Version (95, 98, ME, NT x.x, 2000, XP, 2003) -; or -; '' (Unknown Windows Version) -; -; Usage: -; Call GetWindowsVersion -; Pop $R0 -; ; at this point $R0 is "NT 4.0" or whatnot -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -Function GetWindowsVersion - - Push $R0 - Push $R1 - - ClearErrors - - ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion - - IfErrors 0 lbl_winnt - - ; we are not NT - ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber - - StrCpy $R1 $R0 1 - StrCmp $R1 '4' 0 lbl_error - - StrCpy $R1 $R0 3 - - StrCmp $R1 '4.0' lbl_win32_95 - StrCmp $R1 '4.9' lbl_win32_ME lbl_win32_98 - - lbl_win32_95: - StrCpy $R0 '95' - StrCpy $AskMultiUser "0" - Goto lbl_done - - lbl_win32_98: - StrCpy $R0 '98' - StrCpy $AskMultiUser "0" - Goto lbl_done - lbl_win32_ME: - StrCpy $R0 'ME' - StrCpy $AskMultiUser "0" - Goto lbl_done - - lbl_winnt: - - StrCpy $R1 $R0 1 - - StrCmp $R1 '3' lbl_winnt_x - StrCmp $R1 '4' lbl_winnt_x - - StrCpy $R1 $R0 3 - - StrCmp $R1 '5.0' lbl_winnt_2000 - StrCmp $R1 '5.1' lbl_winnt_XP - StrCmp $R1 '5.2' lbl_winnt_2003 lbl_error - - lbl_winnt_x: - StrCpy $R0 "NT $R0" 6 - Goto lbl_done - - lbl_winnt_2000: - Strcpy $R0 '2000' - Goto lbl_done - - lbl_winnt_XP: - Strcpy $R0 'XP' - Goto lbl_done - - lbl_winnt_2003: - Strcpy $R0 '2003' - Goto lbl_done - - lbl_error: - Strcpy $R0 '' - lbl_done: - - Pop $R1 - Exch $R0 - -FunctionEnd - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - - ; StrStr - ; input, top of stack = string to search for - ; top of stack-1 = string to search in - ; output, top of stack (replaces with the portion of the string remaining) - ; modifies no other variables. - ; - ; Usage: - ; Push "this is a long ass string" - ; Push "ass" - ; Call StrStr - ; Pop $R0 - ; ($R0 at this point is "ass string") - - Function StrStr - Exch $R1 ; st=haystack,old$R1, $R1=needle - Exch ; st=old$R1,haystack - Exch $R2 ; st=old$R1,old$R2, $R2=haystack - Push $R3 - Push $R4 - Push $R5 - StrLen $R3 $R1 - StrCpy $R4 0 - ; $R1=needle - ; $R2=haystack - ; $R3=len(needle) - ; $R4=cnt - ; $R5=tmp - loop: - StrCpy $R5 $R2 $R3 $R4 - StrCmp $R5 $R1 done - StrCmp $R5 "" done - IntOp $R4 $R4 + 1 - Goto loop - done: - StrCpy $R1 $R2 "" $R4 - Pop $R5 - Pop $R4 - Pop $R3 - Pop $R2 - Exch $R1 - FunctionEnd - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - - ; GetParameters - ; input, none - ; output, top of stack (replaces, with e.g. whatever) - ; modifies no other variables. - - Function GetParameters - - Push $R0 - Push $R1 - Push $R2 - Push $R3 - - StrCpy $R2 1 - StrLen $R3 $CMDLINE - - ;Check for quote or space - StrCpy $R0 $CMDLINE $R2 - StrCmp $R0 '"' 0 +3 - StrCpy $R1 '"' - Goto loop - StrCpy $R1 " " - - loop: - IntOp $R2 $R2 + 1 - StrCpy $R0 $CMDLINE 1 $R2 - StrCmp $R0 $R1 get - StrCmp $R2 $R3 get - Goto loop - - get: - IntOp $R2 $R2 + 1 - StrCpy $R0 $CMDLINE 1 $R2 - StrCmp $R0 " " get - StrCpy $R0 $CMDLINE "" $R2 - - Pop $R3 - Pop $R2 - Pop $R1 - Exch $R0 - - FunctionEnd - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; GetParameterValue -; Chris Morgan 5/10/2004 -; -Updated 4/7/2005 to add support for retrieving a command line switch -; and additional documentation -; -; Searches the command line input, retrieved using GetParameters, for the -; value of an option given the option name. If no option is found the -; default value is placed on the top of the stack upon function return. -; -; This function can also be used to detect the existence of just a -; command line switch like /OUTPUT Pass the default and "OUTPUT" -; on the stack like normal. An empty return string "" will indicate -; that the switch was found, the default value indicates that -; neither a parameter or switch was found. -; -; Inputs - Top of stack is default if parameter isn't found, -; second in stack is parameter to search for, ex. "OUTPUT" -; Outputs - Top of the stack contains the value of this parameter -; So if the command line contained /OUTPUT=somedirectory, "somedirectory" -; will be on the top of the stack when this function returns -; -; Register usage -;$R0 - default return value if the parameter isn't found -;$R1 - input parameter, for example OUTPUT from the above example -;$R2 - the length of the search, this is the search parameter+2 -; as we have '/OUTPUT=' -;$R3 - the command line string -;$R4 - result from StrStr calls -;$R5 - search for ' ' or '"' - -Function GetParameterValue - Exch $R0 ; get the top of the stack(default parameter) into R0 - Exch ; exchange the top of the stack(default) with - ; the second in the stack(parameter to search for) - Exch $R1 ; get the top of the stack(search parameter) into $R1 - - ;Preserve on the stack the registers used in this function - Push $R2 - Push $R3 - Push $R4 - Push $R5 - - Strlen $R2 $R1+2 ; store the length of the search string into R2 - - Call GetParameters ; get the command line parameters - Pop $R3 ; store the command line string in R3 - - # search for quoted search string - StrCpy $R5 '"' ; later on we want to search for a open quote - Push $R3 ; push the 'search in' string onto the stack - Push '"/$R1=' ; push the 'search for' - Call StrStr ; search for the quoted parameter value - Pop $R4 - StrCpy $R4 $R4 "" 1 ; skip over open quote character, "" means no maxlen - StrCmp $R4 "" "" next ; if we didn't find an empty string go to next - - # search for non-quoted search string - StrCpy $R5 ' ' ; later on we want to search for a space since we - ; didn't start with an open quote '"' we shouldn't - ; look for a close quote '"' - Push $R3 ; push the command line back on the stack for searching - Push '/$R1=' ; search for the non-quoted search string - Call StrStr - Pop $R4 - - ; $R4 now contains the parameter string starting at the search string, - ; if it was found -next: - StrCmp $R4 "" check_for_switch ; if we didn't find anything then look for - ; usage as a command line switch - # copy the value after /$R1= by using StrCpy with an offset of $R2, - # the length of '/OUTPUT=' - StrCpy $R0 $R4 "" $R2 ; copy commandline text beyond parameter into $R0 - # search for the next parameter so we can trim this extra text off - Push $R0 - Push $R5 ; search for either the first space ' ', or the first - ; quote '"' - ; if we found '"/output' then we want to find the - ; ending ", as in '"/output=somevalue"' - ; if we found '/output' then we want to find the first - ; space after '/output=somevalue' - Call StrStr ; search for the next parameter - Pop $R4 - StrCmp $R4 "" done ; if 'somevalue' is missing, we are done - StrLen $R4 $R4 ; get the length of 'somevalue' so we can copy this - ; text into our output buffer - StrCpy $R0 $R0 -$R4 ; using the length of the string beyond the value, - ; copy only the value into $R0 - goto done ; if we are in the parameter retrieval path skip over - ; the check for a command line switch - -; See if the parameter was specified as a command line switch, like '/output' -check_for_switch: - Push $R3 ; push the command line back on the stack for searching - Push '/$R1' ; search for the non-quoted search string - Call StrStr - Pop $R4 - StrCmp $R4 "" done ; if we didn't find anything then use the default - StrCpy $R0 "" ; otherwise copy in an empty string since we found the - ; parameter, just didn't find a value - -done: - Pop $R5 - Pop $R4 - Pop $R3 - Pop $R2 - Pop $R1 - Exch $R0 ; put the value in $R0 at the top of the stack -FunctionEnd - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -!macro Language polng lng - SectionIn 1 2 3 - SetOutPath $INSTDIR - File /nonfatal /a "..\..\inkscape\*.${lng}.txt" - SetOutPath $INSTDIR\locale - File /nonfatal /a /r "..\..\inkscape\locale\${polng}" - SetOutPath $INSTDIR\lib\locale - File /nonfatal /a /r "..\..\inkscape\lib\locale\${polng}" - ; the keyboard tables - SetOutPath $INSTDIR\share\screens - File /nonfatal /a /r "..\..\inkscape\share\screens\keys.${polng}.svg" - SetOutPath $INSTDIR\share\templates - File /nonfatal /a /r "..\..\inkscape\share\templates\default.${polng}.svg" - SetOutPath $INSTDIR\doc - File /nonfatal /a /r "..\..\inkscape\doc\keys.${polng}.xml" - File /nonfatal /a /r "..\..\inkscape\doc\keys.${polng}.html" - SectionGetFlags ${SecTutorials} $R1 - IntOp $R1 $R1 & ${SF_SELECTED} - IntCmp $R1 ${SF_SELECTED} 0 skip_tutorials - SetOutPath $INSTDIR\share\tutorials - File /nonfatal /a "..\..\inkscape\share\tutorials\*.${polng}.*" - skip_tutorials: +Var User +Var CMDARGS + +!macro delprefs ; Delete preferences (originally from VLC) {{{2 + StrCpy $0 0 + DetailPrint "Deleting personal preferences..." + DetailPrint "Finding all users..." + ${Do} + ; this will loop through all the logged users and "virtual" windows users + ; (it looks like users are only present in HKEY_USERS when they are logged in) + ClearErrors + EnumRegKey $1 HKU "" $0 + ${IfThen} $1 == "" ${|} ${ExitDo} ${|} + IntOp $0 $0 + 1 + ReadRegStr $2 HKU "$1\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" AppData + ${IfThen} $2 == "" ${|} ${Continue} ${|} + DetailPrint "Removing $2\Inkscape" + Delete $2\Inkscape\preferences.xml + Delete $2\Inkscape\extension-errors.log + RMDir $2\Inkscape + ${Loop} !macroend -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - - - - -;-------------------------------- -; Installer Sections - -Section -removeInkscape - ; check for an old installation and clean that dlls and stuff - ClearErrors - IfFileExists $INSTDIR\etc 0 doDeleteLib - DetailPrint "$INSTDIR\etc exists, will be removed" - RmDir /r $INSTDIR\etc - IfErrors 0 +4 - DetailPrint "fatal: failed to delete $INSTDIR\etc" - DetailPrint "aborting installation" - Abort - doDeleteLib: - - ClearErrors - IfFileExists $INSTDIR\lib 0 doDeleteLocale - DetailPrint "$INSTDIR\lib exists, will be removed" - RmDir /r $INSTDIR\lib - IfErrors 0 +4 - DetailPrint "fatal: failed to delete $INSTDIR\lib" - DetailPrint "aborting installation" - Abort - doDeleteLocale: - - ClearErrors - IfFileExists $INSTDIR\locale 0 doDeleteDll - DetailPrint "$INSTDIR\locale exists, will be removed" - RmDir /r $INSTDIR\locale - IfErrors 0 +4 - DetailPrint "fatal: failed to delete $INSTDIR\locale" - DetailPrint "aborting installation" - Abort - doDeleteDll: +; Sections (these do the work) {{{2 - ClearErrors - FindFirst $0 $1 $INSTDIR\*.dll - FindNextLoop: - StrCmp $1 "" FindNextDone - DetailPrint "$INSTDIR\$1 exists, will be removed" - Delete $INSTDIR\$1 - IfErrors 0 +4 - DetailPrint "fatal: failed to delete $INSTDIR\$1" - DetailPrint "aborting installation" - Abort - FindNext $0 $1 - Goto FindNextLoop - FindNextDone: -SectionEnd - -Section $(lng_Core) SecCore - - DetailPrint "Installing Inkscape Core Files ..." +Section -removeInkscape ; Hidden, mandatory section to clean a previous installation {{{ +!ifndef DUMMYINSTALL + ;remove the old Inkscape shortcuts from the startmenu + ;just in case they are still there + SetShellVarContext current + Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk" + Delete $SMPROGRAMS\Inkscape\Inkscape.lnk + RMDir $SMPROGRAMS\Inkscape + Delete $SMPROGRAMS\Inkscape.lnk + SetShellVarContext all + Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk" + Delete $SMPROGRAMS\Inkscape\Inkscape.lnk + RMDir $SMPROGRAMS\Inkscape + Delete $SMPROGRAMS\Inkscape.lnk +!endif +SectionEnd ; -removeInkscape }}} +Section $(Core) SecCore ; Mandatory Inkscape core files section {{{ SectionIn 1 2 3 RO +!ifndef DUMMYINSTALL + DetailPrint "Installing Inkscape core files..." SetOutPath $INSTDIR + !insertmacro UNINSTALL.LOG_OPEN_INSTALL SetOverwrite on SetAutoClose false - File /a "..\..\inkscape\ink*.exe" - File /a "..\..\inkscape\AUTHORS" - File /a "..\..\inkscape\COPYING" - File /a "..\..\inkscape\COPYING.LIB" - File /a "..\..\inkscape\NEWS" - File /a "..\..\inkscape\HACKING.txt" - File /a "..\..\inkscape\README" - File /a "..\..\inkscape\README.txt" - File /a "..\..\inkscape\TRANSLATORS" - File /nonfatal /a /r "..\..\inkscape\data" - File /nonfatal /a /r "..\..\inkscape\doc" - File /nonfatal /a /r "..\..\inkscape\plugins" - File /nonfatal /a /r /x *.??*.???* /x "examples" /x "tutorials" "..\..\inkscape\share" + File /a ..\..\inkscape\ink*.exe + File /a ..\..\inkscape\AUTHORS + File /a ..\..\inkscape\COPYING + File /a ..\..\inkscape\COPYING.LIB + File /a ..\..\inkscape\NEWS + File /a ..\..\inkscape\gspawn-win32-helper.exe + File /a ..\..\inkscape\gspawn-win32-helper-console.exe + File /nonfatal /a ..\..\inkscape\HACKING.txt + File /a ..\..\inkscape\README + File /nonfatal /a ..\..\inkscape\README.txt + File /a ..\..\inkscape\TRANSLATORS + File /nonfatal /a /r ..\..\inkscape\data + File /nonfatal /a /r ..\..\inkscape\doc + File /nonfatal /a /r ..\..\inkscape\plugins + File /nonfatal /a /r /x *.??*.???* /x examples /x tutorials ..\..\inkscape\share + !insertmacro UNINSTALL.LOG_CLOSE_INSTALL ; this files are added because it slips through the filter SetOutPath $INSTDIR\share\clipart - File /a "..\..\inkscape\share\clipart\inkscape.logo.svg" - ;File /a "..\..\inkscape\share\clipart\inkscape.logo.classic.svg" - SetOutPath $INSTDIR\share\extensions - File /a "..\..\inkscape\share\extensions\pdf_output.inx.txt" - File /a "..\..\inkscape\share\extensions\pdf_output_via_gs_on_win32.inx.txt" + !insertmacro UNINSTALL.LOG_OPEN_INSTALL + File /a ..\..\inkscape\share\clipart\inkscape.logo.svg + !insertmacro UNINSTALL.LOG_CLOSE_INSTALL + SetOutPath $INSTDIR\share\icons + !insertmacro UNINSTALL.LOG_OPEN_INSTALL + File /a ..\..\inkscape\share\icons\inkscape.file.png + File /a ..\..\inkscape\share\icons\inkscape.file.svg + !insertmacro UNINSTALL.LOG_CLOSE_INSTALL SetOutPath $INSTDIR\modules - File /nonfatal /a /r "..\..\inkscape\modules\*.*" + !insertmacro UNINSTALL.LOG_OPEN_INSTALL + File /nonfatal /a /r ..\..\inkscape\modules\*.* + !insertmacro UNINSTALL.LOG_CLOSE_INSTALL SetOutPath $INSTDIR\python - File /nonfatal /a /r "..\..\inkscape\python\*.*" + !insertmacro UNINSTALL.LOG_OPEN_INSTALL + File /nonfatal /a /r ..\..\inkscape\python\*.* + !insertmacro UNINSTALL.LOG_CLOSE_INSTALL +!endif +SectionEnd ; SecCore }}} - -SectionEnd - -Section $(lng_GTKFiles) SecGTK - - DetailPrint "Installing GTK Files ..." - +Section $(GTKFiles) SecGTK ; Mandatory GTK files section {{{ SectionIn 1 2 3 RO +!ifndef DUMMYINSTALL + DetailPrint "Installing GTK files..." SetOutPath $INSTDIR + !insertmacro UNINSTALL.LOG_OPEN_INSTALL SetOverwrite on - File /a /r "..\..\inkscape\*.dll" - File /a /r /x "locale" "..\..\inkscape\lib" - File /a /r "..\..\inkscape\etc" -SectionEnd + File /a /r ..\..\inkscape\*.dll + File /a /r /x locale ..\..\inkscape\lib + File /a /r ..\..\inkscape\etc + !insertmacro UNINSTALL.LOG_CLOSE_INSTALL +!endif +SectionEnd ; SecGTK }}} + +Section -SetCurrentUserOnly ; Set the installation to "current user" only by default {{{ +!ifndef DUMMYINSTALL + StrCpy $MultiUser 0 + SetShellVarContext current +!endif +SectionEnd ; -SetCurrentUserOnly }}} -Section $(lng_Alluser) SecAlluser +Section $(Alluser) SecAlluser ; Then offer the user the option to make it global (default) {{{ + SectionIn 1 2 3 +!ifndef DUMMYINSTALL ; disable this option in Win95/Win98/WinME - SectionIn 1 2 3 - StrCpy $MultiUser "1" -SectionEnd + StrCpy $MultiUser 1 + DetailPrint "Installing in administrator mode (registry root will be HKLM)" + SetShellVarContext all +!endif +SectionEnd ; SecAllUser }}} -SectionGroup $(lng_Shortcuts) SecShortcuts +SectionGroup "$(Shortcuts)" SecShortcuts ; Create shortcuts for the user {{{ -Section $(lng_Desktop) SecDesktop - SectionIn 1 2 3 - ClearErrors - CreateShortCut "$DESKTOP\Inkscape.lnk" "$INSTDIR\inkscape.exe" - IfErrors 0 +2 - DetailPrint "Uups! Problems creating desktop shortcuts" -SectionEnd +Section $(Desktop) SecDesktop ; Desktop shortcut {{{ +!ifndef DUMMYINSTALL + CreateShortCut $DESKTOP\Inkscape.lnk $INSTDIR\inkscape.exe +!endif +SectionEnd ; SecDesktop }}} -Section $(lng_Quicklaunch) SecQuicklaunch - SectionIn 1 2 3 - ClearErrors - StrCmp $QUICKLAUNCH $TEMP +2 - CreateShortCut "$QUICKLAUNCH\Inkscape.lnk" "$INSTDIR\inkscape.exe" - IfErrors 0 +2 - DetailPrint "Uups! Problems creating quicklaunch shortcuts" -SectionEnd +Section $(Quicklaunch) SecQuickLaunch ; Quick Launch shortcut {{{ +!ifndef DUMMYINSTALL + ${IfThen} $QUICKLAUNCH != $TEMP ${|} CreateShortCut $QUICKLAUNCH\Inkscape.lnk $INSTDIR\inkscape.exe ${|} +!endif +SectionEnd ; SecQuickLaunch }}} -Section $(lng_SVGWriter) SecSVGWriter +Section $(SVGWriter) SecSVGWriter ; Register Inkscape as the default application for .svg[z] {{{ SectionIn 1 2 3 - ; create file associations, test before if needed - DetailPrint "creating file associations" - ClearErrors - ReadRegStr $0 HKCR ".svg" "" - StrCmp $0 "" 0 +3 - WriteRegStr HKCR ".svg" "" "svgfile" - WriteRegStr HKCR "svgfile" "" "Scalable Vector Graphics file" - ReadRegStr $0 HKCR ".svgz" "" - StrCmp $0 "" 0 +3 - WriteRegStr HKCR ".svgz" "" "svgfile" - WriteRegStr HKCR "svgfile" "" "Scalable Vector Graphics file" - IfErrors 0 +2 - DetailPrint "Uups! Problems creating file assoziations for svg writer" - - DetailPrint "creating default editor" - ClearErrors - ReadRegStr $0 HKCR ".svg" "" - WriteRegStr HKCR "$0\shell\edit\command" "" '"$INSTDIR\Inkscape.exe" "%1"' - ReadRegStr $0 HKCR ".svgz" "" - WriteRegStr HKCR "$0\shell\edit\command" "" '"$INSTDIR\Inkscape.exe" "%1"' - IfErrors 0 +2 - DetailPrint "Uups! Problems creating default editor" -SectionEnd - -Section $(lng_ContextMenu) SecContextMenu +!ifndef DUMMYINSTALL + DetailPrint "Associating SVG files with Inkscape" + StrCpy $3 svg + ${For} $2 0 1 + ${IfThen} $2 = 1 ${|} StrCpy $3 $3z ${|} + ReadRegStr $0 HKCR ".$3" "" + ${If} $0 == "" + StrCpy $0 "$3file" + WriteRegStr HKCR ".$3" "" $0 + WriteRegStr HKCR $0 "" "Scalable Vector Graphics file" + ${EndIf} + WriteRegStr HKCR $0\shell\edit\command "" `"$INSTDIR\Inkscape.exe" "%1"` + ${Next} +!endif +SectionEnd ; SecSVGWriter }}} + +Section $(ContextMenu) SecContextMenu ; Put Inkscape in the .svg[z] context menus (but not as default) {{{ SectionIn 1 2 3 - ; create file associations, test before if needed - DetailPrint "creating file associations" - ClearErrors - ReadRegStr $0 HKCR ".svg" "" - StrCmp $0 "" 0 +3 - WriteRegStr HKCR ".svg" "" "svgfile" - WriteRegStr HKCR "svgfile" "" "Scalable Vector Graphics file" - ReadRegStr $0 HKCR ".svgz" "" - StrCmp $0 "" 0 +3 - WriteRegStr HKCR ".svgz" "" "svgfile" - WriteRegStr HKCR "svgfile" "" "Scalable Vector Graphics file" - IfErrors 0 +2 - DetailPrint "Uups! Problems creating file assoziations for context menu" - - DetailPrint "creating context menue" - ClearErrors - ReadRegStr $0 HKCR ".svg" "" - WriteRegStr HKCR "$0\shell\${PRODUCT_NAME}\command" "" '"$INSTDIR\Inkscape.exe" "%1"' - ReadRegStr $0 HKCR ".svgz" "" - WriteRegStr HKCR "$0\shell\${PRODUCT_NAME}\command" "" '"$INSTDIR\Inkscape.exe" "%1"' - IfErrors 0 +2 - DetailPrint "Uups! Problems creating context menue integration" - -SectionEnd - -SectionGroupEnd - -SectionGroup $(lng_Addfiles) SecAddfiles - -Section $(lng_Examples) SecExamples +!ifndef DUMMYINSTALL + DetailPrint "Adding Inkscape to SVG file context menu" + ReadRegStr $0 HKCR .svg "" + ${If} $0 == "" + StrCpy $0 svgfile + WriteRegStr HKCR .svg "" $0 + WriteRegStr HKCR $0 "" "Scalable Vector Graphics file" + ${EndIf} + WriteRegStr HKCR $0\shell\Inkscape\command "" `"$INSTDIR\Inkscape.exe" "%1"` + + ReadRegStr $0 HKCR .svgz "" + ${If} $0 == "" + StrCpy $0 svgzfile + WriteRegStr HKCR .svgz "" $0 + WriteRegStr HKCR $0 "" "Scalable Vector Graphics file" + ${EndIf} + WriteRegStr HKCR $0\shell\Inkscape\command "" `"$INSTDIR\Inkscape.exe" "%1"` +!endif +SectionEnd ; SecContextMenu }}} + +SectionGroupEnd ; SecShortcuts }}} + +Section /o "$(DeletePrefs)" SecPrefs ; Delete user preferences before installation {{{ +!ifndef DUMMYINSTALL + !insertmacro delprefs +!endif +SectionEnd ; SecPrefs }}} + +SectionGroup "$(Addfiles)" SecAddfiles ; Additional files {{{ + +Section $(Examples) SecExamples ; Install example SVG files {{{ SectionIn 1 2 +!ifndef DUMMYINSTALL SetOutPath $INSTDIR\share - File /nonfatal /a /r /x "*.??*.???*" "..\..\inkscape\share\examples" -SectionEnd + !insertmacro UNINSTALL.LOG_OPEN_INSTALL + File /nonfatal /a /r /x *.??*.???* ..\..\inkscape\share\examples + !insertmacro UNINSTALL.LOG_CLOSE_INSTALL +!endif +SectionEnd ; SecExamples }}} -Section $(lng_Tutorials) SecTutorials +Section $(Tutorials) SecTutorials ; Install tutorials {{{ SectionIn 1 2 +!ifndef DUMMYINSTALL SetOutPath $INSTDIR\share - File /nonfatal /a /r /x "*.??*.???*" "..\..\inkscape\share\tutorials" -SectionEnd - -SectionGroupEnd - -SectionGroup /e $(lng_Languages) SecLanguages - -Section $(lng_am) SecAmharic - !insertmacro Language am am -SectionEnd - -Section $(lng_az) SecAzerbaijani - !insertmacro Language az az -SectionEnd - -Section $(lng_be) SecByelorussian - !insertmacro Language be be -SectionEnd - -Section $(lng_ca) SecCatalan - !insertmacro Language ca ca -SectionEnd - -Section $(lng_cs) SecCzech - !insertmacro Language cs cs -SectionEnd - -Section $(lng_da) SecDanish - !insertmacro Language da da -SectionEnd - -Section $(lng_de) SecGerman - !insertmacro Language 'de' 'de' -SectionEnd - -Section $(lng_el) SecGreek - !insertmacro Language el el -SectionEnd - -Section $(lng_en) SecEnglish - SectionIn 1 2 3 RO -SectionEnd - -Section $(lng_es) SecSpanish - !insertmacro Language 'es' 'es' -SectionEnd - -Section $(lng_es_MX) SecSpanishMexico - !insertmacro Language 'es_MX' 'es_MX' -SectionEnd - -Section $(lng_et) SecEstonian - !insertmacro Language et et -SectionEnd - -Section $(lng_fr) SecFrench - !insertmacro Language 'fr' 'fr' -SectionEnd - -Section $(lng_ga) SecIrish - !insertmacro Language ga ga -SectionEnd - -Section $(lng_gl) SecGallegan - !insertmacro Language gl gl - SectionIn 1 2 3 -SectionEnd - -Section $(lng_hu) SecHungarian - !insertmacro Language hu hu - SectionIn 1 2 3 -SectionEnd - -Section $(lng_it) SecItalian - !insertmacro Language it it - SectionIn 1 2 3 -SectionEnd - -Section $(lng_ja) SecJapanese - !insertmacro Language 'ja' 'jp' -SectionEnd - -Section $(lng_ko) SecKorean - !insertmacro Language 'ko' 'ko' -SectionEnd - -Section $(lng_lt) SecLithuanian - !insertmacro Language 'lt' 'lt' -SectionEnd - -Section $(lng_mk) SecMacedonian - !insertmacro Language mk mk -SectionEnd - -Section $(lng_nb) SecNorwegianBokmal - !insertmacro Language nb nb -SectionEnd - -Section $(lng_nl) SecDutch - !insertmacro Language nl nl -SectionEnd - -Section $(lng_nn) SecNorwegianNynorsk - !insertmacro Language nn nn -SectionEnd - -Section $(lng_pa) SecPanjabi - !insertmacro Language pa pa -SectionEnd - -Section $(lng_pl) SecPolish - !insertmacro Language pl pl -SectionEnd - -Section $(lng_pt) SecPortuguese - !insertmacro Language pt pt -SectionEnd - -Section $(lng_pt_BR) SecPortugueseBrazil - !insertmacro Language pt_BR pt_BR -SectionEnd - -Section $(lng_ru) SecRussian - !insertmacro Language ru ru -SectionEnd - -Section $(lng_sk) SecSlovak - !insertmacro Language sk sk -SectionEnd - -Section $(lng_sl) SecSlovenian - !insertmacro Language sl sl -SectionEnd - -Section $(lng_sr) SecSerbian - !insertmacro Language sr sr -SectionEnd - -Section $(lng_sr@Latn) SecSerbianLatin - !insertmacro Language 'sr@Latn' 'sr@Latn' -SectionEnd - -Section $(lng_sv) SecSwedish - !insertmacro Language sv sv -SectionEnd - -Section $(lng_tr) SecTurkish - !insertmacro Language tr tr -SectionEnd - -Section $(lng_uk) SecUkrainian - !insertmacro Language uk uk -SectionEnd - -Section $(lng_zh_CN) SecChineseSimplified - !insertmacro Language zh_CN zh_CN -SectionEnd - -Section $(lng_zh_TW) SecChineseTaiwan - !insertmacro Language zh_TW zh_TW -SectionEnd - -SectionGroupEnd - - -Section -FinalizeInstallation - StrCmp $MultiUser "1" "" SingleUser - DetailPrint "admin mode, registry root will be HKLM" - SetShellVarContext all - Goto endSingleUser - SingleUser: - DetailPrint "single user mode, registry root will be HKCU" - SetShellVarContext current - endSingleUser: - - ; check for writing registry - ClearErrors - WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\inkscape.exe" - ;IfErrors 0 +4 - ; DetailPrint "fatal: failed to write to ${PRODUCT_DIR_REGKEY}" - ; DetailPrint "aborting installation" - ; Abort - WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "MultiUser" "$MultiUser" - WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "askMultiUser" "$askMultiUser" - WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "User" "$User" - IfErrors 0 +2 - DetailPrint "fatal: failed to write to registry installation info" + !insertmacro UNINSTALL.LOG_OPEN_INSTALL + File /nonfatal /a /r /x *.??*.???* ..\..\inkscape\share\tutorials + !insertmacro UNINSTALL.LOG_CLOSE_INSTALL +!endif +SectionEnd ; SecTutorials }}} + +SectionGroupEnd ; SecAddfiles }}} + +SectionGroup "$(Languages)" SecLanguages ; Languages sections {{{ + !macro Language SecName lng ; A macro to create each section {{{ + Section /o "$(lng_${lng}) (${lng})" Sec${SecName} + ;SectionIn 1 2 3 + !ifndef DUMMYINSTALL + SetOutPath $INSTDIR + !insertmacro UNINSTALL.LOG_OPEN_INSTALL + File /nonfatal /a ..\..\inkscape\*.${lng}.txt ; FIXME: remove this? No such files. + !insertmacro UNINSTALL.LOG_CLOSE_INSTALL + SetOutPath $INSTDIR\locale + !insertmacro UNINSTALL.LOG_OPEN_INSTALL + File /nonfatal /a /r ..\..\inkscape\locale\${lng} + !insertmacro UNINSTALL.LOG_CLOSE_INSTALL + SetOutPath $INSTDIR\lib\locale + !insertmacro UNINSTALL.LOG_OPEN_INSTALL + File /nonfatal /a /r ..\..\inkscape\lib\locale\${lng} + !insertmacro UNINSTALL.LOG_CLOSE_INSTALL + SetOutPath $INSTDIR\share\clipart + !insertmacro UNINSTALL.LOG_OPEN_INSTALL + File /nonfatal /a /r ..\..\inkscape\share\clipart\*.${lng}.svg + !insertmacro UNINSTALL.LOG_CLOSE_INSTALL + ; the keyboard tables + SetOutPath $INSTDIR\share\screens + !insertmacro UNINSTALL.LOG_OPEN_INSTALL + File /nonfatal /a /r ..\..\inkscape\share\screens\*.${lng}.svg + !insertmacro UNINSTALL.LOG_CLOSE_INSTALL + SetOutPath $INSTDIR\share\templates + !insertmacro UNINSTALL.LOG_OPEN_INSTALL + File /nonfatal /a /r ..\..\inkscape\share\templates\*.${lng}.svg + !insertmacro UNINSTALL.LOG_CLOSE_INSTALL + SetOutPath $INSTDIR\doc + !insertmacro UNINSTALL.LOG_OPEN_INSTALL + File /nonfatal /a /r ..\..\inkscape\doc\keys.${lng}.xml + File /nonfatal /a /r ..\..\inkscape\doc\keys.${lng}.html + !insertmacro UNINSTALL.LOG_CLOSE_INSTALL + SectionGetFlags ${SecTutorials} $R1 + IntOp $R1 $R1 & ${SF_SELECTED} + ${If} $R1 >= ${SF_SELECTED} + SetOutPath $INSTDIR\share\tutorials + !insertmacro UNINSTALL.LOG_OPEN_INSTALL + File /nonfatal /a ..\..\inkscape\share\tutorials\*.${lng}.* + !insertmacro UNINSTALL.LOG_CLOSE_INSTALL + ${EndIf} + !endif + SectionEnd + !macroend ; Language }}} + + ; Now create each section with the Language macro {{{ + !insertmacro Language Amharic am + !insertmacro Language Arabic ar + !insertmacro Language Azerbaijani az + !insertmacro Language Byelorussian be + !insertmacro Language Bulgarian bg + !insertmacro Language Bengali bn + !insertmacro Language Breton br + !insertmacro Language Catalan ca + !insertmacro Language CatalanValencia ca@valencia + !insertmacro Language Czech cs + !insertmacro Language Danish da + !insertmacro Language German de + !insertmacro Language Dzongkha dz + !insertmacro Language Greek el + !insertmacro Language EnglishAustralian en_AU + !insertmacro Language EnglishCanadian en_CA + !insertmacro Language EnglishBritain en_GB + !insertmacro Language EnglishPiglatin en_US@piglatin + !insertmacro Language Esperanto eo + !insertmacro Language Spanish es + !insertmacro Language SpanishMexico es_MX + !insertmacro Language Estonian et + !insertmacro Language Basque eu + !insertmacro Language French fr + !insertmacro Language Finnish fi + !insertmacro Language Irish ga + !insertmacro Language Gallegan gl + !insertmacro Language Hebrew he + !insertmacro Language Croatian hr + !insertmacro Language Hungarian hu + !insertmacro Language Indonesian id + !insertmacro Language Italian it + !insertmacro Language Japanese ja + !insertmacro Language Khmer km + !insertmacro Language Korean ko + !insertmacro Language Lithuanian lt + !insertmacro Language Mongolian mn + !insertmacro Language Macedonian mk + !insertmacro Language NorwegianBokmal nb + !insertmacro Language Nepali ne + !insertmacro Language Dutch nl + !insertmacro Language NorwegianNynorsk nn + !insertmacro Language Panjabi pa + !insertmacro Language Polish pl + !insertmacro Language Portuguese pt + !insertmacro Language PortugueseBrazil pt_BR + !insertmacro Language Romanian ro + !insertmacro Language Russian ru + !insertmacro Language Kinyarwanda rw + !insertmacro Language Slovak sk + !insertmacro Language Slovenian sl + !insertmacro Language Albanian sq + !insertmacro Language Serbian sr + !insertmacro Language SerbianLatin sr@latin + !insertmacro Language Swedish sv + !insertmacro Language Thai th + !insertmacro Language Turkish tr + !insertmacro Language Ukrainian uk + !insertmacro Language Vietnamese vi + !insertmacro Language ChineseSimplified zh_CN + !insertmacro Language ChineseTaiwan zh_TW + ; }}} +SectionGroupEnd ; SecLanguages }}} + +Section -FinalizeInstallation ; Hidden, mandatory section to finalize installation {{{ +!ifndef DUMMYINSTALL + DetailPrint "Finalizing installation" + ${IfThen} $MultiUser = 1 ${|} SetShellVarContext all ${|} + ${IfThen} $MultiUser != 1 ${|} SetShellVarContext current ${|} + + WriteRegStr SHCTX "${INSTDIR_KEY}" "" $INSTDIR\inkscape.exe + WriteRegStr SHCTX "${INSTDIR_KEY}" MultiUser $MultiUser + WriteRegStr SHCTX "${INSTDIR_KEY}" askMultiUser $askMultiUser + WriteRegStr SHCTX "${INSTDIR_KEY}" User $User ; start menu entries - ClearErrors - CreateDirectory "$SMPROGRAMS\Inkscape" - CreateShortCut "$SMPROGRAMS\Inkscape\Inkscape.lnk" "$INSTDIR\inkscape.exe" - CreateShortCut "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk" "$INSTDIR\uninst.exe" - IfErrors 0 +2 - DetailPrint "fatal: failed to write to start menu info" + CreateShortcut $SMPROGRAMS\Inkscape.lnk $INSTDIR\inkscape.exe ; uninstall settings + ; WriteUninstaller $INSTDIR\uninst.exe + WriteRegExpandStr SHCTX "${UNINST_KEY}" UninstallString ${UNINST_EXE} + WriteRegExpandStr SHCTX "${UNINST_KEY}" InstallDir $INSTDIR + WriteRegExpandStr SHCTX "${UNINST_KEY}" InstallLocation $INSTDIR + WriteRegStr SHCTX "${UNINST_KEY}" DisplayName "Inkscape ${INKSCAPE_VERSION}" + WriteRegStr SHCTX "${UNINST_KEY}" DisplayIcon $INSTDIR\Inkscape.exe,0 + WriteRegStr SHCTX "${UNINST_KEY}" DisplayVersion ${INKSCAPE_VERSION} + WriteRegDWORD SHCTX "${UNINST_KEY}" NoModify 1 + WriteRegDWORD SHCTX "${UNINST_KEY}" NoRepair 1 + + ;create/update log always within .onInstSuccess function + !insertmacro UNINSTALL.LOG_UPDATE_INSTALL + + DetailPrint "Creating MD5 checksums" ClearErrors - WriteUninstaller "$INSTDIR\uninst.exe" - WriteRegExpandStr SHCTX "${PRODUCT_UNINST_KEY}" "UninstallString" '"$INSTDIR\uninst.exe"' - WriteRegExpandStr SHCTX "${PRODUCT_UNINST_KEY}" "InstallLocation" "$INSTDIR" - WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayName" "${PRODUCT_NAME} ${PRODUCT_VERSION}" - WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\Inkscape.exe,0" - WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}" - WriteRegDWORD SHCTX "${PRODUCT_UNINST_KEY}" "NoModify" "1" - WriteRegDWORD SHCTX "${PRODUCT_UNINST_KEY}" "NoRepair" "1" - IfErrors 0 +2 - DetailPrint "fatal: failed to write to registry un-installation info" -SectionEnd - -; Last the Descriptions -!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN - !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} $(lng_CoreDesc) - !insertmacro MUI_DESCRIPTION_TEXT ${SecGTK} $(lng_GTKFilesDesc) - !insertmacro MUI_DESCRIPTION_TEXT ${SecShortcuts} $(lng_ShortcutsDesc) - !insertmacro MUI_DESCRIPTION_TEXT ${SecAlluser} $(lng_AlluserDesc) - !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} $(lng_DesktopDesc) - !insertmacro MUI_DESCRIPTION_TEXT ${SecQuicklaunch} $(lng_QuicklaunchDesc) - !insertmacro MUI_DESCRIPTION_TEXT ${SecSVGWriter} $(lng_SVGWriterDesc) - !insertmacro MUI_DESCRIPTION_TEXT ${SecContextMenu} $(lng_ContextMenuDesc) - !insertmacro MUI_DESCRIPTION_TEXT ${SecAddfiles} $(lng_AddfilesDesc) - !insertmacro MUI_DESCRIPTION_TEXT ${SecExamples} $(lng_ExamplesDesc) - !insertmacro MUI_DESCRIPTION_TEXT ${SecTutorials} $(lng_TutorialsDesc) - !insertmacro MUI_DESCRIPTION_TEXT ${SecLanguages} $(lng_LanguagesDesc) -!insertmacro MUI_FUNCTION_DESCRIPTION_END - -!macro Parameter key Section - Push ${key} - Push "" - Call GetParameterValue - Pop $1 - StrCmp $1 "OFF" 0 +5 - SectionGetFlags ${Section} $0 - IntOp $2 ${SF_SELECTED} ~ - IntOp $0 $0 & $2 - SectionSetFlags ${Section} $0 - StrCmp $1 "ON" 0 +4 - SectionGetFlags ${Section} $0 - IntOp $0 $0 | ${SF_SELECTED} - SectionSetFlags ${Section} $0 -!macroend + FileOpen $0 $INSTDIR\Uninstall.dat r + FileOpen $9 $INSTDIR\Uninstall.log w + ${IfNot} ${Errors} + ${Do} + ClearErrors + FileRead $0 $1 + ${IfThen} ${Errors} ${|} ${ExitDo} ${|} + StrCpy $1 $1 -2 + md5dll::GetMD5File /NOUNLOAD $1 + Pop $2 + ${IfThen} $2 != "" ${|} FileWrite $9 "$2 $1$\r$\n" ${|} + ${Loop} + ${EndIf} + FileClose $0 + FileClose $9 + ; Not needed any more + Delete $INSTDIR\Uninstall.dat +!endif +SectionEnd ; -FinalizeInstallation }}} + +!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN ; Section descriptions {{{ + !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} "$(CoreDesc)" + !insertmacro MUI_DESCRIPTION_TEXT ${SecGTK} "$(GTKFilesDesc)" + !insertmacro MUI_DESCRIPTION_TEXT ${SecShortcuts} "$(ShortcutsDesc)" + !insertmacro MUI_DESCRIPTION_TEXT ${SecAlluser} "$(AlluserDesc)" + !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} "$(DesktopDesc)" + !insertmacro MUI_DESCRIPTION_TEXT ${SecQuicklaunch} "$(QuicklaunchDesc)" + !insertmacro MUI_DESCRIPTION_TEXT ${SecSVGWriter} "$(SVGWriterDesc)" + !insertmacro MUI_DESCRIPTION_TEXT ${SecContextMenu} "$(ContextMenuDesc)" + !insertmacro MUI_DESCRIPTION_TEXT ${SecPrefs} "$(DeletePrefsDesc)" + !insertmacro MUI_DESCRIPTION_TEXT ${SecAddfiles} "$(AddfilesDesc)" + !insertmacro MUI_DESCRIPTION_TEXT ${SecExamples} "$(ExamplesDesc)" + !insertmacro MUI_DESCRIPTION_TEXT ${SecTutorials} "$(TutorialsDesc)" + !insertmacro MUI_DESCRIPTION_TEXT ${SecLanguages} "$(LanguagesDesc)" +!insertmacro MUI_FUNCTION_DESCRIPTION_END ; Section descriptions }}} + + +Function .onInit ; initialise the installer {{{2 + ; This code will be executed before the sections, but due to the + ; language code in the sections it must come after it in the code. + + ; Language detection {{{ + !insertmacro MUI_LANGDLL_DISPLAY + + !macro LanguageAutoSelect SecName LocaleID + ${If} $LANGUAGE = ${LocaleID} + SectionGetFlags ${Sec${SecName}} $0 + IntOp $0 $0 | ${SF_SELECTED} + SectionSetFlags ${Sec${SecName}} $0 + ${EndIf} + !macroend + + ; No need for English to be detected as it's the default + !insertmacro LanguageAutoSelect Breton 1150 + !insertmacro LanguageAutoSelect Catalan 1027 + !insertmacro LanguageAutoSelect Czech 1029 + !insertmacro LanguageAutoSelect Finnish 1035 + !insertmacro LanguageAutoSelect French 1036 + !insertmacro LanguageAutoSelect Gallegan 1110 ; Galician, but section is called Gallegan + !insertmacro LanguageAutoSelect German 1031 + !insertmacro LanguageAutoSelect Italian 1040 + !insertmacro LanguageAutoSelect Japanese 1041 + !insertmacro LanguageAutoSelect Polish 1045 + !insertmacro LanguageAutoSelect Romanian 1048 + !insertmacro LanguageAutoSelect Russian 1049 + !insertmacro LanguageAutoSelect Slovak 1051 + !insertmacro LanguageAutoSelect Slovenian 1060 + !insertmacro LanguageAutoSelect Spanish 1034 + !insertmacro LanguageAutoSelect ChineseTaiwan 1028 ; TradChinese, but section is called ChineseTaiwan + ; End of language detection }}} + + !insertmacro UNINSTALL.LOG_PREPARE_INSTALL ; prepare advanced uninstallation log script -Function .onInit ;Extract InstallOptions INI files - StrCpy $AskMultiUser "1" - StrCpy $MultiUser "0" + StrCpy $AskMultiUser 1 + StrCpy $MultiUser 0 ; this resets AskMultiUser if Win95/98/ME - Call GetWindowsVersion - Pop $R0 - DetailPrint "detected operating system $R0" - ;MessageBox MB_OK "operating system: $R0; AskMultiuser: $AskMultiUser" - - ; hide all user section if win98 - StrCmp $AskMultiUser "1" +2 - SectionSetText ${SecAlluser} "" - - ; hide if quick launch if not available - StrCmp $QUICKLAUNCH $TEMP 0 +2 - SectionSetText ${SecQuicklaunch} "" - - ;check if user is admin ClearErrors - UserInfo::GetName - IfErrors info_Win9x - Pop $0 - StrCpy $User $0 - UserInfo::GetAccountType - Pop $1 - StrCmp $1 "Admin" info_done - - MessageBox MB_OK|MB_ICONEXCLAMATION "$(lng_NO_ADMIN)" + ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion + ${If} ${Errors} + ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber + StrCpy $R0 $R0 1 + ${IfThen} $R0 = 4 ${|} StrCpy $AskMultiUser 0 ${|} + ${EndIf} - Goto info_done + ; hide all user section if ME/9x + ${IfThen} $AskMultiUser != 1 ${|} SectionSetText ${SecAlluser} "" ${|} - info_Win9x: - # This one means you don't need to care about admin or - # not admin because Windows 9x doesn't either - MessageBox MB_OK|MB_ICONEXCLAMATION $(lng_NOT_SUPPORTED) + ; hide if quick launch if not available + ${IfThen} $QUICKLAUNCH == $TEMP ${|} SectionSetText ${SecQuicklaunch} "" ${|} - info_done: + ; Check for administrative privileges {{{ + ClearErrors + UserInfo::GetName + ${If} ${Errors} + ; This one means you don't need to care about admin or + ; not admin because Windows 9x doesn't either + ${IfCmd} MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(NOT_SUPPORTED)$(OK_CANCEL_DESC)" /SD IDOK IDCANCEL ${||} Quit ${|} + ${Else} + Pop $User + UserInfo::GetAccountType + Pop $1 + ${If} $1 != Admin + ${AndIf} ${Cmd} ${|} MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(NO_ADMIN)$(OK_CANCEL_DESC)" /SD IDOK IDCANCEL ${|} + Quit + ${EndIf} + ${EndIf} ; }}} + + ; Detect an Inkscape installation by another user {{{ + ReadRegStr $0 HKLM "${INSTDIR_KEY}" User ; first global... + ${IfThen} $0 == "" ${|} ReadRegStr $0 HKCU "${INSTDIR_KEY}" User ${|} ; then current user + ${If} $0 != "" + ${AndIf} $0 != $User + ${AndIf} ${Cmd} ${|} MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(DIFFERENT_USER)$(OK_CANCEL_DESC)" /SD IDOK IDCANCEL ${|} + Quit + ${EndIf} ; }}} + + ; Request uninstallation of an old Inkscape installation {{{ + ReadRegStr $R0 HKLM "${UNINST_KEY}" UninstallString + ${IfThen} $R0 == "" ${|} ReadRegStr $R0 HKCU "${UNINST_KEY}" UninstallString ${|} + ${If} $R0 != "" + ${AndIf} ${Cmd} ${|} MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(WANT_UNINSTALL_BEFORE)" /SD IDNO IDYES ${|} + ExecWait $R0 + ${EndIf} ; }}} + + ; Process command-line arguments (for automation) {{{ + !echo `Creating code to process command-line arguments...` + !verbose push + !verbose 3 + ${GetParameters} $CMDARGS + + !macro Parameter key Section + ${GetOptions} $CMDARGS /${key}= $1 + ${If} $1 == OFF + SectionGetFlags ${Section} $0 + IntOp $2 ${SF_SELECTED} ~ + IntOp $0 $0 & $2 + SectionSetFlags ${Section} $0 + ${EndIf} + ${If} $1 == ON + SectionGetFlags ${Section} $0 + IntOp $0 $0 | ${SF_SELECTED} + SectionSetFlags ${Section} $0 + ${EndIf} + !macroend + + !insertmacro Parameter GTK ${SecGTK} + !insertmacro Parameter SHORTCUTS ${secShortcuts} + !insertmacro Parameter ALLUSER ${SecAlluser} + !insertmacro Parameter DESKTOP ${SecDesktop} + !insertmacro Parameter QUICKLAUNCH ${SecQUICKlaunch} + !insertmacro Parameter SVGEDITOR ${SecSVGWriter} + !insertmacro Parameter CONTEXTMENUE ${SecContextMenu} + !insertmacro Parameter PREFERENCES ${SecPrefs} + !insertmacro Parameter ADDFILES ${SecAddfiles} + !insertmacro Parameter EXAMPLES ${SecExamples} + !insertmacro Parameter TUTORIALS ${SecTutorials} + !insertmacro Parameter LANGUAGES ${SecLanguages} + !insertmacro Parameter am ${SecAmharic} + !insertmacro Parameter ar ${SecArabic} + !insertmacro Parameter az ${SecAzerbaijani} + !insertmacro Parameter be ${SecByelorussian} + !insertmacro Parameter bg ${SecBulgarian} + !insertmacro Parameter bn ${SecBengali} + !insertmacro Parameter br ${SecBreton} + !insertmacro Parameter ca ${SecCatalan} + !insertmacro Parameter ca@valencia ${SecCatalanValencia} + !insertmacro Parameter cs ${SecCzech} + !insertmacro Parameter da ${SecDanish} + !insertmacro Parameter de ${SecGerman} + !insertmacro Parameter dz ${SecDzongkha} + !insertmacro Parameter el ${SecGreek} + !insertmacro Parameter en_AU ${SecEnglishAustralian} + !insertmacro Parameter en_CA ${SecEnglishCanadian} + !insertmacro Parameter en_GB ${SecEnglishBritain} + !insertmacro Parameter en_US@piglatin ${SecEnglishPiglatin} + !insertmacro Parameter eo ${SecEsperanto} + !insertmacro Parameter es ${SecSpanish} + !insertmacro Parameter es_MX ${SecSpanishMexico} + !insertmacro Parameter et ${SecEstonian} + !insertmacro Parameter eu ${SecBasque} + !insertmacro Parameter fi ${SecFinnish} + !insertmacro Parameter fr ${SecFrench} + !insertmacro Parameter ga ${SecIrish} + !insertmacro Parameter gl ${SecGallegan} + !insertmacro Parameter he ${SecHebrew} + !insertmacro Parameter hr ${SecCroatian} + !insertmacro Parameter hu ${SecHungarian} + !insertmacro Parameter id ${SecIndonesian} + !insertmacro Parameter it ${SecItalian} + !insertmacro Parameter ja ${SecJapanese} + !insertmacro Parameter km ${SecKhmer} + !insertmacro Parameter ko ${SecKorean} + !insertmacro Parameter lt ${SecLithuanian} + !insertmacro Parameter mk ${SecMacedonian} + !insertmacro Parameter mn ${SecMongolian} + !insertmacro Parameter nb ${SecNorwegianBokmal} + !insertmacro Parameter ne ${SecNepali} + !insertmacro Parameter nl ${SecDutch} + !insertmacro Parameter nn ${SecNorwegianNynorsk} + !insertmacro Parameter pa ${SecPanjabi} + !insertmacro Parameter pl ${SecPolish} + !insertmacro Parameter pt ${SecPortuguese} + !insertmacro Parameter pt_BR ${SecPortugueseBrazil} + !insertmacro Parameter ro ${SecRomanian} + !insertmacro Parameter ru ${SecRussian} + !insertmacro Parameter rw ${SecKinyarwanda} + !insertmacro Parameter sk ${SecSlovak} + !insertmacro Parameter sl ${SecSlovenian} + !insertmacro Parameter sq ${SecAlbanian} + !insertmacro Parameter sr ${SecSerbian} + !insertmacro Parameter sr@latin ${SecSerbianLatin} + !insertmacro Parameter sv ${SecSwedish} + !insertmacro Parameter th ${SecThai} + !insertmacro Parameter tr ${SecTurkish} + !insertmacro Parameter uk ${SecUkrainian} + !insertmacro Parameter vi ${SecVietnamese} + !insertmacro Parameter zh_CN ${SecChineseSimplified} + !insertmacro Parameter zh_TW ${SecChineseTaiwan} - ;check for previous installation - ReadRegStr $0 HKLM "${PRODUCT_DIR_REGKEY}" "User" - StrCmp $0 "" +1 +2 - ReadRegStr $0 HKCU "${PRODUCT_DIR_REGKEY}" "User" - ;check user if applicable - StrCmp $0 "" +3 - StrCmp $0 $User +2 - MessageBox MB_OK|MB_ICONEXCLAMATION "$(lng_DIFFERENT_USER)" - - ; proccess command line parameter - !insertmacro Parameter "GTK" ${SecGTK} - !insertmacro Parameter "SHORTCUTS" ${secShortcuts} - !insertmacro Parameter "ALLUSER" ${SecAlluser} - !insertmacro Parameter "DESKTOP" ${SecDesktop} - !insertmacro Parameter "QUICKLAUNCH" ${SecQUICKlaunch} - !insertmacro Parameter "SVGEDITOR" ${SecSVGWriter} - !insertmacro Parameter "CONTEXTMENUE" ${SecContextMenu} - !insertmacro Parameter "ADDFILES" ${SecAddfiles} - !insertmacro Parameter "EXAMPLES" ${SecExamples} - !insertmacro Parameter "TUTORIALS" ${SecTutorials} - !insertmacro Parameter "LANGUAGES" ${SecLanguages} - !insertmacro Parameter "am" ${SecAmharic} - !insertmacro Parameter "az" ${SecAzerbaijani} - !insertmacro Parameter "be" ${SecByelorussian} - !insertmacro Parameter "ca" ${SecCatalan} - !insertmacro Parameter "cs" ${SecCzech} - !insertmacro Parameter "da" ${SecDanish} - !insertmacro Parameter "de" ${SecGerman} - !insertmacro Parameter "el" ${SecGreek} - !insertmacro Parameter "es" ${SecSpanish} - !insertmacro Parameter "es_MX" ${SecSpanishMexico} - !insertmacro Parameter "et" ${SecEstonian} - !insertmacro Parameter "fr" ${SecFrench} - !insertmacro Parameter "ga" ${SecIrish} - !insertmacro Parameter "gl" ${SecGallegan} - !insertmacro Parameter "hu" ${SecHungarian} - !insertmacro Parameter "it" ${SecItalian} - !insertmacro Parameter "ja" ${SecJapanese} - !insertmacro Parameter "ko" ${SecKorean} - !insertmacro Parameter "mk" ${SecMacedonian} - !insertmacro Parameter "nb" ${SecNorwegianBokmal} - !insertmacro Parameter "nl" ${SecDutch} - !insertmacro Parameter "nn" ${SecNorwegianNynorsk} - !insertmacro Parameter "pa" ${SecPanjabi} - !insertmacro Parameter "pl" ${SecPolish} - !insertmacro Parameter "pt" ${SecPortuguese} - !insertmacro Parameter "pt_BR" ${SecPortugueseBrazil} - !insertmacro Parameter "ru" ${SecRussian} - !insertmacro Parameter "sk" ${SecSlovak} - !insertmacro Parameter "sl" ${SecSlovenian} - !insertmacro Parameter "sr" ${SecSerbian} - !insertmacro Parameter "sr@Latn" ${SecSerbianLatin} - !insertmacro Parameter "sv" ${SecSwedish} - !insertmacro Parameter "tr" ${SecTurkish} - !insertmacro Parameter "uk" ${SecUkrainian} - !insertmacro Parameter "zh_CN" ${SecChineseSimplified} - !insertmacro Parameter "zh_TW" ${SecChineseTaiwan} - - Push "?" - Push "TEST" - Call GetParameterValue - Pop $1 - StrCmp $1 "TEST" +3 - MessageBox MB_OK "possible parameters for installer:$\r$\n \ + ClearErrors + ${GetOptions} $CMDARGS /? $1 + ${IfNot} ${Errors} + MessageBox MB_OK "Possible parameters for installer:$\r$\n \ /?: this help screen$\r$\n \ /S: silent$\r$\n \ - /D=(directory): where to install inkscape$\r$\n \ + /D=(directory): where to install Inkscape$\r$\n \ /GTK=(OFF/ON): GTK+ Runtime environment$\r$\n \ - /SHORTCUTS=(OFF/ON): shortcuts to start inkscape$\r$\n \ + /SHORTCUTS=(OFF/ON): shortcuts to start Inkscape$\r$\n \ /ALLUSER=(OFF/ON): for all users on the computer$\r$\n \ /DESKTOP=(OFF/ON): Desktop icon$\r$\n \ /QUICKLAUNCH=(OFF/ON): quick launch icon$\r$\n \ /SVGEDITOR=(OFF/ON): default SVG editor$\r$\n \ /CONTEXTMENUE=(OFF/ON): context menue integration$\r$\n \ + /PREFERENCES=(OFF/ON): delete users preference files$\r$\n \ /ADDFILES=(OFF/ON): additional files$\r$\n \ /EXAMPLES=(OFF/ON): examples$\r$\n \ /TUTORIALS=(OFF/ON): tutorials$\r$\n \ /LANGUAGES=(OFF/ON): translated menues, examples, etc.$\r$\n \ /[locale code]=(OFF/ON): e.g am, es, es_MX as in Inkscape supported" Abort -FunctionEnd - -Function .onSelChange -FunctionEnd - -; -------------------------------------------------- - -Function un.CustomPageUninstall - !insertmacro MUI_HEADER_TEXT "$(lng_UInstOpt)" "$(lng_UInstOpt1)" - !insertmacro MUI_INSTALLOPTIONS_WRITE "inkscape.nsi.uninstall" "Field 1" "Text" "$APPDATA\Inkscape\preferences.xml" - !insertmacro MUI_INSTALLOPTIONS_WRITE "inkscape.nsi.uninstall" "Field 2" "Text" "$(lng_PurgePrefs)" - - !insertmacro MUI_INSTALLOPTIONS_DISPLAY "inkscape.nsi.uninstall" - !insertmacro MUI_INSTALLOPTIONS_READ $MultiUser "inkscape.nsi.uninstall" "Field 2" "State" - DetailPrint "keepfiles = $MultiUser" - ;MessageBox MB_OK "adminmode = $MultiUser MultiUserOS = $askMultiUser" - -FunctionEnd - - -Function un.onInit - + !verbose pop + ${EndIf} ; }}} +FunctionEnd ; .onInit }}} +; Uninstaller code {{{1 +Function un.onInit ; initialise uninstaller {{{ + ;begin uninstall, could be added on top of uninstall section instead + ;!insertmacro UNINSTALL.LOG_BEGIN_UNINSTALL + ${IfNot} ${FileExists} $INSTDIR\uninstall.log + MessageBox MB_OK|MB_ICONEXCLAMATION "$(UninstallLogNotFound)" /SD IDOK + Quit + ${EndIf} ClearErrors StrCpy $User "" - UserInfo::GetName - IfErrors +3 - Pop $0 - StrCpy $User $0 - - StrCpy $askMultiUser "1" - StrCpy $MultiUser "1" - + UserInfo::GetName + ${IfNot} ${Errors} + Pop $0 + StrCpy $User $0 + ${EndIf} + StrCpy $askMultiUser 1 + StrCpy $MultiUser 1 + ; Test if this was a multiuser installation - ReadRegStr $0 HKLM "${PRODUCT_DIR_REGKEY}" "" - StrCmp $0 "$INSTDIR\inkscape.exe" 0 +5 - ReadRegStr $MultiUser HKLM "${PRODUCT_DIR_REGKEY}" "MultiUser" - ReadRegStr $askMultiUser HKLM "${PRODUCT_DIR_REGKEY}" "askMultiUser" - ReadRegStr $0 HKLM "${PRODUCT_DIR_REGKEY}" "User" - Goto +4 - ReadRegStr $MultiUser HKCU "${PRODUCT_DIR_REGKEY}" "MultiUser" - ReadRegStr $askMultiUser HKCU "${PRODUCT_DIR_REGKEY}" "askMultiUser" - ReadRegStr $0 HKCU "${PRODUCT_DIR_REGKEY}" "User" + ReadRegStr $0 HKLM "${INSTDIR_KEY}" "" + ${If} $0 == $INSTDIR\inkscape.exe + ReadRegStr $MultiUser HKLM "${INSTDIR_KEY}" MultiUser + ReadRegStr $askMultiUser HKLM "${INSTDIR_KEY}" askMultiUser + ReadRegStr $0 HKLM "${INSTDIR_KEY}" User + ${Else} + ReadRegStr $MultiUser HKCU "${INSTDIR_KEY}" MultiUser + ReadRegStr $askMultiUser HKCU "${INSTDIR_KEY}" askMultiUser + ReadRegStr $0 HKCU "${INSTDIR_KEY}" User + ${EndIf} ;check user if applicable - StrCmp $0 "" +3 - StrCmp $0 $User +2 - MessageBox MB_OK|MB_ICONEXCLAMATION "$(lng_DIFFERENT_USER)" - - !insertmacro MUI_INSTALLOPTIONS_EXTRACT "inkscape.nsi.uninstall" - - ;check whether Multi user installation ? - SetShellVarContext all - StrCmp $MultiUser "0" 0 +2 - SetShellVarContext current - ;MessageBox MB_OK "adminmode = $MultiUser MultiUserOS = $askMultiUser" - -FunctionEnd - -Section Uninstall + ${If} $0 != "" + ${AndIf} $0 != $User + ${AndIf} ${Cmd} ${|} MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(DIFFERENT_USER)$(OK_CANCEL_DESC)" /SD IDOK IDCANCEL ${|} + Quit + ${EndIf} + !insertmacro MUI_INSTALLOPTIONS_EXTRACT inkscape.nsi.uninstall + + SetShellVarContext all + ${IfThen} $MultiUser = 0 ${|} SetShellVarContext current ${|} +FunctionEnd ; un.onInit }}} + +Function un.CustomPageUninstall ; {{{ + !insertmacro MUI_HEADER_TEXT "$(UInstOpt)" "$(UInstOpt1)" + !insertmacro MUI_INSTALLOPTIONS_WRITE inkscape.nsi.uninstall "Field 1" Text "$APPDATA\Inkscape\" + !insertmacro MUI_INSTALLOPTIONS_WRITE inkscape.nsi.uninstall "Field 2" Text "$(PurgePrefs)" + !insertmacro MUI_INSTALLOPTIONS_DISPLAY inkscape.nsi.uninstall + !insertmacro MUI_INSTALLOPTIONS_READ $MultiUser inkscape.nsi.uninstall "Field 2" State +FunctionEnd ; un.CustomPageUninstall }}} + +Section Uninstall ; do the uninstalling {{{ +!ifndef DUMMYINSTALL ; remove personal settings - Delete "$APPDATA\Inkscape\extension-errors.log" - StrCmp $MultiUser "0" 0 endPurge ; multiuser assigned in dialog - DetailPrint "purge personal settings in $APPDATA\Inkscape" - RMDir /r "$APPDATA\Inkscape" - endPurge: + Delete $APPDATA\Inkscape\extension-errors.log + ${If} $MultiUser = 0 + DetailPrint "Purging personal settings in $APPDATA\Inkscape" + ;RMDir /r $APPDATA\Inkscape + !insertmacro delprefs + ${EndIf} ; Remove file associations for svg editor - DetailPrint "removing file associations for svg editor" - ClearErrors - ReadRegStr $0 HKCR ".svg" "" - DetailPrint ".svg associated as $0" - IfErrors endUninstSVGEdit - ReadRegStr $1 HKCR "$0\shell\edit\command" "" - IfErrors 0 +2 - DetailPrint "svg editor is $1" - StrCmp $1 '"$INSTDIR\Inkscape.exe" "%1"' 0 +3 - DetailPrint "removing default .svg editor" - DeleteRegKey HKCR "$0\shell\edit\command" - DeleteRegKey /ifempty HKCR "$0\shell\edit" - DeleteRegKey /ifempty HKCR "$0\shell" - DeleteRegKey /ifempty HKCR "$0" - endUninstSVGEdit: - - ClearErrors - ReadRegStr $2 HKCR ".svgz" "" - DetailPrint ".svgz associated as $2" - IfErrors endUninstSVGZEdit - ReadRegStr $3 HKCR "$2\shell\edit\command" "" - IfErrors 0 +2 - DetailPrint "svgz editor is $1" - StrCmp $3 '"$INSTDIR\Inkscape.exe" "%1"' 0 +3 - DetailPrint "removing default .svgz editor" - DeleteRegKey HKCR "$2\shell\edit\command" - DeleteRegKey /ifempty HKCR "$2\shell\edit" - DeleteRegKey /ifempty HKCR "$2\shell" - DeleteRegKey /ifempty HKCR "$2" - endUninstSVGZEdit: - - ; Remove file associations for svg editor - DetailPrint "removing file associations for svg editor" - ClearErrors - ReadRegStr $0 HKCR ".svg" "" - IfErrors endUninstSVGView - ReadRegStr $1 HKCR "$0\shell\open\command" "" - IfErrors 0 +2 - DetailPrint "svg viewer is $1" - StrCmp $1 '"$INSTDIR\Inkscape.exe" "%1"' 0 +3 - DetailPrint "removing default .svg viewer" - DeleteRegKey HKCR "$0\shell\open\command" - DeleteRegKey /ifempty HKCR "$0\shell\open" - DeleteRegKey /ifempty HKCR "$0\shell" - DeleteRegKey /ifempty HKCR "$0" - endUninstSVGView: - - ClearErrors - ReadRegStr $2 HKCR ".svgz" "" - IfErrors endUninstSVGZView - ReadRegStr $3 HKCR "$2\shell\open\command" "" - IfErrors 0 +2 - DetailPrint "svgz viewer is $1" - StrCmp $3 '"$INSTDIR\Inkscape.exe" "%1"' 0 +3 - DetailPrint "removing default .svgz viewer" - DeleteRegKey HKCR "$2\shell\open\command" - DeleteRegKey /ifempty HKCR "$2\shell\open" - DeleteRegKey /ifempty HKCR "$2\shell" - DeleteRegKey /ifempty HKCR "$2" - endUninstSVGZView: - - ; Remove file associations for context menue - DetailPrint "removing file associations for svg editor" - ClearErrors - ReadRegStr $0 HKCR ".svg" "" - IfErrors endUninstSVGContext - DetailPrint "removing default .svg context menue" - DeleteRegKey HKCR "$0\shell\${PRODUCT_NAME}" - DeleteRegKey /ifempty HKCR "$0\shell" - DeleteRegKey /ifempty HKCR "$0" - endUninstSVGContext: - - ClearErrors - ReadRegStr $2 HKCR ".svgz" "" - IfErrors endUninstSVGZContext - DetailPrint "removing default .svgzcontext menue" - DeleteRegKey HKCR "$2\shell\${PRODUCT_NAME}" - DeleteRegKey /ifempty HKCR "$2\shell" - DeleteRegKey /ifempty HKCR "$2" - endUninstSVGZContext: - - ReadRegStr $1 HKCR "$0" "" - StrCmp $1 "" 0 +3 - DetailPrint "removing filetype .svg $0" - DeleteRegKey HKCR ".svg" - - ReadRegStr $3 HKCR "$2" "" - StrCmp $3 "" 0 +3 - DetailPrint "removing filetype .svgz $2" - DeleteRegKey HKCR ".svgz" - - + StrCpy $3 svg + ${For} $2 0 1 + ${IfThen} $2 = 1 ${|} StrCpy $3 $3z ${|} + DetailPrint "Removing file associations for $3 editor" + ClearErrors + ReadRegStr $0 HKCR .$3 "" + ${IfNot} ${Errors} + ReadRegStr $1 HKCR $0\shell\edit\command "" + ${If} $1 == `"$INSTDIR\Inkscape.exe" "%1"` + DeleteRegKey HKCR $0\shell\edit\command + ${EndIf} + + ClearErrors + ReadRegStr $1 HKCR $0\shell\open\command "" + ${If} $1 == `"$INSTDIR\Inkscape.exe" "%1"` + DeleteRegKey HKCR $0\shell\open\command + ${EndIf} + + DeleteRegKey HKCR $0\shell\Inkscape + DeleteRegKey /ifempty HKCR $0\shell\edit + DeleteRegKey /ifempty HKCR $0\shell\open + DeleteRegKey /ifempty HKCR $0\shell + DeleteRegKey /ifempty HKCR $0 + DeleteRegKey /ifempty HKCR .$3 + ${EndIf} + ${Next} + SetShellVarContext all - DetailPrint "removing product regkey" - DeleteRegKey SHCTX "${PRODUCT_DIR_REGKEY}" - DetailPrint "removing uninstall info" - DeleteRegKey SHCTX "${PRODUCT_UNINST_KEY}" - DetailPrint "removing shortcuts" - Delete "$DESKTOP\Inkscape.lnk" - Delete "$QUICKLAUNCH\Inkscape.lnk" + DeleteRegKey SHCTX "${INSTDIR_KEY}" + DeleteRegKey SHCTX "${UNINST_KEY}" + Delete $DESKTOP\Inkscape.lnk + Delete $QUICKLAUNCH\Inkscape.lnk + Delete $SMPROGRAMS\Inkscape.lnk + ;just in case they are still there Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk" - Delete "$SMPROGRAMS\Inkscape\Inkscape.lnk" - RMDir "$SMPROGRAMS\Inkscape" + Delete $SMPROGRAMS\Inkscape\Inkscape.lnk + RMDir $SMPROGRAMS\Inkscape SetShellVarContext current - DetailPrint "removing product regkey" - DeleteRegKey SHCTX "${PRODUCT_DIR_REGKEY}" - DetailPrint "removing uninstall info" - DeleteRegKey SHCTX "${PRODUCT_UNINST_KEY}" - DetailPrint "removing shortcuts" - Delete "$DESKTOP\Inkscape.lnk" - Delete "$QUICKLAUNCH\Inkscape.lnk" + DeleteRegKey SHCTX "${INSTDIR_KEY}" + DeleteRegKey SHCTX "${UNINST_KEY}" + Delete $DESKTOP\Inkscape.lnk + Delete $QUICKLAUNCH\Inkscape.lnk + Delete $SMPROGRAMS\Inkscape.lnk + ;just in case they are still there Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk" - Delete "$SMPROGRAMS\Inkscape\Inkscape.lnk" - RMDir "$SMPROGRAMS\Inkscape" + Delete $SMPROGRAMS\Inkscape\Inkscape.lnk + RMDir $SMPROGRAMS\Inkscape - DetailPrint "removing uninstall info" - RMDir /r "$INSTDIR" + InitPluginsDir + SetPluginUnload manual + ClearErrors + FileOpen $0 $INSTDIR\uninstall.log r + ${If} ${Errors} ;else uninstallnotfound + MessageBox MB_OK|MB_ICONEXCLAMATION "$(UninstallLogNotFound)" /SD IDOK + ${Else} + ${Do} + ClearErrors + FileRead $0 $1 + ${IfThen} ${Errors} ${|} ${ExitDo} ${|} + ; cat the line into md5 and filename + StrLen $2 $1 + ${IfThen} $2 <= 35 ${|} ${Continue} ${|} + StrCpy $3 $1 32 + StrCpy $filename $1 $2-36 34 ;remove trailing CR/LF + StrCpy $filename $filename -2 + ; $3 = MD5 when installed, then deletion choice + ; $filename = file + ; $5 = MD5 now + ; $6 = always/never remove files touched by user + + ${If} ${FileExists} $filename + ${If} $6 == always + StrCpy $3 2 + ${Else} + md5dll::GetMD5File /NOUNLOAD $filename + Pop $5 ;md5 of file + ${If} $3 == $5 + StrCpy $3 1 ; yes + ${ElseIf} $6 != never + ; the md5 sums does not match so we ask + messagebox::show MB_DEFBUTTON3|MB_TOPMOST "" 0,103 \ + "$(FileChanged)" "$(Yes)" "$(AlwaysYes)" "$(No)" "$(AlwaysNo)" + Pop $3 + ${IfThen} $3 = 2 ${|} StrCpy $6 always ${|} + ${IfThen} $3 = 4 ${|} StrCpy $6 never ${|} + ${EndIf} + ${EndIf} + + ${If} $3 = 1 ; yes + ${OrIf} $3 = 2 ; always + ; Remove File + ClearErrors + Delete $filename + ;now recursivly remove the path + ${Do} + ClearErrors + ${un.GetParent} $filename $filename + ${IfThen} ${Errors} ${|} ${ExitDo} ${|} + RMDir $filename + ${IfThen} ${Errors} ${|} ${ExitDo} ${|} + ${Loop} + ${EndIf} + ${EndIf} + ${Loop} + ${EndIf} + FileClose $0 + Delete $INSTDIR\uninstall.log + Delete $INSTDIR\uninstall.exe + ; remove empty directories + RMDir $INSTDIR\data + RMDir $INSTDIR\doc + RMDir $INSTDIR\modules + RMDir $INSTDIR\plugins + RMDir $INSTDIR SetAutoClose false +!endif +SectionEnd ; Uninstall }}} +; }}} -SectionEnd - +; This file has been optimised for use in Vim with folding. +; (If you can't cope, :set nofoldenable) vim:fen:fdm=marker