SuperPat45/UltraModernUI

[RFE] Option to use own code for the repair feature

Tobias-B-Besemer opened this issue · 3 comments

I will request an option to use own code for the repair feature.

Or: Improve the existing repair feature.

I wrote two versions of an installer for BleachBit.
One with MUI2, the other with UMUI.
I would like use the UMUI version, but my code for the repair feature in the MUI2 version seems to be better then what UMUI brings with it.
Great would be, if I can have the best from both versions... This is the reason for my request.

You can find the MUI2 version to have a look at my repair feature code here:
https://github.com/bleachbit/bleachbit/blob/5707557f4ae0072f0fb267f6db7f0cdf6c95834e/windows/bleachbit.nsi

"seems to be better"

In what way is it better?

It doesn't uninstall all and reinstall it.

Uninstall and reinstall is not mandatory. You can define the preuninstall_function to use your repair code and use the Abort instruction to skip all the next sections:

!define UMUI_PREUNINSTALL_FUNCTION preuninstall_function

  !define UMUI_MAINTENANCEPAGE_MODIFY
  !define UMUI_MAINTENANCEPAGE_REPAIR
  !define UMUI_MAINTENANCEPAGE_REMOVE
!insertmacro UMUI_PAGE_MAINTENANCE

Function preuninstall_function
  ; execute this function only in Modify, repair and update function
  !insertmacro ${UMUI_REPAIR}
     ; repair instructions
    Abort  ; Does not execute sections
  !insertmacro UMUI_ENDIF_INSTALLFLAG
  !insertmacro ${UMUI_MODIFY}
     ; remove files from unchecked sections
     ; Lest sections create files for new checked sections
  !insertmacro UMUI_ENDIF_INSTALLFLAG
  !insertmacro ${UMUI_UPDATE}
     ; remove files that does not exist anymore
     ; Lest sections create new files and replace older one
  !insertmacro UMUI_ENDIF_INSTALLFLAG
FunctionEnd