From e65d9865568ed2bf36aca8b0cfcf21e278bc3650 Mon Sep 17 00:00:00 2001 From: theadib Date: Fri, 15 Jun 2007 22:15:35 +0000 Subject: [PATCH] installer remembers installed files and uninstaller does not delete user files --- packaging/win32/AdvUninstLog.nsh | 437 +++++++++++++++++++++++++++++++ packaging/win32/AdvUninstLog.txt | 121 +++++++++ packaging/win32/inkscape.nsi | 90 ++++++- 3 files changed, 644 insertions(+), 4 deletions(-) create mode 100644 packaging/win32/AdvUninstLog.nsh create mode 100644 packaging/win32/AdvUninstLog.txt diff --git a/packaging/win32/AdvUninstLog.nsh b/packaging/win32/AdvUninstLog.nsh new file mode 100644 index 000000000..2b5b5c77b --- /dev/null +++ b/packaging/win32/AdvUninstLog.nsh @@ -0,0 +1,437 @@ + ;_____________________________ HEADER FILE BEGIN ____________________________ + + # Advanced Uninstall Log NSIS header + # Version 1.0 2007-01-31 + # By Red Wine (http://nsis.sf.net/User:Red_Wine) + + # Usage: See included examples Uninstall_Log_Default_UI.nsi - Uninstall_Log_Modern_UI.nsi + +!verbose push + !verbose 3 + +!ifndef ADVANCED_UNINSTALL.LOG_NSH + !define ADVANCED_UNINSTALL.LOG_NSH + +!ifndef INSTDIR_REG_ROOT | INSTDIR_REG_KEY + !error "You must properly define both INSTDIR_REG_ROOT and INSTDIR_REG_KEY" +!endif + +!ifndef UNINSTALL_LOG + !define UNINSTALL_LOG "Uninstall" +!endif + +!ifndef UNINST_LOG_VERBOSE + !define UNINST_LOG_VERBOSE "3" +!endif + +!verbose pop + +!echo "Advanced Uninstall Log NSIS header v1.0 2007-01-31 by Red Wine (http://nsis.sf.net/User:Red_Wine)" + +!verbose push + !verbose ${UNINST_LOG_VERBOSE} + +!define UNINST_EXE "$INSTDIR\${UNINSTALL_LOG}.exe" +!define UNINST_DAT "$INSTDIR\${UNINSTALL_LOG}.dat" +!define UNLOG_PART "$PLUGINSDIR\part." +!define UNLOG_TEMP "$PLUGINSDIR\unlog.tmp" +!define EXCLU_LIST "$PLUGINSDIR\exclude.tmp" +!define UNLOG_HEAD "=========== Uninstaller Log please do not edit this file ===========" + + var unlog_tmp_0 + var unlog_tmp_1 + var unlog_tmp_2 + var unlog_tmp_3 + var unlog_error + +!include FileFunc.nsh +!include TextFunc.nsh + +!insertmacro Locate +!insertmacro un.Locate +!insertmacro DirState +!insertmacro un.DirState +!insertmacro FileJoin +!insertmacro TrimNewLines +!insertmacro un.TrimNewLines + +;.............................. Uninstaller Macros .............................. + +!macro UNINSTALL.LOG_BEGIN_UNINSTALL + !verbose push + !verbose ${UNINST_LOG_VERBOSE} + + IfFileExists "${UNINST_DAT}" +3 + MessageBox MB_ICONSTOP|MB_OK "${UNINST_DAT} not found, unable to perform uninstall." /SD IDOK + Quit + + StrCmp "$PLUGINSDIR" "" 0 +2 + InitPluginsDir + + CopyFiles "${UNINST_DAT}" "${UNLOG_TEMP}" + FileOpen $unlog_tmp_2 "${UNLOG_TEMP}" r + + !verbose pop +!macroend + + +!macro UNINSTALL.LOG_END_UNINSTALL + !verbose push + !verbose ${UNINST_LOG_VERBOSE} + + FileClose $unlog_tmp_2 + DeleteRegValue ${INSTDIR_REG_ROOT} "${INSTDIR_REG_KEY}" "${UNINSTALL_LOG}.dat" + DeleteRegValue ${INSTDIR_REG_ROOT} "${INSTDIR_REG_KEY}" "${UNINSTALL_LOG}Directory" + + !verbose pop +!macroend + + +!macro UNINSTALL.LOG_UNINSTALL TargetDir + !verbose push + !verbose ${UNINST_LOG_VERBOSE} + + !ifndef INTERACTIVE_UNINSTALL & UNATTENDED_UNINSTALL + !error "You must insert either Interactive or Unattended Uninstall neither both, neither none." + !endif + + !ifdef INTERACTIVE_UNINSTALL + GetTempFileName $unlog_tmp_5 "$PLUGINSDIR" + FileOpen $unlog_tmp_4 "$unlog_tmp_5" a + !endif + + ${PerfomUninstall} "${TargetDir}" "${UnLog_Uninstall_CallBackFunc}" + + !ifdef INTERACTIVE_UNINSTALL + FileClose $unlog_tmp_4 + !endif + + !verbose pop +!macroend + + +!define PerfomUninstall "!insertmacro PERFORMUNINSTALL" + +!macro PERFORMUNINSTALL TargetDir UninstCallBackFunc + !verbose push + !verbose ${UNINST_LOG_VERBOSE} + + !define ID ${__LINE__} + + ${un.Locate} "${TargetDir}" "/L=F" "${UninstCallBackFunc}" + + loop_${ID}: + + StrCpy $unlog_tmp_1 0 + + ${un.Locate} "${TargetDir}" "/L=DE" "${UninstCallBackFunc}" + StrCmp $unlog_tmp_1 "0" 0 loop_${ID} + + ${un.DirState} "${TargetDir}" $unlog_tmp_0 + StrCmp "$unlog_tmp_0" "0" 0 +2 + RmDir "${TargetDir}" + + IfErrors 0 +2 + MessageBox MB_ICONEXCLAMATION|MB_OK "${UNINSTALL_LOG} Log error" /SD IDOK + + !undef ID + + !verbose pop +!macroend + + +!macro INTERACTIVE_UNINSTALL + !verbose push + !verbose ${UNINST_LOG_VERBOSE} + + !ifdef INTERACTIVE_UNINSTALL + !error "INTERACTIVE_UNINSTALL is already defined" + !endif + + var unlog_tmp_4 + var unlog_tmp_5 + + !define INTERACTIVE_UNINSTALL + + !ifdef INTERACTIVE_UNINSTALL & UNATTENDED_UNINSTALL + !error "You must insert either Interactive or Unattended Uninstall neither both, neither none." + !endif + + !ifdef UnLog_Uninstall_CallBackFunc + !undef UnLog_Uninstall_CallBackFunc + !endif + + !ifndef UnLog_Uninstall_CallBackFunc + !insertmacro UNINSTALL.LOG_UNINSTALL_INTERACTIVE + !define UnLog_Uninstall_CallBackFunc "un._LocateCallBack_Function_Interactive" + !endif + + !verbose pop +!macroend + + +!macro UNATTENDED_UNINSTALL + !verbose push + !verbose ${UNINST_LOG_VERBOSE} + + !ifdef UNATTENDED_UNINSTALL + !error "UNATTENDED_UNINSTALL is already defined" + !endif + + !define UNATTENDED_UNINSTALL + + !ifdef INTERACTIVE_UNINSTALL & UNATTENDED_UNINSTALL + !error "You must insert either Interactive or Unattended Uninstall neither both, neither none." + !endif + + !ifdef UnLog_Uninstall_CallBackFunc + !undef UnLog_Uninstall_CallBackFunc + !endif + + !ifndef UnLog_Uninstall_CallBackFunc + !insertmacro UNINSTALL.LOG_UNINSTALL_UNATTENDED + !define UnLog_Uninstall_CallBackFunc "un._LocateCallBack_Function_Unattended" + !endif + + !verbose pop +!macroend + + +!macro UNINSTALL.LOG_UNINSTALL_UNATTENDED + + Function un._LocateCallBack_Function_Unattended + start: + FileRead $unlog_tmp_2 "$unlog_tmp_3" ${NSIS_MAX_STRLEN} + ${un.TrimNewLines} "$unlog_tmp_3" "$unlog_tmp_3" + StrCmp "$unlog_tmp_3" "$R9" islog + IfErrors nolog + goto start + + islog: + IfFileExists "$R9\*.*" isdir + + isfile: + Delete "$R9" + goto end + + isdir: + RmDir "$R9" + IntOp $unlog_tmp_1 $unlog_tmp_1 + 1 + goto end + + nolog: + ClearErrors + StrCmp "$R9" "${UNINST_EXE}" isfile + StrCmp "$R9" "${UNINST_DAT}" isfile + + end: + FileSeek $unlog_tmp_2 0 SET + Push $unlog_tmp_0 + FunctionEnd + +!macroend + + +!macro UNINSTALL.LOG_UNINSTALL_INTERACTIVE + + Function un._LocateCallBack_Function_Interactive + start: + FileRead $unlog_tmp_2 "$unlog_tmp_3" ${NSIS_MAX_STRLEN} + ${un.TrimNewLines} "$unlog_tmp_3" "$unlog_tmp_3" + StrCmp "$unlog_tmp_3" "$R9" islog + IfErrors nolog + goto start + + islog: + IfFileExists "$R9\*.*" isdir + + isfile: + Delete "$R9" + goto end + + isdir: + RmDir "$R9" + IntOp $unlog_tmp_1 $unlog_tmp_1 + 1 + goto end + + nolog: + ClearErrors + FileSeek $unlog_tmp_4 0 SET + read: + FileRead $unlog_tmp_4 "$unlog_tmp_3" + ${un.TrimNewLines} "$unlog_tmp_3" "$unlog_tmp_3" + StrCmp "$unlog_tmp_3" "$R9" end + IfErrors +2 + goto read + ClearErrors + StrCmp "$R9" "${UNINST_EXE}" isfile + StrCmp "$R9" "${UNINST_DAT}" isfile + IfFileExists "$R9\*.*" msgdir + + MessageBox MB_ICONQUESTION|MB_YESNO \ + 'Delete File "$R9"?' /SD IDNO IDYES isfile IDNO nodel + + msgdir: + MessageBox MB_ICONQUESTION|MB_YESNO \ + 'Delete Directory "$R9"?' /SD IDNO IDYES isdir IDNO nodel + + nodel: + FileSeek $unlog_tmp_4 0 END + FileWrite $unlog_tmp_4 "$R9$\r$\n" + + end: + FileSeek $unlog_tmp_2 0 SET + Push $unlog_tmp_0 + FunctionEnd + +!macroend + +;................................. Installer Macros ................................. + +!macro UNINSTALL.LOG_INSTALL_UNATTENDED + + Function _LocateCallBack_Function_Install + loop: + FileRead $unlog_tmp_2 "$unlog_tmp_3" ${NSIS_MAX_STRLEN} + ${TrimNewLines} "$unlog_tmp_3" "$unlog_tmp_3" + IfErrors 0 +4 + ClearErrors + FileSeek $unlog_tmp_2 0 SET + goto next + StrCmp "$R9" "$unlog_tmp_3" end + goto loop + next: + FileWrite $unlog_tmp_1 "$R9$\r$\n" + end: + Push $unlog_tmp_0 + FunctionEnd + +!macroend + + +!ifdef UnLog_Install_Func_CallBack + !undef UnLog_Install_Func_CallBack +!endif + +!ifndef UnLog_Install_Func_CallBack + !insertmacro UNINSTALL.LOG_INSTALL_UNATTENDED + !define UnLog_Install_Func_CallBack "_LocateCallBack_Function_Install" +!endif + + +!macro UNINSTALL.LOG_PREPARE_INSTALL + !verbose push + !verbose ${UNINST_LOG_VERBOSE} + + Push $0 + Push $1 + ClearErrors + ReadRegStr "$0" ${INSTDIR_REG_ROOT} "${INSTDIR_REG_KEY}" "${UNINSTALL_LOG}Directory" + IfErrors next + ${DirState} "$0" $1 + StrCmp "$1" "-1" next + StrCmp "$1" "0" next + IfFileExists "$0\${UNINSTALL_LOG}.dat" next + MessageBox MB_ICONEXCLAMATION|MB_OK \ + "Previous installation detected at $0.$\n\ + Required file ${UNINSTALL_LOG}.dat is missing.$\n$\nIt is highly recommended \ + to select an empty directory and perform a fresh installation." /SD IDOK + StrCpy $unlog_error "error" + + next: + ClearErrors + StrCmp "$PLUGINSDIR" "" 0 +2 + InitPluginsDir + + GetTempFileName "$1" + FileOpen $0 "$1" w + FileWrite $0 "${UNLOG_HEAD}$\r$\n" + FileClose $0 + Rename "$1" "${UNLOG_TEMP}" + Pop $1 + Pop $0 + + !verbose pop +!macroend + + +!macro UNINSTALL.LOG_UPDATE_INSTALL + !verbose push + !verbose ${UNINST_LOG_VERBOSE} + + Delete "${UNINST_DAT}" + Rename "${UNLOG_TEMP}" "${UNINST_DAT}" + WriteUninstaller "${UNINST_EXE}" + WriteRegStr ${INSTDIR_REG_ROOT} "${INSTDIR_REG_KEY}" "${UNINSTALL_LOG}.dat" "${UNINST_DAT}" + WriteRegStr ${INSTDIR_REG_ROOT} "${INSTDIR_REG_KEY}" "${UNINSTALL_LOG}Directory" "$INSTDIR" + + !verbose pop +!macroend + + +!define uninstall.log_install "!insertmacro UNINSTALL.LOG_INSTALL" + +!macro UNINSTALL.LOG_INSTALL FileOpenWrite FileOpenRead TargetDir + !verbose push + !verbose ${UNINST_LOG_VERBOSE} + + FileOpen $unlog_tmp_1 "${FileOpenWrite}" w + FileOpen $unlog_tmp_2 "${FileOpenRead}" r + + ${Locate} "${TargetDir}" "/L=FD" "${UnLog_Install_Func_CallBack}" + + StrCmp $unlog_error "error" 0 +2 + ClearErrors + + IfErrors 0 +2 + MessageBox MB_ICONEXCLAMATION|MB_OK "Error creating ${UNINSTALL_LOG} Log." /SD IDOK + + FileClose $unlog_tmp_1 + FileClose $unlog_tmp_2 + + !verbose pop +!macroend + + +!define uninstall.log_mergeID "!insertmacro UNINSTALL.LOG_MERGE" + +!macro UNINSTALL.LOG_MERGE UnlogPart + !verbose push + !verbose ${UNINST_LOG_VERBOSE} + + ${FileJoin} "${UNLOG_TEMP}" "${UnlogPart}" "${UNLOG_TEMP}" + + !verbose pop +!macroend + + +!macro UNINSTALL.LOG_OPEN_INSTALL + !verbose push + !verbose ${UNINST_LOG_VERBOSE} + + StrCmp $unlog_error "error" +2 + ${uninstall.log_install} "${EXCLU_LIST}" "${UNINST_DAT}" "$OUTDIR" + + !verbose pop +!macroend + + +!macro UNINSTALL.LOG_CLOSE_INSTALL + !verbose push + !verbose ${UNINST_LOG_VERBOSE} + + !define ID ${__LINE__} + + ${uninstall.log_install} "${UNLOG_PART}${ID}" "${EXCLU_LIST}" "$OUTDIR" + ${uninstall.log_mergeID} "${UNLOG_PART}${ID}" + + !undef ID ${__LINE__} + + !verbose pop +!macroend + +!endif + +!verbose pop + ;_____________________________ HEADER FILE END ____________________________ + diff --git a/packaging/win32/AdvUninstLog.txt b/packaging/win32/AdvUninstLog.txt new file mode 100644 index 000000000..b92c5cec7 --- /dev/null +++ b/packaging/win32/AdvUninstLog.txt @@ -0,0 +1,121 @@ +Overview + +Advanced Uninstall Log for NSIS was born in the need to cover a specific gap. +It's been discussed fairly enough that the File /r command is very useful +in cases when developers want to add a huge amount of sub directories and +files, nevertheless it has the disadvantage that such an installation should +be uninstalled with RmDir /r which is risky and removes also data that has +been added/created later within the installation folder. + + + + +About Advanced Uninstall Log. + +Advanced Uninstall Log is a macro system provided in a NSIS header that +is able to monitor an installation and build an uninstall log file which +is used by the uninstaller to uninstall files/directories that have been +added within specific installation blocks. + +This means that files which have been installed outside these blocks, +or added later either by the user or application's activities, ignored +by the uninstaller. + +Moreover files that might exist into the target directory prior the current +installation, ignored as well. + +Advanced Uninstall Log creates an uninstall log that removes only files that +have been installed and optionally interacts with users for every other file +and/or directory has found in installation folder and requires permission to +remove these files/directories. + +It is enhanced as well to support updates, e.g. if the installer later would +update the installation by adding new data, the uninstaller would remove the +new data that has been added by the installer, without bothering users about. + + + + +Features + +If target installation folder exists and contains files and/or directories +they all preserved from being uninstalled. + +Uninstaller removes data that has been added within specific installation +blocks, preserving all other data that has been created/added outside of +these installation blocks. See included examples for details. + +Supports unlimited updates/reinstallations. + +Supports two uninstaller modes. Interactive mode requires confirmation +to remove every other file exept those files that have been installed. +Unattended mode leaves intact every other file without bothering users. + +In case when uninstall log (uninstall.dat) has been removed manually instead +of execute uninstaller, if users attempt to run the installer later, a warning +issued that they should select a new output folder. + +Implements only the included with NSIS release headers FileFunc and TextFunc. +There is no need for external plugins and headers, adds a very small overhead. + + + + +Restrictions + +If uninstall log (uninstall.dat) is missing uninstaller won't execute at all. + +Due to file create - write procedure that is required in order to add/update +the uninstall log (uninstall.dat), restricted users on NT based systems won't +be able to execute the installer. + + + + +Disadvantage + +Since the header does not implement anything else than the common NSIS release, +a delay occurs while builds and reads the uninstall log because it needs to +throw the list several times. Talking for common cases, most likely the delay +won't be noticeable, however, in cases where the target directory isn't empty +and contains a large amount of data which will be excluded from uninstall log, +or added large amount of data after the installation which will be excluded also, +the delay should be noticeable. + + + + +Credits + +A very big thanks goes to kichik. +When my idea of the Advanced Uninstall Log became an NSIS header, it was +indeed an amateur's attempt to write a flexible and errors free NSIS header. +Kichik dropped me a dozen of suggestions helping me to achieve my plan. +However, his main suggestion to eliminate the mentioned above disadvantage, +still remains untouched by me. + + + + +License + +This header file is provided 'as-is', without any express or implied warranty. +In no event will the author be held liable for any damages arising from the use +of this header file. + +Permission is granted to anyone to use this header file for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + + 1. The origin of this header file must not be misrepresented; + you must not claim that you wrote the original header file. + If you use this header file in a product, an acknowledgment in + the product documentation would be appreciated but is not required. + + 2. Altered versions must be plainly marked as such, and must not be + misrepresented as being the original header file. + + 3. This notice may not be removed or altered from any distribution. + + +eof \ No newline at end of file diff --git a/packaging/win32/inkscape.nsi b/packaging/win32/inkscape.nsi index 514ed6449..3a9561a7e 100644 --- a/packaging/win32/inkscape.nsi +++ b/packaging/win32/inkscape.nsi @@ -29,6 +29,25 @@ SetCompressor /SOLID lzma !define MUI_HEADERIMAGE_BITMAP "header.bmp" !define MUI_COMPONENTSPAGE_SMALLDESC +;.................................................................................................. +;Following two definitions required. Uninstall log will use these definitions. +;You may use these definitions also, when you want to set up the InstallDirRagKey, +;store the language selection, store Start Menu folder etc. +;Enter the windows uninstall reg sub key to add uninstall information to Add/Remove Programs also. + +!define INSTDIR_REG_ROOT "HKLM" +!define INSTDIR_REG_KEY PRODUCT_UNINST_KEY + +;include the Uninstall log header +!include AdvUninstLog.nsh + +;Specify the preferred uninstaller operation mode, either unattended or interactive. +;You have to type either !insertmacro UNATTENDED_UNINSTALL, or !insertmacro INTERACTIVE_UNINSTALL. +;Be aware only one of the following two macros has to be inserted, neither both, neither none. + +;!insertmacro UNATTENDED_UNINSTALL +!insertmacro INTERACTIVE_UNINSTALL + ; Welcome page !insertmacro MUI_PAGE_WELCOME @@ -401,26 +420,42 @@ FunctionEnd !macro Language polng lng SectionIn 1 2 3 SetOutPath $INSTDIR + !insertmacro UNINSTALL.LOG_OPEN_INSTALL File /nonfatal /a "..\..\inkscape\*.${lng}.txt" + !insertmacro UNINSTALL.LOG_CLOSE_INSTALL SetOutPath $INSTDIR\locale + !insertmacro UNINSTALL.LOG_OPEN_INSTALL File /nonfatal /a /r "..\..\inkscape\locale\${polng}" + !insertmacro UNINSTALL.LOG_CLOSE_INSTALL SetOutPath $INSTDIR\lib\locale + !insertmacro UNINSTALL.LOG_OPEN_INSTALL File /nonfatal /a /r "..\..\inkscape\lib\locale\${polng}" + !insertmacro UNINSTALL.LOG_CLOSE_INSTALL SetOutPath $INSTDIR\share\clipart + !insertmacro UNINSTALL.LOG_OPEN_INSTALL File /nonfatal /a /r "..\..\inkscape\share\clipart\*.${polng}.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\*.${polng}.svg" + !insertmacro UNINSTALL.LOG_CLOSE_INSTALL SetOutPath $INSTDIR\share\templates + !insertmacro UNINSTALL.LOG_OPEN_INSTALL File /nonfatal /a /r "..\..\inkscape\share\templates\*.${polng}.svg" + !insertmacro UNINSTALL.LOG_CLOSE_INSTALL SetOutPath $INSTDIR\doc + !insertmacro UNINSTALL.LOG_OPEN_INSTALL File /nonfatal /a /r "..\..\inkscape\doc\keys.${polng}.xml" File /nonfatal /a /r "..\..\inkscape\doc\keys.${polng}.html" + !insertmacro UNINSTALL.LOG_CLOSE_INSTALL SectionGetFlags ${SecTutorials} $R1 IntOp $R1 $R1 & ${SF_SELECTED} IntCmp $R1 ${SF_SELECTED} 0 skip_tutorials SetOutPath $INSTDIR\share\tutorials + !insertmacro UNINSTALL.LOG_OPEN_INSTALL File /nonfatal /a "..\..\inkscape\share\tutorials\*.${polng}.*" + !insertmacro UNINSTALL.LOG_CLOSE_INSTALL skip_tutorials: !macroend @@ -521,6 +556,7 @@ Section $(lng_Core) SecCore SectionIn 1 2 3 RO SetOutPath $INSTDIR + !insertmacro UNINSTALL.LOG_OPEN_INSTALL SetOverwrite on SetAutoClose false @@ -537,22 +573,31 @@ Section $(lng_Core) SecCore 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 + !insertmacro UNINSTALL.LOG_OPEN_INSTALL File /a "..\..\inkscape\share\clipart\inkscape.logo.svg" ;File /a "..\..\inkscape\share\clipart\inkscape.logo.classic.svg" + !insertmacro UNINSTALL.LOG_CLOSE_INSTALL SetOutPath $INSTDIR\share\extensions + !insertmacro UNINSTALL.LOG_OPEN_INSTALL 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_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 + !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 SectionEnd Section $(lng_GTKFiles) SecGTK @@ -561,10 +606,12 @@ Section $(lng_GTKFiles) SecGTK SectionIn 1 2 3 RO 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" + !insertmacro UNINSTALL.LOG_CLOSE_INSTALL SectionEnd Section $(lng_Alluser) SecAlluser @@ -662,13 +709,17 @@ SectionGroup $(lng_Addfiles) SecAddfiles Section $(lng_Examples) SecExamples SectionIn 1 2 SetOutPath $INSTDIR\share + !insertmacro UNINSTALL.LOG_OPEN_INSTALL File /nonfatal /a /r /x "*.??*.???*" "..\..\inkscape\share\examples" + !insertmacro UNINSTALL.LOG_CLOSE_INSTALL SectionEnd Section $(lng_Tutorials) SecTutorials SectionIn 1 2 SetOutPath $INSTDIR\share + !insertmacro UNINSTALL.LOG_OPEN_INSTALL File /nonfatal /a /r /x "*.??*.???*" "..\..\inkscape\share\tutorials" + !insertmacro UNINSTALL.LOG_CLOSE_INSTALL SectionEnd SectionGroupEnd @@ -997,6 +1048,9 @@ SectionEnd !macroend Function .onInit + ;prepare log always within .onInit function + !insertmacro UNINSTALL.LOG_PREPARE_INSTALL + ;Extract InstallOptions INI files StrCpy $AskMultiUser "1" StrCpy $MultiUser "0" @@ -1164,6 +1218,12 @@ FunctionEnd Function .onSelChange FunctionEnd + +Function .onInstSuccess + ;create/update log always within .onInstSuccess function + !insertmacro UNINSTALL.LOG_UPDATE_INSTALL +FunctionEnd + ; -------------------------------------------------- Function un.CustomPageUninstall @@ -1180,6 +1240,9 @@ FunctionEnd Function un.onInit + ;begin uninstall, could be added on top of uninstall section instead + !insertmacro UNINSTALL.LOG_BEGIN_UNINSTALL + ClearErrors StrCpy $User "" UserInfo::GetName @@ -1351,7 +1414,26 @@ Section Uninstall RMDir "$SMPROGRAMS\Inkscape" DetailPrint "removing uninstall info" - RMDir /r "$INSTDIR" + + ;uninstall from path, must be repeated for every install logged path individual + !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\lib\locale" + !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\locale" + !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\doc" + !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\share\tutorials" + !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\share\templates" + !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\share\screens" + !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\share\clipart" + !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\share\extensions" + !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\share\icons" + !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\share" + !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\modules" + !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\python" + !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR" + + ;end uninstall, after uninstall from all logged paths has been performed + !insertmacro UNINSTALL.LOG_END_UNINSTALL + + ;RMDir /r "$INSTDIR" SetAutoClose false -- 2.30.2