Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dd92347

Browse files
committed
nsis patch, add tabs
1 parent 3e3ab5b commit dd92347

File tree

1 file changed

+34
-38
lines changed

1 file changed

+34
-38
lines changed

nsis/postgresql.nsi

+34-38
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ Section $(PostgreSQLString) sec1
220220
File "License.txt"
221221
File "3rd_party_licenses.txt"
222222

223-
FileOpen $LogFile $INSTDIR\install.log w ;Opens a Empty File an fills it
223+
FileOpen $LogFile $INSTDIR\install.log w ;Opens a Empty File an fills it
224224

225225

226226
CreateDirectory "$INSTDIR\scripts"
@@ -231,12 +231,12 @@ FileOpen $LogFile $INSTDIR\install.log w ;Opens a Empty File an fills it
231231
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" $INSTDIR
232232

233233
;Create uninstaller
234-
FileWrite $LogFile "Create uninstaller$\r$\n"
234+
FileWrite $LogFile "Create uninstaller$\r$\n"
235235

236236
WriteUninstaller "$INSTDIR\Uninstall.exe"
237237

238238
; write uninstall strings
239-
FileWrite $LogFile "Write to register\r$\n"
239+
FileWrite $LogFile "Write to register\r$\n"
240240

241241
WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PG_DEF_BRANDING}" "InstallLocation" "$INSTDIR"
242242
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PG_DEF_BRANDING}" "DisplayName" "$StartMenuFolder"
@@ -251,7 +251,7 @@ FileWrite $LogFile "Write to register\r$\n"
251251
IntFmt $0 "0x%08X" $0
252252
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PG_DEF_BRANDING}" "EstimatedSize" "$0"
253253

254-
FileWrite $LogFile "Create BAT files$\r$\n"
254+
FileWrite $LogFile "Create BAT files$\r$\n"
255255
ClearErrors
256256
FileOpen $0 $INSTDIR\scripts\reload.bat w
257257
IfErrors creatBatErr
@@ -321,7 +321,7 @@ FileWrite $LogFile "Create BAT files$\r$\n"
321321
SetShellVarContext all
322322
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
323323

324-
FileWrite $LogFile "Create shortcuts$\r$\n"
324+
FileWrite $LogFile "Create shortcuts$\r$\n"
325325

326326
;Create shortcuts
327327
CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
@@ -334,7 +334,7 @@ FileWrite $LogFile "Create shortcuts$\r$\n"
334334
${endif}
335335

336336
; set font Lucida Console for shortcut psql
337-
FileWrite $LogFile "set font Lucida Console for shortcut psql$\r$\n"
337+
FileWrite $LogFile "set font Lucida Console for shortcut psql$\r$\n"
338338
ReadRegStr $0 HKCU "Console\SQL Shell (psql)" "FaceName"
339339
${if} $0 == ""
340340
WriteRegStr HKCU "Console\SQL Shell (psql)" "FaceName" "Consolas"
@@ -378,14 +378,14 @@ FileWrite $LogFile "set font Lucida Console for shortcut psql$\r$\n"
378378

379379
!insertmacro MUI_STARTMENU_WRITE_END
380380
; Create data dir begin
381-
FileWrite $LogFile "Create data dir begin$\r$\n"
381+
FileWrite $LogFile "Create data dir begin$\r$\n"
382382

383383
${if} $isDataDirExist == 0
384384
CreateDirectory "$DATA_DIR"
385385
;AccessControl::GrantOnFile "$DATA_DIR" "(BU)" "FullAccess" ;GenericWrite
386386
;Pop $0 ;"ok" or "error" + error details
387387

388-
FileWrite $LogFile "GRANT Access $\r$\n"
388+
FileWrite $LogFile "GRANT Access $\r$\n"
389389

390390
DetailPrint "GRANT FullAccess ON $DATA_DIR TO $loggedInUser"
391391
AccessControl::GrantOnFile "$DATA_DIR" "$loggedInUser" "FullAccess" ;GenericWrite
@@ -409,18 +409,19 @@ FileWrite $LogFile "GRANT Access $\r$\n"
409409
AccessControl::GrantOnFile "$DATA_DIR" "$0" "FullAccess" ;GenericWrite
410410
Pop $0 ;"ok" or "error" + error details
411411
System::Call 'Kernel32::SetEnvironmentVariable(t, t)i ("LC_MESSAGES", "C").r0'
412-
FileWrite $LogFile "Database initialization ...$\r$\n"
412+
413+
FileWrite $LogFile "Database initialization ...$\r$\n"
413414

414415
${if} "$Locale_text" == "$(DEF_LOCALE_NAME)"
415-
FileWrite $LogFile '"$INSTDIR\bin\initdb.exe" $tempVar \
416+
FileWrite $LogFile '"$INSTDIR\bin\initdb.exe" $tempVar \
416417
--encoding=$Coding_text -U "$UserName_text" \
417418
-D "$DATA_DIR" $\r$\n'
418419
; Initialise the database cluster, and set the appropriate permissions/ownership
419420
nsExec::ExecToLog /TIMEOUT=90000 '"$INSTDIR\bin\initdb.exe" $tempVar \
420421
--encoding=$Coding_text -U "$UserName_text" \
421422
-D "$DATA_DIR"'
422423
${else}
423-
FileWrite $LogFile '"$INSTDIR\bin\initdb.exe" $tempVar \
424+
FileWrite $LogFile '"$INSTDIR\bin\initdb.exe" $tempVar \
424425
--locale="$Locale_text" \
425426
--encoding=$Coding_text \
426427
-U "$UserName_text" \
@@ -437,16 +438,16 @@ FileWrite $LogFile '"$INSTDIR\bin\initdb.exe" $tempVar \
437438
${if} $0 != 0
438439
DetailPrint "initdb.exe return $0"
439440
DetailPrint "Output: $1"
440-
FileWrite $LogFile "initdb.exe return $0 $\r$\n"
441-
FileWrite $LogFile "Output: $1 $\r$\n"
442-
FileClose $LogFile ;Closes the filled file
441+
FileWrite $LogFile "initdb.exe return $0 $\r$\n"
442+
FileWrite $LogFile "Output: $1 $\r$\n"
443+
FileClose $LogFile ;Closes the filled file
443444

444445
MessageBox MB_OK|MB_ICONINFORMATION $(MESS_ERROR_INITDB)
445446

446447
Abort
447448
${else}
448449
DetailPrint "Database initialization OK"
449-
FileWrite $LogFile "Database initialization OK $\r$\n"
450+
FileWrite $LogFile "Database initialization OK $\r$\n"
450451
${endif}
451452
;Delete the password file
452453
${if} "$Pass1_text" != ""
@@ -456,7 +457,7 @@ FileWrite $LogFile "Database initialization OK $\r$\n"
456457
${EndIf}
457458
${endif}
458459
; Create data dir end
459-
FileWrite $LogFile "Create postgresql.conf $\r$\n"
460+
FileWrite $LogFile "Create postgresql.conf $\r$\n"
460461
${if} $isDataDirExist == 0
461462
${if} $checkNoLocal_state == ${BST_CHECKED}
462463
!insertmacro _ReplaceInFile "$DATA_DIR\postgresql.conf" "#listen_addresses = 'localhost'" "listen_addresses = '*'"
@@ -521,21 +522,16 @@ FileWrite $LogFile "Create postgresql.conf $\r$\n"
521522
FileClose $0
522523

523524
ErrFileCfg1:
524-
/* shared_preload_libraries = 'online_analyze, plantuner'
525-
online_analyze.table_type = 'temporary'
526-
online_analyze.verbose = 'off'
527-
online_analyze.local_tracking = 'on'
528-
plantuner.fix_empty_table = 'on'
529-
online_analyze.enable = off */
525+
530526
${endif}
531527
${EndIf}
532528
Delete "$DATA_DIR\postgresql.conf.old"
533529

534530
;# Add line to pg_hba.conf
535531
Call WriteInstallOptions
536532
DetailPrint "Service $ServiceID_text registration ..."
537-
FileWrite $LogFile "Service $ServiceID_text registration ... $\r$\n"
538-
FileWrite $LogFile '"$INSTDIR\bin\pg_ctl.exe" register -N "$ServiceID_text" -U "$ServiceAccount_text" -D "$DATA_DIR" -w $\r$\n'
533+
FileWrite $LogFile "Service $ServiceID_text registration ... $\r$\n"
534+
FileWrite $LogFile '"$INSTDIR\bin\pg_ctl.exe" register -N "$ServiceID_text" -U "$ServiceAccount_text" -D "$DATA_DIR" -w $\r$\n'
539535

540536
nsExec::ExecToStack /TIMEOUT=60000 '"$INSTDIR\bin\pg_ctl.exe" register -N "$ServiceID_text" -U "$ServiceAccount_text" -D "$DATA_DIR" -w'
541537
Pop $0 # return value/error/timeout
@@ -544,13 +540,13 @@ FileWrite $LogFile '"$INSTDIR\bin\pg_ctl.exe" register -N "$ServiceID_text" -U "
544540
${if} $0 != 0
545541
DetailPrint "pg_ctl.exe register return $0"
546542
DetailPrint "Output: $1"
547-
FileWrite $LogFile "pg_ctl.exe register return $0 $\r$\n"
548-
FileWrite $LogFile "Output: $1 $\r$\n"
543+
FileWrite $LogFile "pg_ctl.exe register return $0 $\r$\n"
544+
FileWrite $LogFile "Output: $1 $\r$\n"
549545

550546
Sleep 5000
551547
${else}
552548
DetailPrint "Service registration OK"
553-
FileWrite $LogFile "Service registration OK $\r$\n"
549+
FileWrite $LogFile "Service registration OK $\r$\n"
554550
${endif}
555551

556552
;Write the DisplayName manually
@@ -608,8 +604,8 @@ FileWrite $LogFile "Service registration OK $\r$\n"
608604
${endif}
609605

610606
DetailPrint "Start server service..."
611-
FileWrite $LogFile "Start server service... $\r$\n"
612-
FileWrite $LogFile 'sc start "$ServiceID_text" $\r$\n'
607+
FileWrite $LogFile "Start server service... $\r$\n"
608+
FileWrite $LogFile 'sc start "$ServiceID_text" $\r$\n'
613609

614610
Sleep 1000
615611

@@ -621,12 +617,12 @@ FileWrite $LogFile 'sc start "$ServiceID_text" $\r$\n'
621617
${if} $0 != 0
622618
DetailPrint "Start service return $0"
623619
DetailPrint "Output: $1"
624-
FileWrite $LogFile "Start service return $0 $\r$\n"
625-
FileWrite $LogFile "Output: $1 $\r$\n"
620+
FileWrite $LogFile "Start service return $0 $\r$\n"
621+
FileWrite $LogFile "Output: $1 $\r$\n"
626622
Sleep 5000
627623
${else}
628624
DetailPrint "Start service OK"
629-
FileWrite $LogFile "Start service OK $\r$\n"
625+
FileWrite $LogFile "Start service OK $\r$\n"
630626

631627
${endif}
632628

@@ -638,23 +634,23 @@ FileWrite $LogFile "Start service OK $\r$\n"
638634
${endif}
639635

640636
DetailPrint "Create adminpack ..."
641-
FileWrite $LogFile "Create adminpack ... $\r$\n"
642-
FileWrite $LogFile '"$INSTDIR\bin\psql.exe" -p $TextPort_text -U "$UserName_text" -c "CREATE EXTENSION adminpack;" postgres $\r$\n'
637+
FileWrite $LogFile "Create adminpack ... $\r$\n"
638+
FileWrite $LogFile '"$INSTDIR\bin\psql.exe" -p $TextPort_text -U "$UserName_text" -c "CREATE EXTENSION adminpack;" postgres $\r$\n'
643639
Sleep 5000
644640
nsExec::ExecToStack /TIMEOUT=60000 '"$INSTDIR\bin\psql.exe" -p $TextPort_text -U "$UserName_text" -c "CREATE EXTENSION adminpack;" postgres'
645641
pop $0
646642
Pop $1 # printed text, up to ${NSIS_MAX_STRLEN}
647643
${if} $0 != 0
648644
DetailPrint "Create adminpack return $0"
649645
DetailPrint "Output: $1"
650-
FileWrite $LogFile "Create adminpack return $0 $\r$\n"
651-
FileWrite $LogFile "Output: $1 $\r$\n"
646+
FileWrite $LogFile "Create adminpack return $0 $\r$\n"
647+
FileWrite $LogFile "Output: $1 $\r$\n"
652648

653649
;MessageBox MB_OK "Create adminpack error: $1"
654650
MessageBox MB_OK|MB_ICONSTOP "$(MESS_ERROR_SERVER)"
655651
${else}
656652
DetailPrint "Create adminpack OK"
657-
FileWrite $LogFile "Create adminpack OK $\r$\n"
653+
FileWrite $LogFile "Create adminpack OK $\r$\n"
658654
${endif}
659655
${if} "$Pass1_text" != ""
660656
StrCpy $R0 ""
@@ -669,7 +665,7 @@ FileWrite $LogFile "Create adminpack OK $\r$\n"
669665
WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PGLOCALEDIR" "$INSTDIR\share\locale\"
670666
AddToPath::AddToPath "$INSTDIR\bin"
671667
${endif}
672-
FileClose $LogFile ;Closes the filled file
668+
FileClose $LogFile ;Closes the filled file
673669

674670
SectionEnd
675671

0 commit comments

Comments
 (0)