- NSIS Discussion
- Uninstaller by section
Archive: Uninstaller by section
cosmos38240
5th October 2009 12:37 UTC
Uninstaller by section
Hello,
I would like to have a uninstaller on each section.
Example :
Section 1 "Section1"
...
Software1
...
WriteUninstaller "$Variable\Uninst1.exe"
End Section
Section 2 "Section2"
...
Software2
...
WriteUninstaller "$Variable\Uninst2.exe"
End Section
When I want to launch the Uninst1.exe then un.Section1 is executed but also the un.Section2.
And I don't want that how is it possible to change that please ?
Thank you,
Michaël
cosmos38240
6th October 2009 09:45 UTC
Nobody has got an idea or a workaround ?
I'm just starting to discover NSIS so i am perhaps on a wrong way :)
Thx
Michaël
MSG
6th October 2009 10:03 UTC
There is no simple way to do this. The most straight-forward method I can think of is writing somewhere (registry, ini file) which sections were installed, and then reading that info in your uninstaller.
TrifonovS
6th October 2009 10:03 UTC
Hi,
I made an installer that installs a package, containing 3 different applications. It is clear that it must be possible to uninstall only one of them. My idea is the following. I create only one uninstaller, but it accepts a parameter from the command line. The parameter is the name of the application that must be uninstalled (or several names). When I write the uninstall information to the registry, I put also the corresponding parameter that must be passed to the uninstaller. In function un.onInit you have to check and get the parameters on from the command line. You can do this with the macro un.GetParameters from FileFunc.nsh. Everything works without any problems.
MSG
6th October 2009 10:21 UTC
There is one problem with this approach: The user might run uninstall.exe manually, in which case no parameters would be supplied.
Since you're already writing to the registry, you might as well create some regkeys of your own, to identify which applications have been installed and which haven't.
TrifonovS
6th October 2009 10:43 UTC
If the unuinstaller is started manually, it shows a component dialog (I forgot to tell that in another case it is started in silent mode). In this dialog you can see all supported applications and these once which are already uninstalled are inactive. So you can select manually what do you want to uninstall. After the last application is uninstalled, the uninstaller can delete itself too... It works so...
cosmos38240
6th October 2009 12:50 UTC
Hi Msg and TrifonovS,
Thank you very much for your advice, it is very helpfull for me.
I have now an idea of what to do :)
cosmos38240
6th October 2009 13:53 UTC
I didn't see that it was possible to have page for uninstall ...
So I have just put
!insertmacro MUI_UNPAGE_COMPONENTS
And the Section "un.Section1" is executed.
TrifonovS
6th October 2009 14:58 UTC
Yes, the most of the pages that can be used in the installer have uninstaller versions...