Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7d3d707

Browse files
committed
Begin add sections
1 parent9208b90 commit7d3d707

File tree

1 file changed

+177
-3
lines changed

1 file changed

+177
-3
lines changed

‎nsis/postgresql.nsi

Lines changed: 177 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ Var effective_cache_size
113113
; Set 'install service' variable
114114
;Var service
115115

116+
116117
;MUI_COMPONENTSPAGE_SMALLDESC or MUI_COMPONENTSPAGE_NODESC
117118
!define MUI_COMPONENTSPAGE_SMALLDESC
118119

@@ -150,6 +151,7 @@ PageEx directory
150151
DirText $(DATADIR_MESS) $(DATADIR_TITLE) $(BROWSE_BUTTON)
151152
PageExEnd
152153

154+
153155
Pagecustom ChecExistDataDir
154156

155157
Pagecustom nsDialogServer nsDialogsServerPageLeave
@@ -169,6 +171,7 @@ Page custom nsDialogOptimization nsDialogsOptimizationPageLeave
169171
!define MUI_WELCOMEPAGE_TITLE_3LINES
170172
!define MUI_FINISHPAGE_TITLE_3LINES
171173
!insertmacro MUI_UNPAGE_WELCOME
174+
;!insertmacro MUI_UNPAGE_COMPONENTS
172175
!insertmacro MUI_UNPAGE_CONFIRM
173176
!insertmacro MUI_UNPAGE_INSTFILES
174177
!insertmacro MUI_UNPAGE_FINISH
@@ -194,6 +197,85 @@ Section "Microsoft Visual C++ ${REDIST_YEAR} Redistributable" secMS
194197
Delete$1
195198
SectionEnd
196199

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+
MessageBoxMB_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+
WriteRegStrHKLM"${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$0HKCU"Console\SQL Shell (psql)""FaceName"
255+
${if}$0==""
256+
WriteRegStrHKCU"Console\SQL Shell (psql)""FaceName""Consolas"
257+
WriteRegDWORDHKCU"Console\SQL Shell (psql)""FontWeight""400"
258+
WriteRegDWORDHKCU"Console\SQL Shell (psql)""FontSize""917504"
259+
WriteRegDWORDHKCU"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+
197279
Section $(PostgreSQLString) sec1
198280

199281
${if}$PG_OLD_DIR!=""; exist PG install
@@ -216,8 +298,16 @@ Section $(PostgreSQLString) sec1
216298
${endif}
217299
${endif}
218300

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+
221311
File"License.txt"
222312
File"3rd_party_licenses.txt"
223313

@@ -670,6 +760,12 @@ Section $(PostgreSQLString) sec1
670760

671761
SectionEnd
672762

763+
764+
SectionGroupEnd
765+
766+
767+
768+
673769
;Uninstaller Section
674770
Section"Uninstall"
675771
Call un.ChecExistInstall
@@ -701,6 +797,10 @@ Section "Uninstall"
701797
RMDir/r"$INSTDIR\symbols"
702798
RMDir/r"$INSTDIR\StackBuilder"
703799
RMDir/r"$INSTDIR\scripts"
800+
801+
802+
803+
704804
RMDir"$INSTDIR"
705805

706806
Call un.DeleteInstallOptions
@@ -747,6 +847,48 @@ SectionEnd
747847
;!insertmacro MUI_DESCRIPTION_TEXT ${SecService} $(DESC_SecService)
748848
!insertmacro MUI_FUNCTION_DESCRIPTION_END
749849

850+
851+
Function writeUnistallReg
852+
WriteRegExpandStrHKLM"Software\Microsoft\Windows\CurrentVersion\Uninstall\${PG_DEF_BRANDING}""InstallLocation""$INSTDIR"
853+
WriteRegStrHKLM"Software\Microsoft\Windows\CurrentVersion\Uninstall\${PG_DEF_BRANDING}""DisplayName""$StartMenuFolder"
854+
WriteRegStrHKLM"Software\Microsoft\Windows\CurrentVersion\Uninstall\${PG_DEF_BRANDING}""UninstallString"'"$INSTDIR\Uninstall.exe"'
855+
WriteRegStrHKLM"Software\Microsoft\Windows\CurrentVersion\Uninstall\${PG_DEF_BRANDING}""DisplayVersion""${PG_DEF_VERSION}"
856+
WriteRegStrHKLM"Software\Microsoft\Windows\CurrentVersion\Uninstall\${PG_DEF_BRANDING}""Publisher""${PRODUCT_PUBLISHER}"
857+
WriteRegStrHKLM"Software\Microsoft\Windows\CurrentVersion\Uninstall\${PG_DEF_BRANDING}""HelpLink""${PRODUCT_WEB_SITE}"
858+
WriteRegStrHKLM"Software\Microsoft\Windows\CurrentVersion\Uninstall\${PG_DEF_BRANDING}""Comments""Packaged by PostgresPro.ru"
859+
WriteRegStrHKLM"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+
WriteRegDWORDHKLM"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 +20
889+
FileWrite$0'@echo off$\r$\n$Chcp_text$\r$\nPATH $INSTDIR\bin;%PATH%$\r$\nif not exist "%APPDATA%\postgresql" md "%APPDATA%\postgresql"$\r$\npsql.exe -h localhost -U "$UserName_text" -d postgres -p $TextPort_text$\r$\npause'
890+
FileClose$0
891+
FunctionEnd
750892
;check existing install
751893
;if exist then get install options to vars
752894
Function ChecExistInstall
@@ -985,7 +1127,10 @@ Function un.ChecExistInstall
9851127
ReadRegStr$ServiceID_textHKLM"${PG_REG_KEY}""Service ID"
9861128
ReadRegStr$UserName_textHKLM"${PG_REG_KEY}""Super User"
9871129
ReadRegStr$Branding_textHKLM"${PG_REG_KEY}""Branding"
1130+
1131+
9881132
${endif}
1133+
9891134
FunctionEnd
9901135

9911136
Function getServerDataFromDlg
@@ -1029,6 +1174,7 @@ FunctionEnd
10291174
;say that PG is exist
10301175
Function nsDialogServerExist
10311176
${Unless}${SectionIsSelected}${sec1}
1177+
${AndUnless}${SectionIsSelected}${secClient}
10321178
Abort
10331179
${EndUnless}
10341180
${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
17871933
Abort
17881934
${EndIf}
17891935
!endif
1936+
IntOp$3${SF_SELECTED} |${SF_RO}
1937+
SectionSetFlags${secClient}$3
1938+
;SectionSetFlags ${secClient} ${SF_RO}
17901939

17911940
!insertmacro MUI_LANGDLL_DISPLAY;select language
17921941
StrCpy$PG_OLD_DIR""
17931942
StrCpy$DATA_DIR"$INSTDIR\data"
17941943
StrCpy$OLD_DATA_DIR""
1795-
1944+
17961945
StrCpy$UserName_text"${PG_DEF_SUPERUSER}"
17971946

17981947
StrCpy$ServiceAccount_text"${PG_DEF_SERVICEACCOUNT}"
@@ -1924,8 +2073,14 @@ Function func1
19242073
is5:
19252074
FunctionEnd
19262075

2076+
19272077
Function dirPre
2078+
;${if} ${SectionIsSelected} ${secClient}
2079+
; return
2080+
;${endif}
2081+
19282082
${Unless}${SectionIsSelected}${sec1}
2083+
${AndUnless}${SectionIsSelected}${secClient}
19292084
Abort
19302085
${EndUnless}
19312086
${if}$PG_OLD_DIR!="";exist PG install
@@ -1941,3 +2096,22 @@ Function CheckWindowsVersion
19412096
${EndUnless}
19422097
${EndIf}
19432098
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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp