@@ -247,14 +247,20 @@ Section $(componentClient) secClient
247
247
248
248
; MessageBox MB_OK|MB_ICONINFORMATION "pg_old_dir: $PG_OLD_DIR"
249
249
; Call ChecExistInstall ;get port number for psql
250
+
251
+ IfSilent 0 +2
252
+ Call ChecExistInstall
253
+
250
254
var/GLOBAL isStopped
251
255
StrCpy $isStopped 0
252
256
253
257
254
258
${if} $PG_OLD_DIR != " " ; exist PG install
255
- MessageBox MB_YESNO |MB_ICONQUESTION " $(MESS_STOP_SERVER)" IDYES doitStopIDNO noyetStop
259
+ MessageBox MB_YESNO |MB_ICONQUESTION " $(MESS_STOP_SERVER)" /SDIDYES IDYES doitStopIDNO noyetStop
260
+
256
261
noyetStop:
257
- Return
262
+ ; Return
263
+ Abort
258
264
doitStop:
259
265
DetailPrint " Stop the server ..."
260
266
${if} $OLD_DATA_DIR != " "
@@ -358,26 +364,38 @@ SectionEnd
358
364
359
365
Section $(componentServer) sec1
360
366
367
+ IfSilent 0 +2
368
+ Call CheckDataDir
369
+
370
+ FileOpen $LogFile $INSTDIR \install.log w; Opens a Empty File an fills it
361
371
362
372
${if} $PG_OLD_DIR != " " ; exist PG install
363
373
${if} $isStopped == 0
364
- MessageBox MB_YESNO |MB_ICONQUESTION " $(MESS_STOP_SERVER)" IDYES doitStopIDNO noyetStop
374
+ MessageBox MB_YESNO |MB_ICONQUESTION " $(MESS_STOP_SERVER)" /SD IDYES IDYES doitStopIDNO noyetStop
365
375
noyetStop:
366
- Return
376
+ ; Return
377
+ FileClose $LogFile
378
+ Abort
367
379
doitStop:
368
380
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 '
369
383
${if} $OLD_DATA_DIR != " "
370
384
nsExec::Exec ' "$PG_OLD_DIR\bin\pg_ctl.exe" stop -D "$OLD_DATA_DIR" -m fast -w'
371
385
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"
373
388
${endif}
374
389
${endif}
375
390
376
391
; unregister
392
+ FileWrite $LogFile " Unregister the service ...$\r$\n "
377
393
DetailPrint " Unregister the service ..."
378
394
${if} $OldServiceID_text != " "
395
+ FileWrite $LogFile ' "$PG_OLD_DIR\bin\pg_ctl.exe" unregister -N "$OldServiceID_text"$\r$\n '
379
396
nsExec::Exec ' "$PG_OLD_DIR\bin\pg_ctl.exe" unregister -N "$OldServiceID_text"'
380
397
pop$0
398
+ FileWrite $LogFile " pg_ctl.exe unregister return $0$\r$\n "
381
399
DetailPrint " pg_ctl.exe unregister return $0"
382
400
${endif}
383
401
${endif}
@@ -397,7 +415,7 @@ Section $(componentServer) sec1
397
415
398
416
; File "License.txt"
399
417
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
401
419
402
420
403
421
CreateDirectory " $INSTDIR\scripts"
@@ -413,7 +431,7 @@ Section $(componentServer) sec1
413
431
WriteUninstaller " $INSTDIR\Uninstall.exe"
414
432
415
433
; write uninstall strings
416
- FileWrite $LogFile " Write to register\r$\n "
434
+ FileWrite $LogFile " Write to register$ \r$\n"
417
435
418
436
Call writeUnistallReg
419
437
@@ -529,9 +547,9 @@ Section $(componentServer) sec1
529
547
530
548
!insertmacro MUI_STARTMENU_WRITE_END
531
549
; Create data dir begin
532
- FileWrite $LogFile " Create data dir begin$\r$\n "
533
550
534
551
${if} $isDataDirExist == 0
552
+ FileWrite $LogFile " Create data dir begin$\r$\n "
535
553
CreateDirectory " $DATA_DIR"
536
554
; AccessControl::GrantOnFile "$DATA_DIR" "(BU)" "FullAccess" ;GenericWrite
537
555
; Pop $0 ;"ok" or "error" + error details
@@ -610,8 +628,8 @@ Section $(componentServer) sec1
610
628
${EndIf}
611
629
${endif}
612
630
; Create data dir end
613
- FileWrite $LogFile " Create postgresql.conf$\r$\n "
614
631
${if} $isDataDirExist == 0
632
+ FileWrite $LogFile " Create postgresql.conf$\r$\n "
615
633
${if} $checkNoLocal_state == ${BST_CHECKED}
616
634
!insertmacro _ReplaceInFile" $DATA_DIR\postgresql.conf" " #listen_addresses = 'localhost'" " listen_addresses = '*'"
617
635
; Add line to pg_hba.conf
@@ -1362,25 +1380,22 @@ Function nsDialogServerExist
1362
1380
nsDialogs::Show
1363
1381
FunctionEnd
1364
1382
1365
- Function ChecExistDataDir
1366
- ${Unless} ${SectionIsSelected} ${sec1}
1367
- Abort
1368
- ${EndUnless}
1383
+
1384
+ ; check existing datadir function
1385
+ Function CheckDataDir
1369
1386
${If} ${FileExists} " $DATA_DIR\*.*"
1370
1387
StrCpy $isDataDirExist 1
1371
1388
${ElseIf} ${FileExists} " $DATA_DIR"
1372
1389
StrCpy $isDataDirExist -1
1373
1390
${Else}
1374
1391
StrCpy $isDataDirExist 0
1375
- Abort
1376
1392
${EndIf}
1377
-
1393
+
1378
1394
${If} ${FileExists} " $DATA_DIR\postgresql.conf"
1379
1395
ClearErrors
1380
1396
${ConfigRead} " $DATA_DIR\postgresql.conf" " port" $R0
1381
1397
${if} ${Errors}
1382
1398
StrCpy $isDataDirExist 0
1383
- Abort
1384
1399
${EndIf}
1385
1400
${StrRep} ' $0' ' $R0' ' =' ' '
1386
1401
${StrRep} ' $1' ' $0' ' ' ' '
@@ -1392,9 +1407,21 @@ Function ChecExistDataDir
1392
1407
StrCpy $TextPort_text $0
1393
1408
${Else}
1394
1409
StrCpy $isDataDirExist 0
1395
- Abort
1396
1410
${EndIf}
1397
1411
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
+
1398
1425
${if} $PG_OLD_DIR != " " ; exist PG install
1399
1426
Abort
1400
1427
${endif}
@@ -2294,6 +2321,18 @@ ${EndIf}
2294
2321
StrCpy $isDataChecksums " $1"
2295
2322
${endif}
2296
2323
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}
2297
2336
2298
2337
2299
2338
FunctionEnd