|
24 | 24 | !include"WinVer.nsh"
|
25 | 25 | !include"Ports.nsh"
|
26 | 26 | !include"x64.nsh"
|
| 27 | +!include"StrContains.nsh" |
27 | 28 | !insertmacro VersionCompare
|
28 |
| - |
29 | 29 | ;--------------------------------
|
30 | 30 | ;General
|
31 | 31 | Name"${PRODUCT_NAME} ${PRODUCT_VERSION}"
|
@@ -199,12 +199,9 @@ SectionEnd
|
199 | 199 |
|
200 | 200 | SectionGroup/e $(PostgreSQLString) serverGroup
|
201 | 201 |
|
202 |
| -Function writeUnIsn |
203 |
| -FunctionEnd |
204 |
| - |
205 | 202 |
|
206 | 203 |
|
207 |
| -Section"Client components" secClient |
| 204 | +Section$(componentClient) secClient |
208 | 205 |
|
209 | 206 | /*${If} ${FileExists} "$INSTDIR\*.*"
|
210 | 207 | ${orif} ${FileExists} "$INSTDIR"
|
@@ -280,7 +277,7 @@ Section "Client components" secClient
|
280 | 277 |
|
281 | 278 | SectionEnd
|
282 | 279 |
|
283 |
| -Section $(PostgreSQLString) sec1 |
| 280 | +Section $(componentServer) sec1 |
284 | 281 |
|
285 | 282 | ${if}$PG_OLD_DIR!=""; exist PG install
|
286 | 283 | MessageBoxMB_YESNO|MB_ICONQUESTION"$(MESS_STOP_SERVER)"IDYES doitStopIDNO noyetStop
|
@@ -624,6 +621,10 @@ Section $(PostgreSQLString) sec1
|
624 | 621 | FileWrite$0"#online_analyze.local_tracking = 'on'$\r$\n"
|
625 | 622 | FileWrite$0"#plantuner.fix_empty_table = 'on'$\r$\n"
|
626 | 623 | FileWrite$0"#online_analyze.enable = off$\r$\n"
|
| 624 | + |
| 625 | +;debug for unstarted server: |
| 626 | +;FileWrite $0 "effective_io_concurrency = 2$\r$\n" |
| 627 | + |
627 | 628 | FileClose$0
|
628 | 629 |
|
629 | 630 | ErrFileCfg1:
|
@@ -730,6 +731,63 @@ Section $(PostgreSQLString) sec1
|
730 | 731 | FileWrite$LogFile"Start service OK$\r$\n"
|
731 | 732 |
|
732 | 733 | ${endif}
|
| 734 | + |
| 735 | +;check that service is running |
| 736 | +;sc query "postgrespro-X64-10" | find "RUNNING" |
| 737 | + |
| 738 | + DetailPrint"Check service is running ..." |
| 739 | + call checkServiceIsRunning |
| 740 | + pop$0 |
| 741 | +${if}$0=="" |
| 742 | + Sleep5000 |
| 743 | + call checkServiceIsRunning |
| 744 | + pop$0 |
| 745 | +${if}$0=="" |
| 746 | + DetailPrint"Error: service is not running!" |
| 747 | + MessageBoxMB_OK|MB_ICONSTOP"$(MESS_ERROR_SERVER)" |
| 748 | + FileWrite$LogFile"Error: service $ServiceID_text is not running!$\r$\n" |
| 749 | + FileClose$LogFile |
| 750 | + Abort |
| 751 | +${endif} |
| 752 | +${endif} |
| 753 | + |
| 754 | + |
| 755 | +;check connection to the server |
| 756 | + DetailPrint"Check connection ..." |
| 757 | +;Sleep 1000 |
| 758 | + |
| 759 | + FileWrite$LogFile"Check connection ...$\r$\n" |
| 760 | + FileWrite$LogFile'"$INSTDIR\bin\psql.exe" -p $TextPort_text -U "$UserName_text" -c "SELECT 1;" postgres$\r$\n' |
| 761 | + |
| 762 | +;send password to Environment Variable PGPASSWORD |
| 763 | +${if}"$Pass1_text"!="" |
| 764 | + StrCpy$R0$Pass1_text |
| 765 | + System::Call'Kernel32::SetEnvironmentVariableA(t, t) i("PGPASSWORD", R0).r0' |
| 766 | +${endif} |
| 767 | + |
| 768 | + nsExec::ExecToStack /TIMEOUT=10000'"$INSTDIR\bin\psql.exe" -p $TextPort_text -U "$UserName_text" -c "SELECT 1;" postgres' |
| 769 | + |
| 770 | + pop$0 |
| 771 | + pop$1# printed text, up to ${NSIS_MAX_STRLEN} |
| 772 | +${if}$0!=0 |
| 773 | + DetailPrint"Checking connection has return $0" |
| 774 | + DetailPrint"Output: $1" |
| 775 | + FileWrite$LogFile"Checking connection has return $0$\r$\n" |
| 776 | + FileWrite$LogFile"Output: $1$\r$\n" |
| 777 | + |
| 778 | +;MessageBox MB_OK "Create adminpack error: $1" |
| 779 | + MessageBoxMB_OK|MB_ICONSTOP"$(MESS_ERROR_SERVER)" |
| 780 | + FileClose$LogFile |
| 781 | + return |
| 782 | +${else} |
| 783 | + DetailPrint"Checking connection is OK" |
| 784 | + FileWrite$LogFile"Checking connection is OK$\r$\n" |
| 785 | +${endif} |
| 786 | +${if}"$Pass1_text"!="" |
| 787 | + StrCpy$R0"" |
| 788 | + System::Call'Kernel32::SetEnvironmentVariableA(t, t) i("PGPASSWORD", R0).r0' |
| 789 | +${endif} |
| 790 | +;end check connection to the server |
733 | 791 |
|
734 | 792 | ${if}$isDataDirExist==0
|
735 | 793 | ;send password to Environment Variable PGPASSWORD
|
@@ -774,6 +832,9 @@ Section $(PostgreSQLString) sec1
|
774 | 832 |
|
775 | 833 | SectionEnd
|
776 | 834 |
|
| 835 | +Section $(componentDeveloper) secDev |
| 836 | +!include devel_list.nsi |
| 837 | +SectionEnd |
777 | 838 |
|
778 | 839 | SectionGroupEnd
|
779 | 840 |
|
@@ -858,6 +919,11 @@ SectionEnd
|
858 | 919 | !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
859 | 920 | !insertmacro MUI_DESCRIPTION_TEXT${SecMS} $(DESC_SecMS)
|
860 | 921 | !insertmacro MUI_DESCRIPTION_TEXT${Sec1} $(DESC_Sec1)
|
| 922 | +!insertmacro MUI_DESCRIPTION_TEXT${secClient} $(DESC_componentClient) |
| 923 | +!insertmacro MUI_DESCRIPTION_TEXT${secDev} $(DESC_componentDeveloper) |
| 924 | + |
| 925 | + |
| 926 | + |
861 | 927 | ;!insertmacro MUI_DESCRIPTION_TEXT ${SecService} $(DESC_SecService)
|
862 | 928 | !insertmacro MUI_FUNCTION_DESCRIPTION_END
|
863 | 929 |
|
@@ -1952,7 +2018,7 @@ ${EndIf}
|
1952 | 2018 | IntOp$3${SF_SELECTED} |${SF_RO}
|
1953 | 2019 | SectionSetFlags${secClient}$3
|
1954 | 2020 | ;SectionSetFlags ${secClient} ${SF_RO}
|
1955 |
| - |
| 2021 | +!define MUI_LANGDLL_ALLLANGUAGES |
1956 | 2022 | !insertmacro MUI_LANGDLL_DISPLAY;select language
|
1957 | 2023 | StrCpy$PG_OLD_DIR""
|
1958 | 2024 | StrCpy$DATA_DIR"$INSTDIR\data"
|
@@ -2131,3 +2197,22 @@ Function .onSelChange
|
2131 | 2197 |
|
2132 | 2198 | ${endif}
|
2133 | 2199 | FunctionEnd
|
| 2200 | + |
| 2201 | +Function checkServiceIsRunning |
| 2202 | + nsExec::ExecToStack /TIMEOUT=10000'sc query "$ServiceID_text"' |
| 2203 | + pop$0 |
| 2204 | + pop$1# printed text, up to ${NSIS_MAX_STRLEN} |
| 2205 | +${if}$0!='0' |
| 2206 | + push"" |
| 2207 | + return |
| 2208 | +${endif} |
| 2209 | + |
| 2210 | +${StrContains}$2"RUNNING""$1" |
| 2211 | +${if}$2=="" |
| 2212 | + push"" |
| 2213 | + return |
| 2214 | +${endif} |
| 2215 | + push"1" |
| 2216 | + |
| 2217 | +FunctionEnd |
| 2218 | + |