We have a C# program which uses postgres as its database, so we want to bundle the postgres in the installer as a semi-silent install, i.e. the user will be notified about the mandatory installation, but the installation itself will be automatically performed without the need for user input.
After researching opinions on WiX, Inno Setup and NSIS we decided to use NSIS. As I see it the easiest way will be to include the binary .zip distibution of postgres and perform the following in the script:
- Copy the pgsql folder to the installation dir
- Run initdb.exe with the appropriate arguments to create the database itself in InstallDir/pgsql/data
- Run pg_ctl.exe to register as a service with application specific name
- Use the NSIS Simple Service Plugin to start the service
- Install our program
I have several questions about this scenario:
Q1: Am I on the right track at all?
Q2: Can I pass the superuser password somehow to initdb.exe, so it doesn't ask the user to enter it trough the console?
Q3: Where and how do I change the port on which postgres will listen, so that I don't conflict with other installed instances?
Q4: When uninstalling is it enough to just unregister the service with pg_ctl.exe and delete all folders?
PS: I feel the questions are connected to each other so I've put them all together here. But if needed I can separate them in different questions.