Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit01066ec

Browse files
committed
Fixed silent mode. Now installer checks exist installation in the silent mode. And added options in ini file for silent mode: servicesccount, servicepassword, serviceid.
1 parenta61ed4a commit01066ec

File tree

1 file changed

+56
-17
lines changed

1 file changed

+56
-17
lines changed

‎nsis/postgresql.nsi

Lines changed: 56 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -247,14 +247,20 @@ Section $(componentClient) secClient
247247

248248
;MessageBox MB_OK|MB_ICONINFORMATION "pg_old_dir: $PG_OLD_DIR"
249249
;Call ChecExistInstall ;get port number for psql
250+
251+
IfSilent0 +2
252+
Call ChecExistInstall
253+
250254
var/GLOBAL isStopped
251255
StrCpy$isStopped0
252256

253257

254258
${if}$PG_OLD_DIR!=""; exist PG install
255-
MessageBoxMB_YESNO|MB_ICONQUESTION"$(MESS_STOP_SERVER)"IDYES doitStopIDNO noyetStop
259+
MessageBoxMB_YESNO|MB_ICONQUESTION"$(MESS_STOP_SERVER)" /SDIDYESIDYES doitStopIDNO noyetStop
260+
256261
noyetStop:
257-
Return
262+
;Return
263+
Abort
258264
doitStop:
259265
DetailPrint"Stop the server ..."
260266
${if}$OLD_DATA_DIR!=""
@@ -358,26 +364,38 @@ SectionEnd
358364

359365
Section $(componentServer) sec1
360366

367+
IfSilent0 +2
368+
Call CheckDataDir
369+
370+
FileOpen$LogFile$INSTDIR\install.log w;Opens a Empty File an fills it
361371

362372
${if}$PG_OLD_DIR!=""; exist PG install
363373
${if}$isStopped==0
364-
MessageBoxMB_YESNO|MB_ICONQUESTION"$(MESS_STOP_SERVER)"IDYES doitStopIDNO noyetStop
374+
MessageBoxMB_YESNO|MB_ICONQUESTION"$(MESS_STOP_SERVER)"/SDIDYESIDYES doitStopIDNO noyetStop
365375
noyetStop:
366-
Return
376+
;Return
377+
FileClose$LogFile
378+
Abort
367379
doitStop:
368380
DetailPrint"Stop the server ..."
381+
FileWrite$LogFile"Stop the server ...$\r$\n"
382+
FileWrite$LogFile'"$PG_OLD_DIR\bin\pg_ctl.exe" stop -D "$OLD_DATA_DIR" -m fast -w$\r$\n'
369383
${if}$OLD_DATA_DIR!=""
370384
nsExec::Exec'"$PG_OLD_DIR\bin\pg_ctl.exe" stop -D "$OLD_DATA_DIR" -m fast -w'
371385
pop$0
372-
DetailPrint"pg_ctl.exe stop return $0"
386+
FileWrite$LogFile"pg_ctl.exe stop return $0$\r$\n"
387+
DetailPrint"pg_ctl.exe stop return $0"
373388
${endif}
374389
${endif}
375390

376391
;unregister
392+
FileWrite$LogFile"Unregister the service ...$\r$\n"
377393
DetailPrint"Unregister the service ..."
378394
${if}$OldServiceID_text!=""
395+
FileWrite$LogFile'"$PG_OLD_DIR\bin\pg_ctl.exe" unregister -N "$OldServiceID_text"$\r$\n'
379396
nsExec::Exec'"$PG_OLD_DIR\bin\pg_ctl.exe" unregister -N "$OldServiceID_text"'
380397
pop$0
398+
FileWrite$LogFile"pg_ctl.exe unregister return $0$\r$\n"
381399
DetailPrint"pg_ctl.exe unregister return $0"
382400
${endif}
383401
${endif}
@@ -397,7 +415,7 @@ Section $(componentServer) sec1
397415

398416
;File "License.txt"
399417

400-
FileOpen$LogFile$INSTDIR\install.log w;Opens a Empty File an fills it
418+
;FileOpen $LogFile $INSTDIR\install.log w ;Opens a Empty File an fills it
401419

402420

403421
CreateDirectory"$INSTDIR\scripts"
@@ -413,7 +431,7 @@ Section $(componentServer) sec1
413431
WriteUninstaller"$INSTDIR\Uninstall.exe"
414432

415433
; write uninstall strings
416-
FileWrite$LogFile"Write to register\r$\n"
434+
FileWrite$LogFile"Write to register$\r$\n"
417435

418436
Call writeUnistallReg
419437

@@ -529,9 +547,9 @@ Section $(componentServer) sec1
529547

530548
!insertmacro MUI_STARTMENU_WRITE_END
531549
; Create data dir begin
532-
FileWrite$LogFile"Create data dir begin$\r$\n"
533550

534551
${if}$isDataDirExist==0
552+
FileWrite$LogFile"Create data dir begin$\r$\n"
535553
CreateDirectory"$DATA_DIR"
536554
;AccessControl::GrantOnFile "$DATA_DIR" "(BU)" "FullAccess" ;GenericWrite
537555
;Pop $0 ;"ok" or "error" + error details
@@ -610,8 +628,8 @@ Section $(componentServer) sec1
610628
${EndIf}
611629
${endif}
612630
; Create data dir end
613-
FileWrite$LogFile"Create postgresql.conf$\r$\n"
614631
${if}$isDataDirExist==0
632+
FileWrite$LogFile"Create postgresql.conf$\r$\n"
615633
${if}$checkNoLocal_state==${BST_CHECKED}
616634
!insertmacro _ReplaceInFile"$DATA_DIR\postgresql.conf""#listen_addresses = 'localhost'""listen_addresses = '*'"
617635
; Add line to pg_hba.conf
@@ -1362,25 +1380,22 @@ Function nsDialogServerExist
13621380
nsDialogs::Show
13631381
FunctionEnd
13641382

1365-
Function ChecExistDataDir
1366-
${Unless}${SectionIsSelected}${sec1}
1367-
Abort
1368-
${EndUnless}
1383+
1384+
;check existing datadir function
1385+
Function CheckDataDir
13691386
${If}${FileExists}"$DATA_DIR\*.*"
13701387
StrCpy$isDataDirExist1
13711388
${ElseIf}${FileExists}"$DATA_DIR"
13721389
StrCpy$isDataDirExist -1
13731390
${Else}
13741391
StrCpy$isDataDirExist0
1375-
Abort
13761392
${EndIf}
1377-
1393+
13781394
${If}${FileExists}"$DATA_DIR\postgresql.conf"
13791395
ClearErrors
13801396
${ConfigRead}"$DATA_DIR\postgresql.conf""port"$R0
13811397
${if}${Errors}
13821398
StrCpy$isDataDirExist0
1383-
Abort
13841399
${EndIf}
13851400
${StrRep}'$0''$R0''='''
13861401
${StrRep}'$1''$0'''''
@@ -1392,9 +1407,21 @@ Function ChecExistDataDir
13921407
StrCpy$TextPort_text$0
13931408
${Else}
13941409
StrCpy$isDataDirExist0
1395-
Abort
13961410
${EndIf}
13971411

1412+
1413+
FunctionEnd
1414+
1415+
1416+
Function ChecExistDataDir
1417+
${Unless}${SectionIsSelected}${sec1}
1418+
Abort
1419+
${EndUnless}
1420+
Call CheckDataDir
1421+
${if}$isDataDirExist=0
1422+
Abort
1423+
${endif}
1424+
13981425
${if}$PG_OLD_DIR!="";exist PG install
13991426
Abort
14001427
${endif}
@@ -2294,6 +2321,18 @@ ${EndIf}
22942321
StrCpy$isDataChecksums"$1"
22952322
${endif}
22962323

2324+
ReadINIStr$1$0 options servicesccount
2325+
${if}"$1"!=""
2326+
StrCpy$ServiceAccount_text"$1"
2327+
${endif}
2328+
ReadINIStr$1$0 options servicepassword
2329+
${if}"$1"!=""
2330+
StrCpy$servicePassword_text"$1"
2331+
${endif}
2332+
ReadINIStr$1$0 options serviceid
2333+
${if}"$1"!=""
2334+
StrCpy$ServiceID_text"$1"
2335+
${endif}
22972336

22982337

22992338
FunctionEnd

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp