Archive: Reinstall feature


Reinstall feature
Hi all,

I need to extend my installer, so that if the product is already installed and the setup is run, to first (if the user choses) uninstall the existent version or to (if the user choses) just install all the files without running the uninstaller first. For this task I have a few questions:

1) In the NSIS\Examples\makensis.nsi is done


ReadRegStr $R1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\NSIS" "UninstallString"
ExecWait '$R1 _?=$INSTDIR'


What does the _?= mean?

2) When uninstalling I know for sure that one of my dlls is in use and can't be released. So it can't be deleted, so normally at the end it asks for a reboot. I also specifically ask for a reboot after a normal installation b/c all applications need the new dll. But in the reinstall scenario I would like to not have 2 reboots, one after running the uninstaller and one after installing, but only one reboot after both steps. So I need to run (from my installer) the uninstaller somehow, with a parameter that says that the reboot shouldn't be asked, and then somehow in my uninstaller code to repress the reboot if that param is specified. Can I do that? If yes, how can I check in the uninstaller the parameters?

Thx,
Viv

1.
_?=$INSTDIR prevents the uninstaller copying itself to $TEMP and executing from there. Instead the uninstaller will execute from $INSTDIR.

More info:
http://nsis.sourceforge.net/When_I_u...5f96c1f84fdfd8

2.
http://nsis.sourceforge.net/Category...Line_Functions

-Stu


Thx Stu for your answer.

1) Why would makensis.nsi use the:


ExecWait '$R1 _?=$INSTDIR'

?
Is b/c it doesn't want the uninstaller.exe to be deleted in case smth bad happens during uninstalling?

2) I need from my installer to run my uninstaller. I know for sure that my uninstaller will ask for a reboot at the end, but I want when it is run from my installer, not to ask for reboot. One way to do this would be:
- call from my installer the uninstaller with a parameter, eg -noreboot
- in my uninstaller, at the end check if that param is specified and if yes supress the reboot by doing:

SetRebootFlag false

Is this a correct way of doing what I need?

Thx,
Viv