6
6
7
7
!addplugindir Plugins
8
8
!include " postgres.def.nsh"
9
-
10
9
; --------------------------------
11
10
; Include "Modern UI"
12
11
!include " MUI2.nsh"
@@ -114,6 +113,19 @@ Var effective_cache_size
114
113
Var checkBoxDataChecksums
115
114
Var isDataChecksums
116
115
116
+ Var checkBoxMoreOptions
117
+ Var isShowMoreOptions
118
+
119
+ Var servicePassword_text
120
+ Var servicePassword_editor
121
+
122
+ Var ServiceAccount_editor
123
+ Var ServiceID_editor
124
+
125
+ Var Collation_editor
126
+ Var Collation_text
127
+
128
+ Var currCommand
117
129
118
130
; Set 'install service' variable
119
131
; Var service
@@ -163,6 +175,7 @@ Page custom ChecExistDataDir
163
175
164
176
Page custom nsDialogServer nsDialogsServerPageLeave
165
177
Page custom nsDialogOptimization nsDialogsOptimizationPageLeave
178
+ Page custom nsDialogMore nsDialogsMorePageLeave
166
179
167
180
; Start Menu Folder Page Configuration
168
181
!define MUI_STARTMENUPAGE_DEFAULTFOLDER " ${PG_DEF_BRANDING}"
@@ -537,12 +550,6 @@ Section $(componentServer) sec1
537
550
StrCpy $tempVar ' --pwfile "$tempFileName" -A md5 '
538
551
${endif}
539
552
540
-
541
- ${if} $isDataChecksums == ${BST_CHECKED}
542
- StrCpy $tempVar ' $tempVar --data-checksums '
543
- ${endif}
544
-
545
-
546
553
DetailPrint " Database initialization ..."
547
554
AccessControl::GetCurrentUserName
548
555
Pop $0 ; or "error"
@@ -553,26 +560,30 @@ Section $(componentServer) sec1
553
560
554
561
FileWrite $LogFile " Database initialization ...$\r$\n "
555
562
556
- ${if} " $Locale_text" == " $(DEF_LOCALE_NAME)"
557
- FileWrite $LogFile ' "$INSTDIR\bin\initdb.exe" $tempVar \
558
- --encoding=$Coding_text -U "$UserName_text" \
559
- -D "$DATA_DIR" $\r$\n '
560
- ; Initialise the database cluster, and set the appropriate permissions/ownership
561
- nsExec::ExecToLog /TIMEOUT= 90000 ' "$INSTDIR\bin\initdb.exe" $tempVar \
563
+
564
+ StrCpy $currCommand ' "$INSTDIR\bin\initdb.exe" $tempVar \
562
565
--encoding=$Coding_text -U "$UserName_text" \
563
566
-D "$DATA_DIR"'
567
+ ${if} $isDataChecksums == ${BST_CHECKED}
568
+ StrCpy $currCommand ' $currCommand --data-checksums'
569
+ ${endif}
570
+
571
+ ${if} " $Locale_text" == " $(DEF_LOCALE_NAME)"
572
+ ${if} " $Collation_text" != " $(DEF_COLATE_NAME)"
573
+ StrCpy $currCommand ' $currCommand --locale="@$Collation_text"'
574
+ ${endif}
564
575
${else}
565
- FileWrite $LogFile ' "$INSTDIR\bin\initdb.exe" $tempVar \
566
- --locale="$Locale_text" \
567
- --encoding=$Coding_text \
568
- -U "$UserName_text" \
569
- -D "$DATA_DIR" $\r$\n '
570
- nsExec::ExecToLog /TIMEOUT= 60000 ' "$INSTDIR\bin\initdb.exe" $tempVar \
571
- --locale="$Locale_text" \
572
- --encoding=$Coding_text \
573
- -U "$UserName_text" \
574
- -D "$DATA_DIR"'
576
+ StrCpy $currCommand ' $currCommand --locale="$Locale_text"'
577
+ ${if} " $Collation_text" != " $(DEF_COLATE_NAME)"
578
+ StrCpy $currCommand ' $currCommand --locale="$Locale_text@$Collation_text"'
579
+ ${else}
580
+ StrCpy $currCommand ' $currCommand --locale="$Locale_text"'
581
+ ${endif}
575
582
${endif}
583
+ FileWrite $LogFile ' $currCommand $\r$\n '
584
+ ; Initialise the database cluster, and set the appropriate permissions/ownership
585
+ nsExec::ExecToLog /TIMEOUT= 90000 ' $currCommand'
586
+
576
587
pop $0
577
588
Pop $1 # printed text, up to ${NSIS_MAX_STRLEN}
578
589
@@ -683,9 +694,16 @@ Section $(componentServer) sec1
683
694
Call WriteInstallOptions
684
695
DetailPrint " Service $ServiceID_text registration ..."
685
696
FileWrite $LogFile " Service $ServiceID_text registration ... $\r$\n "
686
- FileWrite $LogFile ' "$INSTDIR\bin\pg_ctl.exe" register -N "$ServiceID_text" -U "$ServiceAccount_text" -D "$DATA_DIR" -w $\r$\n '
687
697
688
- nsExec::ExecToStack /TIMEOUT= 60000 ' "$INSTDIR\bin\pg_ctl.exe" register -N "$ServiceID_text" -U "$ServiceAccount_text" -D "$DATA_DIR" -w'
698
+ StrCpy $currCommand ' "$INSTDIR\bin\pg_ctl.exe" register -N "$ServiceID_text" -U "$ServiceAccount_text" -D "$DATA_DIR" -w'
699
+ ; save without password here
700
+ FileWrite $LogFile ' $currCommand $\r$\n '
701
+ ${if} $servicePassword_text != " "
702
+ StrCpy $currCommand ' $currCommand -P "$servicePassword_text"'
703
+ ${endif}
704
+ ; FileWrite $LogFile '$currCommand $\r$\n'
705
+ nsExec::ExecToLog /TIMEOUT= 60000 ' $currCommand'
706
+
689
707
Pop $0 # return value/error/timeout
690
708
Pop $1 # printed text, up to ${NSIS_MAX_STRLEN}
691
709
@@ -1288,6 +1306,7 @@ Function getServerDataFromDlg
1288
1306
1289
1307
${NSD_GetState} $checkBoxEnvVar $isEnvVar
1290
1308
1309
+
1291
1310
${NSD_GetState} $checkBoxDataChecksums $isDataChecksums
1292
1311
1293
1312
@@ -1427,7 +1446,7 @@ Function nsDialogServer
1427
1446
Pop $Locale
1428
1447
1429
1448
${NSD_CB_AddString} $Locale " $(DEF_LOCALE_NAME)"
1430
- ${if} ${PG_MAJOR_VERSION} = = " 10"
1449
+ ${if} ${PG_MAJOR_VERSION} > = " 10"
1431
1450
; ; Source URL: https://www.microsoft.com/resources/msdn/goglobal/default.mspx (windows 7)
1432
1451
${NSD_CB_AddString} $Locale " af" ; 0x0036 af Afrikaans Afrikaans Afrikaans 1252 850 ZAF AFK
1433
1452
${NSD_CB_AddString} $Locale " af-ZA" ; 0x0436 af-ZA Afrikaans (South Africa) Afrikaans Afrikaans (Suid Afrika) 1252 850 ZAF AFK
@@ -1910,7 +1929,7 @@ Function nsDialogServer
1910
1929
${endif}
1911
1930
${NSD_CB_SelectString} $Locale $Locale_text
1912
1931
1913
- ${NSD_CreateLabel} 0 54u 70u 24u " $(DLG_SUPERUSER)"
1932
+ ${NSD_CreateLabel} 0 59u 70u 24u " $(DLG_SUPERUSER)"
1914
1933
Pop $Label2
1915
1934
1916
1935
${NSD_CreateText} 72u 57u 100u 12u " $UserName_text"
@@ -1938,7 +1957,7 @@ Function nsDialogServer
1938
1957
${NSD_CreateCheckBox} 72u 120u 100 % 12u " $(DLG_ENVVAR)"
1939
1958
Pop $checkBoxEnvVar
1940
1959
${NSD_SetState} $checkBoxEnvVar $isEnvVar
1941
-
1960
+
1942
1961
GetFunctionAddress $0 getServerDataFromDlg
1943
1962
nsDialogs::OnBack $0
1944
1963
@@ -2048,6 +2067,11 @@ Function nsDialogOptimization
2048
2067
${NSD_SetState} $rButton1 ${BST_CHECKED}
2049
2068
${endif}
2050
2069
2070
+ ${NSD_CreateCheckBox} 20u 100u 100 % 12u " $(MORE_SHOW_MORE)"
2071
+ Pop $checkBoxMoreOptions
2072
+ ${NSD_SetState} $checkBoxMoreOptions $isShowMoreOptions
2073
+
2074
+
2051
2075
GetFunctionAddress $0 nsDialogsOptimizationPageLeave
2052
2076
nsDialogs::OnBack $0
2053
2077
@@ -2062,6 +2086,8 @@ Function nsDialogsOptimizationPageLeave
2062
2086
${else}
2063
2087
StrCpy $needOptimization " 0"
2064
2088
${endif}
2089
+
2090
+ ${NSD_GetState} $checkBoxMoreOptions $isShowMoreOptions
2065
2091
FunctionEnd
2066
2092
2067
2093
Function SetDefaultTcpPort
@@ -2105,9 +2131,11 @@ ${EndIf}
2105
2131
StrCpy $checkNoLocal_state ${BST_CHECKED}
2106
2132
StrCpy $isEnvVar ${BST_UNCHECKED} ; ${BST_CHECKED}
2107
2133
StrCpy $isDataChecksums ${BST_CHECKED} ; ${BST_CHECKED}
2108
-
2134
+ StrCpy $isShowMoreOptions ${BST_UNCHECKED} ; ${BST_CHECKED}
2109
2135
2110
2136
StrCpy $Coding_text " UTF8" ; "UTF-8"
2137
+
2138
+ StrCpy $Collation_text $(DEF_COLATE_NAME)
2111
2139
2112
2140
UserMgr::GetCurrentDomain
2113
2141
Pop $0
@@ -2309,3 +2337,73 @@ Function IsServerSection
2309
2337
FunctionEnd
2310
2338
2311
2339
2340
+ Function nsDialogMore
2341
+
2342
+ ${Unless} ${SectionIsSelected} ${sec1}
2343
+ Abort
2344
+ ${EndUnless}
2345
+
2346
+ ${if} $isShowMoreOptions != ${BST_CHECKED}
2347
+ Abort
2348
+ ${endif}
2349
+
2350
+ nsDialogs::Create 1018
2351
+ Pop $Dialog
2352
+
2353
+ ${If} $Dialog == error
2354
+ Abort
2355
+ ${EndIf}
2356
+
2357
+ # !define PG_DEF_SERVICEACCOUNT "NT AUTHORITY\NetworkService"
2358
+ # !define PG_DEF_SERVICEID "postgrespro-enterprise-X64-9.6"
2359
+ # isu
2360
+
2361
+ ${NSD_CreateGroupBox} 0 0 100 % 70u " $(MORE_SERVICE_TITLE)"
2362
+ Pop $0
2363
+
2364
+ ${NSD_CreateLabel} 10u 12u 120u 16u " $(MORE_WINUSER)"
2365
+ Pop $Label
2366
+
2367
+ ${NSD_CreateText} 130u 14u 160u 12u " $ServiceAccount_text"
2368
+ Pop $ServiceAccount_editor
2369
+
2370
+ ${NSD_CreateLabel} 10u 32u 120u 12u " $(MORE_WINPASS)"
2371
+ Pop $Label
2372
+
2373
+ ${NSD_CreatePassword} 130u 30u 160u 12u $servicePassword_text
2374
+ Pop $servicePassword_editor
2375
+
2376
+
2377
+ ${NSD_CreateLabel} 10u 52u 120u 16u " $(MORE_SERVICE_NAME)"
2378
+ Pop $Label
2379
+
2380
+ ${NSD_CreateText} 130u 50u 160u 12u " $ServiceID_text"
2381
+ Pop $ServiceID_editor
2382
+
2383
+
2384
+ ${if} ${PG_MAJOR_VERSION} >= " 10"
2385
+ ${NSD_CreateLabel} 10u 82u 120u 16u " $(MORE_COLATION)"
2386
+ Pop $Label
2387
+
2388
+ ${NSD_CreateDropList} 130u 80u 100u 12u " "
2389
+ Pop $Collation_editor
2390
+ ${NSD_CB_AddString} $Collation_editor " $(DEF_COLATE_NAME)"
2391
+ ${NSD_CB_AddString} $Collation_editor " icu"
2392
+ ${NSD_CB_AddString} $Collation_editor " libc"
2393
+ ${NSD_CB_SelectString} $Collation_editor $Collation_text
2394
+ ${endif}
2395
+
2396
+ nsDialogs::Show
2397
+
2398
+ FunctionEnd
2399
+
2400
+ Function nsDialogsMorePageLeave
2401
+ ${NSD_GetText} $ServiceAccount_editor $ServiceAccount_text
2402
+ ${NSD_GetText} $servicePassword_editor $servicePassword_text
2403
+ ${NSD_GetText} $ServiceID_editor $ServiceID_text
2404
+ ${if} ${PG_MAJOR_VERSION} >= " 10"
2405
+ ${NSD_GetText} $Collation_editor $Collation_text
2406
+ ${endif}
2407
+
2408
+
2409
+ FunctionEnd
0 commit comments