Old 8th July 2014, 11:30   #1
Junior Member
Join Date: Jul 2014
Posts: 1
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"

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"

but there are any problems with the UserMgr methods and I don't know for what.

Can you help me please ?

Thanks you
Mich' is offline   Reply With Quote
Old 10th July 2014, 07:01   #2
Major Dude
Join Date: Feb 2007
Posts: 672
If you don't tell us what the 'problems' are, how are we supposed to help you?
Do you have admin rights?
jpderuiter is offline   Reply With Quote
Old 10th July 2014, 21:05   #3
Join Date: Jun 2011
Posts: 52
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)
shadowpoa is offline   Reply With Quote
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

nsis, postgresql

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump