postgresql nsis

Instalación de postgresql con NSIS



(1)

Todo lo que necesita hacer es crear un directorio de datos:

initdb -D %PROGRAMDATA%/MyApp/data

luego instale su archivo de configuración de PostgreSQL y pg_hba.conf o realice las ediciones necesarias en los archivos generados automáticamente por initdb en %PROGRAMDATA%/MyApp/data/postgresql.conf y %PROGRAMDATA%/MyApp/data/pg_hba.conf .

Entonces:

pg_ctl register -D %PROGRAMDATA%/MyApp/data -S auto -N postgres-MyApp -U NETWORKSERVICE net start postgres-MyApp

No utilice el puerto predeterminado 5432. Ejecute en un puerto no predeterminado que no entre en conflicto con ninguna instalación existente o futura de PostgreSQL. Además, no use los nombres de servicio "estándar" como postgresql-9.2 .

(NSIS puede ofrecer un comando para iniciar un servicio, en lugar de utilizar net start . Si lo hace, use el comando NSIS apropiado).

Tenga en cuenta que %PROGRAMDATA% solo se define para Windows Vista y versiones posteriores (donde apunta a %SYSTEMDRIVE%/ProgramData de forma predeterminada). Puede usar %ALLUSERSPROFILE% en Windows XP, pero realmente, ¿a quién le importa XP ahora?

Personalmente, sugiero usar instaladores de MSI con WiX.

Instalaría postgresql con el instalador de NSIS, pero no sé cómo.

Puedes ayudarme por favor ?

Encontré este código

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" "*******" "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= "******" '' pop $R0 DetailPrint "After registering the service: result=$R0"sectionEnd`

pero tengo un problema con UserMgr::CreateAccountEx pero he importado todos los archivos necesarios.