Hi everybody,
This is the first time I post in NSIS forum so please forgive my ignorance 😉
I have to detect if postgreSQL is already installed on a computer. I searched on the web and read many things doing this, but they did not help me.
Do I have to check in the registry if there is a SOFTWARE\PostgreSQL\... key in the registry or if a service is present ? What is the best solution ?
The solution I choose is the 2nd one (it may not be the right one...). I use 'Services' plugin for NSIS. But problem is that there are several versions of postgreSQL, so do I have to try every version of them with :
services::IsServiceInstalled 'postgresql-8.3'
services::IsServiceInstalled 'postgresql-8.2'
services::IsServiceInstalled 'postgresql-8.1'...
?
Thank you in advance for help/advices.
Detecting all previous postgres install
3 posts
Yes, you have to try all of them, so I think that is not the best approach.
I think the best would be to get it from the registry.
Have a look here for an idea:
I think the best would be to get it from the registry.
Have a look here for an idea:
Hi jpderuiter !
Thank you so much, thanks to you I found how to do that. For people who still search, I proceed like that :
Thank you so much, thanks to you I found how to do that. For people who still search, I proceed like that :
Thank you again for your help.
services::GetServiceNameFromDisplayName 'postgre'
Pop $0 IntCmp $0 0 NotInstalledYet ; if research returned "0" No previous install has been found
IntOp $0 $0 - 1 Pop $1 ; If already installed, we collect the install location in the registry
ReadRegStr $R0 HKLM "SOFTWARE\\PostgreSQL\\Installations\\$1" "Base Directory"
NotInstalledYet :
; install postgres...