@@ -113,6 +113,7 @@ Var effective_cache_size
113
113
; Set 'install service' variable
114
114
; Var service
115
115
116
+
116
117
; MUI_COMPONENTSPAGE_SMALLDESC or MUI_COMPONENTSPAGE_NODESC
117
118
!define MUI_COMPONENTSPAGE_SMALLDESC
118
119
@@ -150,6 +151,7 @@ PageEx directory
150
151
DirText $(DATADIR_MESS) $(DATADIR_TITLE) $(BROWSE_BUTTON)
151
152
PageExEnd
152
153
154
+
153
155
Page custom ChecExistDataDir
154
156
155
157
Page custom nsDialogServer nsDialogsServerPageLeave
@@ -169,6 +171,7 @@ Page custom nsDialogOptimization nsDialogsOptimizationPageLeave
169
171
!define MUI_WELCOMEPAGE_TITLE_3LINES
170
172
!define MUI_FINISHPAGE_TITLE_3LINES
171
173
!insertmacro MUI_UNPAGE_WELCOME
174
+ ; !insertmacro MUI_UNPAGE_COMPONENTS
172
175
!insertmacro MUI_UNPAGE_CONFIRM
173
176
!insertmacro MUI_UNPAGE_INSTFILES
174
177
!insertmacro MUI_UNPAGE_FINISH
@@ -194,6 +197,85 @@ Section "Microsoft Visual C++ ${REDIST_YEAR} Redistributable" secMS
194
197
Delete $1
195
198
SectionEnd
196
199
200
+ SectionGroup /e $(PostgreSQLString) serverGroup
201
+
202
+ Section " Client components" secClient
203
+
204
+ /* ${If} ${FileExists} "$INSTDIR\*.*"
205
+ ${orif} ${FileExists} "$INSTDIR"
206
+ MessageBox MB_OK|MB_ICONINFORMATION 'Can not install clients components to this path! The installation was found on the path "$PG_OLD_DIR" '
207
+ Return
208
+ ${EndIf}*/
209
+
210
+ MessageBox MB_OK |MB_ICONINFORMATION " pg_old_dir: $PG_OLD_DIR"
211
+ ; Call ChecExistInstall ;get port number for psql
212
+
213
+ !include clientlist.nsi
214
+ ; SetOutPath "$INSTDIR\bin"
215
+ ; File /r ${PG_INS_SOURCE_DIR}\*.*
216
+ ; File /r ${PG_INS_SOURCE_DIR}\bin\*.*
217
+ ; SetOutPath "$INSTDIR\doc"
218
+ ; File /r ${PG_INS_SOURCE_DIR}\doc\*.*
219
+ ; File /r ${PG_INS_SOURCE_DIR}\include\*.*
220
+ ; File /r ${PG_INS_SOURCE_DIR}\lib\*.*
221
+ ; File /r ${PG_INS_SOURCE_DIR}\share\*.*
222
+ ; File /r ${PG_INS_SOURCE_DIR}\symbols\*.*
223
+
224
+ File " License.txt"
225
+ File " 3rd_party_licenses.txt"
226
+
227
+ CreateDirectory " $INSTDIR\scripts"
228
+ File " /oname=$INSTDIR\scripts\pg-psql.ico" " pg-psql.ico"
229
+ File " /oname=$INSTDIR\doc\pg-help.ico" " pg-help.ico"
230
+
231
+ ; Store installation folder
232
+ WriteRegStr HKLM " ${PRODUCT_DIR_REGKEY}" " " $INSTDIR
233
+
234
+
235
+
236
+ WriteUninstaller " $INSTDIR\Uninstall.exe"
237
+ Call writeUnistallReg
238
+ Call createRunPsql
239
+
240
+
241
+ !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
242
+
243
+ ; Create shortcuts
244
+ CreateDirectory " $SMPROGRAMS\$StartMenuFolder"
245
+ CreateShortCut " $SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" " $INSTDIR\Uninstall.exe"
246
+
247
+ ${if} ${FileExists} " $INSTDIR\scripts\runpgsql.bat"
248
+ CreateShortCut " $SMPROGRAMS\$StartMenuFolder\SQL Shell (psql).lnk" " $INSTDIR\scripts\runpgsql.bat" " " " $INSTDIR\scripts\pg-psql.ico" " 0" " " " " " PostgreSQL command line utility"
249
+ ${else}
250
+ CreateShortCut " $SMPROGRAMS\$StartMenuFolder\SQL Shell (psql).lnk" " $INSTDIR\bin\psql.exe" " -h localhost -U $UserName_text -d postgres -p $TextPort_text" " " " " " " " " " PostgreSQL command line utility"
251
+ ${endif}
252
+
253
+
254
+ ReadRegStr $0 HKCU " Console\SQL Shell (psql)" " FaceName"
255
+ ${if} $0 == " "
256
+ WriteRegStr HKCU " Console\SQL Shell (psql)" " FaceName" " Consolas"
257
+ WriteRegDWORD HKCU " Console\SQL Shell (psql)" " FontWeight" " 400"
258
+ WriteRegDWORD HKCU " Console\SQL Shell (psql)" " FontSize" " 917504"
259
+ WriteRegDWORD HKCU " Console\SQL Shell (psql)" " FontFamily" " 54"
260
+ ${endif}
261
+
262
+
263
+ CreateDirectory " $SMPROGRAMS\$StartMenuFolder\Documentation"
264
+
265
+ !insertmacro CreateInternetShortcut \
266
+ " $SMPROGRAMS\$StartMenuFolder\Documentation\${PRODUCT_NAME} documentation (EN)" \
267
+ " $INSTDIR\doc\postgresql-en.chm" \
268
+ " $INSTDIR\doc\pg-help.ico" " 0"
269
+
270
+ !insertmacro CreateInternetShortcut \
271
+ " $SMPROGRAMS\$StartMenuFolder\Documentation\${PRODUCT_NAME} documentation (RU)" \
272
+ " $INSTDIR\doc\postgresql-ru.chm" \
273
+ " $INSTDIR\doc\pg-help.ico" " 0"
274
+
275
+ !insertmacro MUI_STARTMENU_WRITE_END
276
+
277
+ SectionEnd
278
+
197
279
Section $(PostgreSQLString) sec1
198
280
199
281
${if} $PG_OLD_DIR != " " ; exist PG install
@@ -216,8 +298,16 @@ Section $(PostgreSQLString) sec1
216
298
${endif}
217
299
${endif}
218
300
219
- SetOutPath " $INSTDIR"
220
- File /r ${PG_INS_SOURCE_DIR}
301
+ !include serverlist.nsi
302
+ ; SetOutPath "$INSTDIR"
303
+ ; File /r ${PG_INS_SOURCE_DIR}\*.*
304
+ ; File /r ${PG_INS_SOURCE_DIR}\bin\*.*
305
+ ; File /r ${PG_INS_SOURCE_DIR}\doc\*.*
306
+ ; File /r ${PG_INS_SOURCE_DIR}\include\*.*
307
+ ; File /r ${PG_INS_SOURCE_DIR}\lib\*.*
308
+ ; File /r ${PG_INS_SOURCE_DIR}\share\*.*
309
+ ; File /r ${PG_INS_SOURCE_DIR}\symbols\*.*
310
+
221
311
File " License.txt"
222
312
File " 3rd_party_licenses.txt"
223
313
@@ -670,6 +760,12 @@ Section $(PostgreSQLString) sec1
670
760
671
761
SectionEnd
672
762
763
+
764
+ SectionGroupEnd
765
+
766
+
767
+
768
+
673
769
; Uninstaller Section
674
770
Section " Uninstall"
675
771
Call un.ChecExistInstall
@@ -701,6 +797,10 @@ Section "Uninstall"
701
797
RMDir /r " $INSTDIR\symbols"
702
798
RMDir /r " $INSTDIR\StackBuilder"
703
799
RMDir /r " $INSTDIR\scripts"
800
+
801
+
802
+
803
+
704
804
RMDir " $INSTDIR"
705
805
706
806
Call un.DeleteInstallOptions
@@ -747,6 +847,48 @@ SectionEnd
747
847
; !insertmacro MUI_DESCRIPTION_TEXT ${SecService} $(DESC_SecService)
748
848
!insertmacro MUI_FUNCTION_DESCRIPTION_END
749
849
850
+
851
+ Function writeUnistallReg
852
+ WriteRegExpandStr HKLM " Software\Microsoft\Windows\CurrentVersion\Uninstall\${PG_DEF_BRANDING}" " InstallLocation" " $INSTDIR"
853
+ WriteRegStr HKLM " Software\Microsoft\Windows\CurrentVersion\Uninstall\${PG_DEF_BRANDING}" " DisplayName" " $StartMenuFolder"
854
+ WriteRegStr HKLM " Software\Microsoft\Windows\CurrentVersion\Uninstall\${PG_DEF_BRANDING}" " UninstallString" ' "$INSTDIR\Uninstall.exe"'
855
+ WriteRegStr HKLM " Software\Microsoft\Windows\CurrentVersion\Uninstall\${PG_DEF_BRANDING}" " DisplayVersion" " ${PG_DEF_VERSION}"
856
+ WriteRegStr HKLM " Software\Microsoft\Windows\CurrentVersion\Uninstall\${PG_DEF_BRANDING}" " Publisher" " ${PRODUCT_PUBLISHER}"
857
+ WriteRegStr HKLM " Software\Microsoft\Windows\CurrentVersion\Uninstall\${PG_DEF_BRANDING}" " HelpLink" " ${PRODUCT_WEB_SITE}"
858
+ WriteRegStr HKLM " Software\Microsoft\Windows\CurrentVersion\Uninstall\${PG_DEF_BRANDING}" " Comments" " Packaged by PostgresPro.ru"
859
+ WriteRegStr HKLM " Software\Microsoft\Windows\CurrentVersion\Uninstall\${PG_DEF_BRANDING}" " UrlInfoAbout" " ${PRODUCT_WEB_SITE}"
860
+
861
+ ${GetSize} " $INSTDIR" " /S=0K" $0 $1 $2
862
+ IntFmt $0 " 0x%08X" $0
863
+ WriteRegDWORD HKLM " Software\Microsoft\Windows\CurrentVersion\Uninstall\${PG_DEF_BRANDING}" " EstimatedSize" " $0"
864
+
865
+ FunctionEnd
866
+
867
+ Function createRunPsql
868
+ ${If} ${AtLeastWin2008}
869
+ StrCpy $Chcp_text " chcp 65001"
870
+ ${Else}
871
+ StrCpy $Chcp_text " "
872
+ ${Endif}
873
+
874
+ ${if} ${PRODUCT_NAME} == " PostgreSQL"
875
+ StrCpy $Chcp_text " "
876
+
877
+ DetailPrint " Language settings:"
878
+ DetailPrint " LANG_RUSSIAN=${LANG_RUSSIAN}"
879
+ DetailPrint " LANG_ENGLISH=${LANG_ENGLISH}"
880
+ DetailPrint " LANGUAGE=$LANGUAGE"
881
+
882
+ ${if} $LANGUAGE == ${LANG_RUSSIAN}
883
+ StrCpy $Chcp_text " chcp 1251"
884
+ ${endif}
885
+ ${endif}
886
+
887
+ FileOpen $0 $INSTDIR \scripts\runpgsql.bat w
888
+ IfErrors +2 0
889
+ FileWrite $0 ' @echo off$\r$\n $Chcp_text$\r$\n PATH $INSTDIR\bin;%PATH%$\r$\n if not exist "%APPDATA%\postgresql" md "%APPDATA%\postgresql"$\r$\n psql.exe -h localhost -U "$UserName_text" -d postgres -p $TextPort_text$\r$\n pause'
890
+ FileClose $0
891
+ FunctionEnd
750
892
; check existing install
751
893
; if exist then get install options to vars
752
894
Function ChecExistInstall
@@ -985,7 +1127,10 @@ Function un.ChecExistInstall
985
1127
ReadRegStr $ServiceID_text HKLM " ${PG_REG_KEY}" " Service ID"
986
1128
ReadRegStr $UserName_text HKLM " ${PG_REG_KEY}" " Super User"
987
1129
ReadRegStr $Branding_text HKLM " ${PG_REG_KEY}" " Branding"
1130
+
1131
+
988
1132
${endif}
1133
+
989
1134
FunctionEnd
990
1135
991
1136
Function getServerDataFromDlg
@@ -1029,6 +1174,7 @@ FunctionEnd
1029
1174
; say that PG is exist
1030
1175
Function nsDialogServerExist
1031
1176
${Unless} ${SectionIsSelected} ${sec1}
1177
+ ${AndUnless} ${SectionIsSelected} ${secClient}
1032
1178
Abort
1033
1179
${EndUnless}
1034
1180
${if} $PG_OLD_DIR == " " ; no PG install
@@ -1787,12 +1933,15 @@ MessageBox MB_OK|MB_ICONSTOP "This version can be installed only on 64-bit Windo
1787
1933
Abort
1788
1934
${EndIf}
1789
1935
!endif
1936
+ IntOp $3 ${SF_SELECTED} |${SF_RO}
1937
+ SectionSetFlags ${secClient} $3
1938
+ ; SectionSetFlags ${secClient} ${SF_RO}
1790
1939
1791
1940
!insertmacro MUI_LANGDLL_DISPLAY; select language
1792
1941
StrCpy $PG_OLD_DIR " "
1793
1942
StrCpy $DATA_DIR " $INSTDIR\data"
1794
1943
StrCpy $OLD_DATA_DIR " "
1795
-
1944
+
1796
1945
StrCpy $UserName_text " ${PG_DEF_SUPERUSER}"
1797
1946
1798
1947
StrCpy $ServiceAccount_text " ${PG_DEF_SERVICEACCOUNT}"
@@ -1924,8 +2073,14 @@ Function func1
1924
2073
is5:
1925
2074
FunctionEnd
1926
2075
2076
+
1927
2077
Function dirPre
2078
+ ; ${if} ${SectionIsSelected} ${secClient}
2079
+ ; return
2080
+ ; ${endif}
2081
+
1928
2082
${Unless} ${SectionIsSelected} ${sec1}
2083
+ ${AndUnless} ${SectionIsSelected} ${secClient}
1929
2084
Abort
1930
2085
${EndUnless}
1931
2086
${if} $PG_OLD_DIR != " " ; exist PG install
@@ -1941,3 +2096,22 @@ Function CheckWindowsVersion
1941
2096
${EndUnless}
1942
2097
${EndIf}
1943
2098
FunctionEnd
2099
+
2100
+
2101
+ Function .onSelChange
2102
+ ; MessageBox MB_OK|MB_ICONINFORMATION $0
2103
+ ${if} $0 == ${sec1}
2104
+ ${orif} $0 == ${serverGroup}
2105
+ SectionGetFlags ${sec1} $1
2106
+ ; IntOp $1 ${SF_SELECTED}
2107
+ ; SectionSetFlags 2 ${SF_SELECTED} | ${SF_RO}
2108
+ ${if} $1 == ${SF_SELECTED}
2109
+ IntOp $3 ${SF_SELECTED} |${SF_RO}
2110
+ SectionSetFlags ${secClient} $3
2111
+ ; SectionSetFlags ${secClient} ${SF_RO}
2112
+ ${else}
2113
+ SectionSetFlags ${secClient} ${SF_SELECTED}
2114
+ ${endif}
2115
+
2116
+ ${endif}
2117
+ FunctionEnd