@@ -136,7 +136,9 @@ Var effective_cache_size
136
136
!define MUI_WELCOMEPAGE_TITLE_3LINES
137
137
!define MUI_FINISHPAGE_TITLE_3LINES
138
138
!insertmacro MUI_PAGE_WELCOME
139
- !insertmacro MUI_PAGE_LICENSE" License.txt"
139
+ ; !insertmacro MUI_PAGE_LICENSE "License.txt"
140
+ !insertmacro MUI_PAGE_LICENSE $(myLicenseData)
141
+
140
142
141
143
Page custom ChecExistInstall; PG_OLD_DIR !="" if exist
142
144
!insertmacro MUI_PAGE_COMPONENTS
@@ -183,6 +185,20 @@ Page custom nsDialogOptimization nsDialogsOptimizationPageLeave
183
185
184
186
!include translates.nsi
185
187
188
+ !ifndef myLicenseFile_ru
189
+ !define myLicenseFile_ru" license.txt"
190
+ !endif
191
+ !ifndef myLicenseFile_en
192
+ !define myLicenseFile_en" license.txt"
193
+ !endif
194
+
195
+
196
+
197
+ LicenseLangString myLicenseData${LANG_RUSSIAN} ${myLicenseFile_ru}
198
+ LicenseLangString myLicenseData${LANG_ENGLISH} ${myLicenseFile_en}
199
+ LicenseData $(myLicenseData)
200
+
201
+
186
202
; --------------------------------
187
203
; Installer Sections
188
204
Section " Microsoft Visual C++ ${REDIST_YEAR} Redistributable" secMS
@@ -211,6 +227,26 @@ Section $(componentClient) secClient
211
227
212
228
; MessageBox MB_OK|MB_ICONINFORMATION "pg_old_dir: $PG_OLD_DIR"
213
229
; Call ChecExistInstall ;get port number for psql
230
+ var/GLOBAL isStopped
231
+ StrCpy $isStopped 0
232
+
233
+
234
+ ${if} $PG_OLD_DIR != " " ; exist PG install
235
+ MessageBox MB_YESNO |MB_ICONQUESTION " $(MESS_STOP_SERVER)" IDYES doitStopIDNO noyetStop
236
+ noyetStop:
237
+ Return
238
+ doitStop:
239
+ DetailPrint " Stop the server ..."
240
+ ${if} $OLD_DATA_DIR != " "
241
+ nsExec::Exec ' "$PG_OLD_DIR\bin\pg_ctl.exe" stop -D "$OLD_DATA_DIR" -m fast -w'
242
+ pop$0
243
+ DetailPrint " pg_ctl.exe stop return $0"
244
+ StrCpy $isStopped 1
245
+ ${endif}
246
+ ; unregister
247
+ ${endif}
248
+
249
+
214
250
215
251
!include client_list.nsi
216
252
; SetOutPath "$INSTDIR\bin"
@@ -275,11 +311,27 @@ Section $(componentClient) secClient
275
311
276
312
!insertmacro MUI_STARTMENU_WRITE_END
277
313
314
+ ${if} $isStopped = 1
315
+ ; SectionGetFlags ${sec1} $1
316
+ ; start server
317
+ call IsServerSection
318
+ pop$0
319
+ ${if} $0 == " 0"
320
+ DetailPrint " Start server ..."
321
+ Sleep 1000
322
+ nsExec::ExecToStack /TIMEOUT= 60000 ' sc start "$ServiceID_text"'
323
+ Sleep 5000
324
+ StrCpy $isStopped 0
325
+ ${endif}
326
+
327
+ ${endif}
328
+
278
329
SectionEnd
279
330
280
331
Section $(componentServer) sec1
281
332
282
333
${if} $PG_OLD_DIR != " " ; exist PG install
334
+ ${if} $isStopped == 0
283
335
MessageBox MB_YESNO |MB_ICONQUESTION " $(MESS_STOP_SERVER)" IDYES doitStopIDNO noyetStop
284
336
noyetStop:
285
337
Return
@@ -290,6 +342,8 @@ Section $(componentServer) sec1
290
342
pop$0
291
343
DetailPrint " pg_ctl.exe stop return $0"
292
344
${endif}
345
+ ${endif}
346
+
293
347
; unregister
294
348
DetailPrint " Unregister the service ..."
295
349
${if} $OldServiceID_text != " "
@@ -757,8 +811,10 @@ Section $(componentServer) sec1
757
811
758
812
759
813
; check connection to the server
814
+ ${if} $OLD_DATA_DIR == " " ; if server war running we do not know password
815
+
760
816
DetailPrint " Check connection ..."
761
- ; Sleep 1000
817
+ Sleep 1000
762
818
763
819
FileWrite $LogFile " Check connection ...$\r$\n "
764
820
FileWrite $LogFile ' "$INSTDIR\bin\psql.exe" -p $TextPort_text -U "$UserName_text" -c "SELECT 1;" postgres$\r$\n '
@@ -787,6 +843,8 @@ Section $(componentServer) sec1
787
843
DetailPrint " Checking connection is OK"
788
844
FileWrite $LogFile " Checking connection is OK$\r$\n "
789
845
${endif}
846
+
847
+
790
848
${if} " $Pass1_text" != " "
791
849
StrCpy $R0 " "
792
850
System::Call ' Kernel32::SetEnvironmentVariableA(t, t) i("PGPASSWORD", R0).r0'
@@ -824,6 +882,10 @@ Section $(componentServer) sec1
824
882
System::Call ' Kernel32::SetEnvironmentVariableA(t, t) i("PGPASSWORD", R0).r0'
825
883
${endif}
826
884
${endif}
885
+
886
+ ${endif} ; end: if server war running we do not know password?
887
+
888
+
827
889
${if} $isEnvVar == ${BST_CHECKED}
828
890
WriteRegExpandStr HKLM " SYSTEM\CurrentControlSet\Control\Session Manager\Environment" " PGDATA" " $DATA_DIR"
829
891
WriteRegExpandStr HKLM " SYSTEM\CurrentControlSet\Control\Session Manager\Environment" " PGDATABASE" " postgres"
@@ -2220,3 +2282,12 @@ Function checkServiceIsRunning
2220
2282
2221
2283
FunctionEnd
2222
2284
2285
+ Function IsServerSection
2286
+ SectionGetFlags ${sec1} $1
2287
+ ${if} $1 == ${SF_SELECTED}
2288
+ push" 1"
2289
+ ${else}
2290
+ push" 0"
2291
+ ${endif}
2292
+
2293
+ FunctionEnd