Skip to content
⌘ NSIS Forum Archive

Postgresql installation

3 posts

Mich'#

Postgresql installation

Hi everybody.

I begin with the NSIS installer and I've a problem with him.

I would like install Postgresql with NSIS but I can not do it.

I try this :


outfile "C:\project-open\installer\install_postgres.exe"
Name "Install PostgreSQL"

!include Registry.nsh
!include LogicLib.nsh
!include MultiUser.nsh
!include Sections.nsh
!include MUI2.nsh

!define TARGET c:\project-open

Function .onInit
StrCpy $INSTDIR "c:\project-open"
FunctionEnd

section
UserMgr::CreateAccountEx "postgres" "tarzan57" "PostgreSQL" "PostgreSQL Database User" "Database user created by ]po[ installer" "UF_PASSWD_NOTREQD|UF_DONT_EXPIRE_PASSWD"
pop $R0
DetailPrint "After creating account: result=$R0"

UserMgr::AddPrivilege "postgres" "SeBatchLogonRight"
pop $R0
DetailPrint "SeBatchLogonRight: result=$R0"

UserMgr::AddPrivilege "postgres" "SeServiceLogonRight"
pop $R0
DetailPrint "SeServiceLogonRight: result=$R0"

nsExec::ExecToLog '"$INSTDIR\pgsql\bin\initdb.exe" --username=postgres --locale=C --encoding=UTF8 -D "$INSTDIR\pgsql\data"'
pop $R0
DetailPrint "After initializing database: result=$R0"

nsExec::ExecToLog 'sc create postgresql-9.2 binpath= "c:\project-open\pgsql\bin\pg_ctl.exe runservice -N postgresql-9.2 -D c:/project-open/pgsql/data -w" DisplayName= "PostgreSQL 9.2" start= "demand" type= own obj= ".\postgres" password= "tarzan57" '
pop $R0
DetailPrint "After registering the service: result=$R0"
sectionEnd
but there are any problems with the UserMgr methods and I don't know for what.

Can you help me please ?

Thanks you
jpderuiter#
If you don't tell us what the 'problems' are, how are we supposed to help you?
Do you have admin rights?
shadowpoa#
Just try this...

Do not create the user account, the postgre installer creates the account for itself.
You should remove the account if already exists.

To do some testing, try to manually install postgres if this 'postgres' account already exists.
It will fail. (older versions do)