drjasonharrison
21st April 2010 22:26 UTC
Silent install but non-silent uninstall?
It appears that when we run our NSIS installer using the /S (silent) command line flag that it creates a silent uninstaller.
Is there a way to make the uninstaller non-silent when run from the start menu entry?
That is, after running
% installer.exe /S
We could select Start>Programs>abc>uninstall, and it should pop up the typical "do you want to uninstall" message boxes
but running C:\Program Files\abc\uninst.exe would be silent. We need this second behaviour for installing updates.
-Jason
Anders
21st April 2010 23:05 UTC
Let me first say that passing /S when doing the update is a much better idea.
But if you want to do it your way: The shortcut needs to pass some kind of parameter, then in .onInit, check for this parameter and toggle the silent mode (Silent mode can be changed at runtime in .onInit)
Wizou
22nd April 2010 01:19 UTC
Anders is right, your update process should call the uninstaller passing /S as argument
Or maybe you always want your uninstall to be silent (bad idea), then use SilentUnInstall
drjasonharrison
22nd April 2010 19:28 UTC
I don't think I made myself clear.
We have a "master application" that as part of its NSIS installer, installs a "helper application". The "helper application" is installed using a NSIS installer, which is not-silent when run separately, and passed the /S flag when we call it from the "master application" installer.
But, then the uninstaller for the "helper application" is marked as "run silently" so when the customer selects the uninstaller in the program files menu, the uninstaller goes ahead and runs without any confirmation or message boxes. Thus twitchy clicks on the wrong menu item uninstall the helper application.
We can remove the shortcut from the program files menu, but are looking for a better solution.
Wizou
22nd April 2010 22:59 UTC
I just tested.
There is no such thing in NSIS like "when the installer is run silently, it marks the uninstaller to run silently also".
Unless *you* programmed it like that, using SilentUninstall, or SetSilent in un.onInit, or by calling the uninstaller with /S argument.
Are you sure your Start menu shortcut doesn't have a /S argument ?
my test code:
outfile "test.exe"
section main
writeuninstaller "$EXEDIR\testu.exe"
sectionend
section un.main
delete "$INSTDIR\testu.exe"
sectionend
>
drjasonharrison
23rd April 2010 18:09 UTC
Ah, you are correct. Here is my incorrect code which was producing the behaviour that I confused with "silent install" == "silent uninstall"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Functionun.onInit
IfSilent 0+3
MessageBox MB_ICONQUESTION
|MB_YESNO|MB_TOPMOST "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
Abort
HideWindow
FunctionEnd
>
The IfSilent was incorrect, should have been "IfSilent +3"
Thank you for clarifying this,
-Jason
Anders
23rd April 2010 18:58 UTC
You should use the LogicLib, then you will not have jump errors like that