Archive: What is the best way to handle upgrades?


Hi there,

I want to be able to do upgrades gracefully. During the first installation, there are third party drivers I install that I do not want to install on upgrades. Also, files may have been added or removed from the original installation which I would want to synchronize with every upgrade. I have tried to use the existance if the registry key to trigger an uninstall, but for some reason it doesn't execute. I can't think of any other way.

Any suggestion or sample code would be greatly appreciated.

Aarif


hi,

well, i would do it like you described it.

1. you could write something to the registry (WriteRegStr) during the first install, so you can check for existance (ReadRegStr) and don't have to install the drivers again.

2. to check for files you could use the 'IfFileExists'
command.

i don't know why your registry routine didn't work, so maybe you should post some parts of your script.

cu yzo


This is the code I place at the top of the section, before te "File" commands.

ClearErrors
ReadRegStr $1 HKLM "SOFTWARE\Cavio Corporation\Cavio" ""
IfErrors lbl_nouninstall

ReadRegStr $1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cavio" "UninstallString"

ExecWait "$1"

lbl_nouninstall:

I see the log file showing the execution of the uninstall, but it never actually executes.

Aarif


hi,

that looks like it should work, but you could debug it a lil' more, so you have more chances to find the failure.

try it like that:

ClearErrors
ReadRegStr $1 HKLM "SOFTWARE\Cavio Corporation\Cavio" ""
IfErrors lbl_nouninstall

ReadRegStr $1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cavio" "UninstallString"
IfErrors lbl_nouninstall

ExecWait "$1" ; <-- maybe you should replace "" with ''
; i don't know what happens
; when $1 returns this: ""longpathname/filename.exe" /param"
; so maybe: '"longpathname/filename.exe" /param' would work
; better
IfErrors lbl_error lbl_nouninstall

lbl_error:
MessageBox MB_OK 'Error: $1' ; only for debuging

lbl_nouninstall:

cu yzo


Thanks yazno, your assistance helped.

For some reason, I had to issue a "SetOutPath "$INSTDIR"" before the "ExecWait...". Now, the problem I am having is that it is not waiting for the uninstall to complete. As if I were using just "Exec" instead of "ExecWait".

Any suggestions? Is anyone trying to do the same thing?

Aarif