3170
by Stephane Wirtel
[REF] Detect if there is an installation of PostgreSQL and propose a |
1 |
#####################################################################################
|
2 |
#
|
|
3 |
# Copyright (c) 2004-TODAY OpenERP S.A. (http://www.openerp.com) All Rights Reserved.
|
|
4 |
#
|
|
5 |
# WARNING: This program as such is intended to be used by professional
|
|
6 |
# programmers who take the whole responsability of assessing all potential
|
|
7 |
# consequences resulting from its eventual inadequacies and bugs
|
|
8 |
# End users who are looking for a ready-to-use solution with commercial
|
|
9 |
# garantees and support are strongly adviced to contract a Free Software
|
|
10 |
# Service Company
|
|
11 |
#
|
|
12 |
# This program is Free Software; you can redistribute it and/or
|
|
13 |
# modify it under the terms of the GNU General Public License
|
|
14 |
# as published by the Free Software Foundation; either version 3
|
|
15 |
# of the License, or (at your option) any later version.
|
|
16 |
#
|
|
17 |
# This program is distributed in the hope that it will be useful,
|
|
18 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
19 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
20 |
# GNU General Public License for more details.
|
|
21 |
#
|
|
22 |
# You should have received a copy of the GNU General Public License
|
|
23 |
# along with this program; if not, write to the Free Software
|
|
24 |
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
25 |
#####################################################################################
|
|
26 |
||
27 |
!include 'MUI2.nsh' |
|
28 |
!include 'FileFunc.nsh' |
|
29 |
!include 'LogicLib.nsh' |
|
30 |
!include 'Sections.nsh' |
|
31 |
||
32 |
!define PUBLISHER 'OpenERP S.A.' |
|
3189
by Stephane Wirtel
[FIX] Add new parameters in the setup.nsi |
33 |
|
3894
by Antony Lesuisse
[IMP] nsi version simplification |
34 |
!ifndef VERSION
|
35 |
!define VERSION '0' |
|
36 |
!endif
|
|
37 |
#!define VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${REVISION_VERSION}"
|
|
3189
by Stephane Wirtel
[FIX] Add new parameters in the setup.nsi |
38 |
|
3170
by Stephane Wirtel
[REF] Detect if there is an installation of PostgreSQL and propose a |
39 |
!define PRODUCT_NAME "OpenERP Server" |
3894
by Antony Lesuisse
[IMP] nsi version simplification |
40 |
!define DISPLAY_NAME "${PRODUCT_NAME} ${VERSION}" |
3170
by Stephane Wirtel
[REF] Detect if there is an installation of PostgreSQL and propose a |
41 |
|
42 |
!define UNINSTALL_REGISTRY_ROOT HKLM |
|
43 |
!define UNINSTALL_REGISTRY_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${DISPLAY_NAME}" |
|
44 |
||
45 |
!define REGISTRY_KEY "Software\${DISPLAY_NAME}" |
|
46 |
||
47 |
!define DEFAULT_POSTGRESQL_HOSTNAME 'localhost' |
|
48 |
!define DEFAULT_POSTGRESQL_PORT 5432
|
|
49 |
!define DEFAULT_POSTGRESQL_USERNAME 'openpg' |
|
50 |
!define DEFAULT_POSTGRESQL_PASSWORD 'openpgpwd' |
|
51 |
||
52 |
Name '${DISPLAY_NAME}' |
|
53 |
Caption "${PRODUCT_NAME} ${VERSION} Setup" |
|
54 |
OutFile "openerp-server-setup-${VERSION}.exe" |
|
55 |
SetCompressor /final /solid lzma |
|
56 |
SetCompress auto |
|
57 |
ShowInstDetails show |
|
58 |
||
59 |
XPStyle on |
|
60 |
||
3901
by Vo Minh Thu
[FIX] windows packaging: postgresql and the server are side-by-side. |
61 |
InstallDir "$PROGRAMFILES\OpenERP ${VERSION}" |
3170
by Stephane Wirtel
[REF] Detect if there is an installation of PostgreSQL and propose a |
62 |
InstallDirRegKey HKCU "${REGISTRY_KEY}" "" |
63 |
||
64 |
BrandingText '${PRODUCT_NAME} ${VERSION}' |
|
65 |
||
66 |
RequestExecutionLevel admin |
|
67 |
||
3189
by Stephane Wirtel
[FIX] Add new parameters in the setup.nsi |
68 |
#VIAddVersionKey "ProductName" "${PRODUCT_NAME}"
|
69 |
#VIAddVersionKey "CompanyName" "${PUBLISHER}"
|
|
70 |
#VIAddVersionKey "FileDescription" "Installer of ${DISPLAY_NAME}"
|
|
71 |
#VIAddVersionKey "LegalCopyright" "${PUBLISHER}"
|
|
72 |
#VIAddVersionKey "LegalTrademark" "OpenERP is a trademark of ${PUBLISHER}"
|
|
73 |
#VIAddVersionKey "FileVersion" "${MAJOR_VERSION}.${MINOR_VERSION}.${REVISION_VERSION}"
|
|
74 |
#VIProductVersion "${MAJOR_VERSION}.${MINOR_VERSION}.${REVISION_VERSION}"
|
|
3170
by Stephane Wirtel
[REF] Detect if there is an installation of PostgreSQL and propose a |
75 |
|
76 |
!insertmacro GetParameters
|
|
77 |
!insertmacro GetOptions
|
|
78 |
||
79 |
Var Option_AllInOne
|
|
80 |
Var HasPostgreSQL
|
|
81 |
Var cmdLineParams
|
|
82 |
||
83 |
Var TextPostgreSQLHostname
|
|
84 |
Var TextPostgreSQLPort
|
|
85 |
Var TextPostgreSQLUsername
|
|
86 |
Var TextPostgreSQLPassword
|
|
87 |
||
88 |
Var HWNDPostgreSQLHostname
|
|
89 |
Var HWNDPostgreSQLPort
|
|
90 |
Var HWNDPostgreSQLUsername
|
|
91 |
Var HWNDPostgreSQLPassword
|
|
92 |
||
93 |
Var MUI_TEMP
|
|
94 |
Var STARTMENU_FOLDER
|
|
95 |
||
96 |
!define MUI_ABORTWARNING
|
|
3893
by Vo Minh Thu
[FIX] packaging: some changes for windows packaging. |
97 |
!define MUI_ICON ".\install\openerp-icon.ico" |
3170
by Stephane Wirtel
[REF] Detect if there is an installation of PostgreSQL and propose a |
98 |
|
3893
by Vo Minh Thu
[FIX] packaging: some changes for windows packaging. |
99 |
!define MUI_WELCOMEFINISHPAGE_BITMAP ".\install\openerp-intro.bmp" |
100 |
!define MUI_UNWELCOMEFINISHPAGE_BITMAP ".\install\openerp-intro.bmp" |
|
3170
by Stephane Wirtel
[REF] Detect if there is an installation of PostgreSQL and propose a |
101 |
!define MUI_HEADERIMAGE
|
3893
by Vo Minh Thu
[FIX] packaging: some changes for windows packaging. |
102 |
!define MUI_HEADERIMAGE_BITMAP ".\install\openerp-slogan.bmp" |
3170
by Stephane Wirtel
[REF] Detect if there is an installation of PostgreSQL and propose a |
103 |
!define MUI_HEADERIMAGE_BITMAP_NOSTRETCH
|
104 |
!define MUI_HEADER_TRANSPARENT_TEXT "" |
|
105 |
||
106 |
!insertmacro MUI_PAGE_WELCOME
|
|
3310.1.60
by Julien Thewys
[FIX] win32 build script works again (fixes lp:735554) |
107 |
!insertmacro MUI_PAGE_LICENSE ".\LICENSE" |
3170
by Stephane Wirtel
[REF] Detect if there is an installation of PostgreSQL and propose a |
108 |
!define MUI_COMPONENTSPAGE_SMALLDESC
|
109 |
!insertmacro MUI_PAGE_DIRECTORY
|
|
110 |
Page Custom ShowPostgreSQL LeavePostgreSQL
|
|
111 |
||
112 |
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM" |
|
113 |
!define MUI_STARTMENUPAGE_REGISTRY_KEY "${REGISTRY_KEY}" |
|
114 |
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${DISPLAY_NAME}" |
|
115 |
||
116 |
!insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER |
|
117 |
!insertmacro MUI_PAGE_INSTFILES
|
|
118 |
||
119 |
!define MUI_FINISHPAGE_NOAUTOCLOSE
|
|
120 |
!define MUI_FINISHPAGE_LINK $(DESC_FinishPage_Link)
|
|
121 |
!define MUI_FINISHPAGE_LINK_LOCATION "http://www.openerp.com/contact" |
|
122 |
!insertmacro MUI_PAGE_FINISH
|
|
123 |
||
124 |
!insertmacro MUI_UNPAGE_WELCOME
|
|
125 |
!insertmacro MUI_UNPAGE_CONFIRM
|
|
126 |
!insertmacro MUI_UNPAGE_INSTFILES
|
|
127 |
!insertmacro MUI_UNPAGE_FINISH
|
|
128 |
||
129 |
!insertmacro MUI_LANGUAGE "English" |
|
130 |
!insertmacro MUI_LANGUAGE "French" |
|
131 |
!insertmacro MUI_RESERVEFILE_LANGDLL
|
|
132 |
||
133 |
!macro CreateInternetShortcut FILENAME URL
|
|
134 |
WriteINIStr "${FILENAME}.url" "InternetShortcut" "URL" "${URL}" |
|
135 |
!macroend
|
|
136 |
||
137 |
; English
|
|
138 |
LangString DESC_FinishPage_Link ${LANG_ENGLISH} "Contact OpenERP for Partnership and/or Support" |
|
139 |
LangString WARNING_HostNameIsEmpty ${LANG_ENGLISH} "The hostname for the connection to the PostgreSQL Server is empty" |
|
140 |
LangString WARNING_UserNameIsEmpty ${LANG_ENGLISH} "The username for the connection to the PostgreSQL Server is empty" |
|
141 |
LangString WARNING_PasswordIsEmpty ${LANG_ENGLISH} "The password for the connection to the PostgreSQL Server is empty" |
|
142 |
LangString WARNING_PortIsWrong ${LANG_ENGLISH} "The port for the connexion to the PostgreSQL Server is wrong (default: 5432)" |
|
143 |
LangString DESC_PostgreSQLPage ${LANG_ENGLISH} "Configure the information for the PostgreSQL connection" |
|
144 |
LangString DESC_PostgreSQL_Hostname ${LANG_ENGLISH} "Hostname" |
|
145 |
LangString DESC_PostgreSQL_Port ${LANG_ENGLISH} "Port" |
|
146 |
LangString DESC_PostgreSQL_Username ${LANG_ENGLISH} "Username" |
|
147 |
LangString DESC_PostgreSQL_Password ${LANG_ENGLISH} "Password" |
|
148 |
||
149 |
||
150 |
; French
|
|
151 |
LangString DESC_FinishPage_Link ${LANG_FRENCH} "Contactez OpenERP pour un Partenariat et/ou du Support" |
|
152 |
LangString WARNING_HostNameIsEmpty ${LANG_FRENCH} "L'adresse pour la connection au serveur PostgreSQL est vide" |
|
153 |
LangString WARNING_UserNameIsEmpty ${LANG_FRENCH} "Le nom d'utilisateur pour la connection au serveur PostgreSQL est vide" |
|
154 |
LangString WARNING_PasswordIsEmpty ${LANG_FRENCH} "Le mot de passe pour la connection au serveur PostgreSQL est vide" |
|
3894
by Antony Lesuisse
[IMP] nsi version simplification |
155 |
LangString WARNING_PortIsWrong ${LANG_FRENCH} "Le port pour la connection au serveur PostgreSQL est erron? (d?faut: 5432)" |
3170
by Stephane Wirtel
[REF] Detect if there is an installation of PostgreSQL and propose a |
156 |
LangString DESC_PostgreSQLPage ${LANG_FRENCH} "Configurez les informations de connection pour le serveur PostgreSQL" |
3894
by Antony Lesuisse
[IMP] nsi version simplification |
157 |
LangString DESC_PostgreSQL_Hostname ${LANG_FRENCH} "H?te" |
3170
by Stephane Wirtel
[REF] Detect if there is an installation of PostgreSQL and propose a |
158 |
LangString DESC_PostgreSQL_Port ${LANG_FRENCH} "Port" |
159 |
LangString DESC_PostgreSQL_Username ${LANG_FRENCH} "Utilisateur" |
|
160 |
LangString DESC_PostgreSQL_Password ${LANG_FRENCH} "Mot de passe" |
|
161 |
||
162 |
Section -StopService |
|
3907
by Stephane Wirtel
[FIX] Set the right directory in the service, set the right version |
163 |
nsExec::Exec "net stop openerp-server-6.1" |
3170
by Stephane Wirtel
[REF] Detect if there is an installation of PostgreSQL and propose a |
164 |
sleep 2
|
165 |
SectionEnd
|
|
166 |
||
167 |
Section OpenERP_Server SectionOpenERP_Server
|
|
3901
by Vo Minh Thu
[FIX] windows packaging: postgresql and the server are side-by-side. |
168 |
SetOutPath '$INSTDIR\server' |
3170
by Stephane Wirtel
[REF] Detect if there is an installation of PostgreSQL and propose a |
169 |
|
170 |
File /r "dist\*" |
|
4040.1.1
by Stephane Wirtel
[FIX] setup.nsi: Integrate WebKitHtmlToPDF |
171 |
File /r "win32\wkhtmltopdf\*" |
3170
by Stephane Wirtel
[REF] Detect if there is an installation of PostgreSQL and propose a |
172 |
|
173 |
SetOutPath "$INSTDIR\service" |
|
174 |
File /r "win32\dist\*" |
|
175 |
File "win32\start.bat" |
|
176 |
File "win32\stop.bat" |
|
177 |
||
178 |
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
|
|
179 |
;Create shortcuts
|
|
180 |
CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER" |
|
3907
by Stephane Wirtel
[FIX] Set the right directory in the service, set the right version |
181 |
!insertmacro CreateInternetShortcut "$SMPROGRAMS\$STARTMENU_FOLDER\OpenERP" "http://localhost:8069/" |
3170
by Stephane Wirtel
[REF] Detect if there is an installation of PostgreSQL and propose a |
182 |
!insertmacro MUI_STARTMENU_WRITE_END
|
183 |
||
184 |
||
185 |
FileOpen $9 '$INSTDIR\install.log' w |
|
3913
by Stephane Wirtel
[FIX] Fix the uninstaller path |
186 |
FileWrite $9 "INSTDIR $INSTDIR$\r$\n" |
3170
by Stephane Wirtel
[REF] Detect if there is an installation of PostgreSQL and propose a |
187 |
FileWrite $9 "Hostname $TextPostgreSQLHostname$\r$\n" |
188 |
FileWrite $9 "Port $TextPostgreSQLPort$\r$\n" |
|
189 |
FileWrite $9 "Username $TextPostgreSQLUsername$\r$\n" |
|
190 |
FileWrite $9 "Password $TextPostgreSQLPassword$\r$\n" |
|
191 |
FileClose $9 |
|
192 |
||
193 |
# If there is a previous install of the OpenERP Server, keep the login/password from the config file
|
|
3901
by Vo Minh Thu
[FIX] windows packaging: postgresql and the server are side-by-side. |
194 |
WriteIniStr "$INSTDIR\server\openerp-server.conf" "options" "db_host" $TextPostgreSQLHostname |
195 |
WriteIniStr "$INSTDIR\server\openerp-server.conf" "options" "db_user" $TextPostgreSQLUsername |
|
196 |
WriteIniStr "$INSTDIR\server\openerp-server.conf" "options" "db_password" $TextPostgreSQLPassword |
|
197 |
WriteIniStr "$INSTDIR\server\openerp-server.conf" "options" "db_port" $TextPostgreSQLPort |
|
198 |
WriteIniStr "$INSTDIR\server\openerp-server.conf" "options" "pg_path" "$INSTDIR\PostgreSQL\bin" |
|
3170
by Stephane Wirtel
[REF] Detect if there is an installation of PostgreSQL and propose a |
199 |
|
3901
by Vo Minh Thu
[FIX] windows packaging: postgresql and the server are side-by-side. |
200 |
nsExec::Exec '"$INSTDIR\server\openerp-server.exe" --stop-after-init --logfile "$INSTDIR\server\openerp-server.log" -s' |
3170
by Stephane Wirtel
[REF] Detect if there is an installation of PostgreSQL and propose a |
201 |
nsExec::Exec '"$INSTDIR\service\OpenERPServerService.exe" -auto -install' |
202 |
SectionEnd
|
|
203 |
||
204 |
Section -RestartServer |
|
3907
by Stephane Wirtel
[FIX] Set the right directory in the service, set the right version |
205 |
nsExec::Exec "net start openerp-server-6.1" |
3170
by Stephane Wirtel
[REF] Detect if there is an installation of PostgreSQL and propose a |
206 |
sleep 2
|
207 |
SectionEnd
|
|
208 |
||
209 |
Section -Post |
|
3913
by Stephane Wirtel
[FIX] Fix the uninstaller path |
210 |
WriteRegExpandStr HKLM "${UNINSTALL_REGISTRY_KEY}" "UninstallString" "$INSTDIR\server\Uninstall.exe" |
3170
by Stephane Wirtel
[REF] Detect if there is an installation of PostgreSQL and propose a |
211 |
WriteRegExpandStr HKLM "${UNINSTALL_REGISTRY_KEY}" "InstallLocation" "$INSTDIR" |
212 |
WriteRegStr HKLM "${UNINSTALL_REGISTRY_KEY}" "DisplayName" "${DISPLAY_NAME}" |
|
3894
by Antony Lesuisse
[IMP] nsi version simplification |
213 |
WriteRegStr HKLM "${UNINSTALL_REGISTRY_KEY}" "DisplayVersion" "${VERSION}" |
3170
by Stephane Wirtel
[REF] Detect if there is an installation of PostgreSQL and propose a |
214 |
WriteRegStr HKLM "${UNINSTALL_REGISTRY_KEY}" "Publisher" "${PUBLISHER}" |
3894
by Antony Lesuisse
[IMP] nsi version simplification |
215 |
; WriteRegDWORD HKLM "${UNINSTALL_REGISTRY_KEY}" "Version" "${VERSION}"
|
216 |
; WriteRegDWORD HKLM "${UNINSTALL_REGISTRY_KEY}" "VersionMajor" "${MAJOR_VERSION}.${MINOR_VERSION}"
|
|
217 |
; WriteRegDWORD HKLM "${UNINSTALL_REGISTRY_KEY}" "VersionMinor" "${REVISION_VERSION}"
|
|
3907
by Stephane Wirtel
[FIX] Set the right directory in the service, set the right version |
218 |
WriteRegStr HKLM "${UNINSTALL_REGISTRY_KEY}" "HelpLink" "support@openerp.com" |
219 |
WriteRegStr HKLM "${UNINSTALL_REGISTRY_KEY}" "HelpTelephone" "+32.81.81.37.00" |
|
220 |
WriteRegStr HKLM "${UNINSTALL_REGISTRY_KEY}" "URLInfoAbout" "http://www.openerp.com" |
|
221 |
WriteRegStr HKLM "${UNINSTALL_REGISTRY_KEY}" "Contact" "sales@openerp.com" |
|
3170
by Stephane Wirtel
[REF] Detect if there is an installation of PostgreSQL and propose a |
222 |
WriteRegDWORD HKLM "${UNINSTALL_REGISTRY_KEY}" "NoModify" "1" |
223 |
WriteRegDWORD HKLM "${UNINSTALL_REGISTRY_KEY}" "NoRepair" "1" |
|
3913
by Stephane Wirtel
[FIX] Fix the uninstaller path |
224 |
WriteUninstaller "$INSTDIR\server\Uninstall.exe" |
3170
by Stephane Wirtel
[REF] Detect if there is an installation of PostgreSQL and propose a |
225 |
SectionEnd
|
226 |
||
227 |
Section "Uninstall" |
|
228 |
; Stop the NT Service
|
|
3907
by Stephane Wirtel
[FIX] Set the right directory in the service, set the right version |
229 |
nsExec::Exec "net stop openerp-server-6.1" |
3170
by Stephane Wirtel
[REF] Detect if there is an installation of PostgreSQL and propose a |
230 |
sleep 2
|
231 |
||
232 |
; Uninstall the OpenERP Service
|
|
3946
by Stephane Wirtel
[FIX] setup.nsi set the right path for the nt service |
233 |
nsExec::Exec '"$INSTDIR\..\service\OpenERPServerService.exe" -remove' |
3170
by Stephane Wirtel
[REF] Detect if there is an installation of PostgreSQL and propose a |
234 |
sleep 2
|
235 |
||
3913
by Stephane Wirtel
[FIX] Fix the uninstaller path |
236 |
Rmdir /r "$INSTDIR\service" |
237 |
Rmdir /r "$INSTDIR\server" |
|
3170
by Stephane Wirtel
[REF] Detect if there is an installation of PostgreSQL and propose a |
238 |
|
239 |
!insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP |
|
240 |
||
3913
by Stephane Wirtel
[FIX] Fix the uninstaller path |
241 |
Delete "$SMPROGRAMS\$MUI_TEMP\OpenERP.url" |
3170
by Stephane Wirtel
[REF] Detect if there is an installation of PostgreSQL and propose a |
242 |
;
|
243 |
;Delete empty start menu parent diretories
|
|
244 |
StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP" |
|
245 |
||
246 |
startMenuDeleteLoop: |
|
247 |
ClearErrors
|
|
248 |
RMDir $MUI_TEMP |
|
249 |
GetFullPathName $MUI_TEMP "$MUI_TEMP\.." |
|
250 |
||
251 |
IfErrors startMenuDeleteLoopDone
|
|
252 |
||
253 |
StrCmp $MUI_TEMP $SMPROGRAMS startMenuDeleteLoopDone startMenuDeleteLoop |
|
254 |
||
255 |
startMenuDeleteLoopDone: |
|
256 |
||
257 |
; Clean the Registry
|
|
258 |
DeleteRegKey HKLM "${UNINSTALL_REGISTRY_KEY}" |
|
259 |
SectionEnd
|
|
260 |
||
261 |
Function .onInit |
|
262 |
Push $R0 |
|
263 |
||
264 |
${GetParameters} $cmdLineParams |
|
265 |
ClearErrors
|
|
266 |
||
267 |
Pop $R0 |
|
268 |
||
269 |
StrCpy $Option_AllInOne 0 |
|
270 |
StrCpy $HasPostgreSQL 0 |
|
271 |
||
272 |
StrCpy $TextPostgreSQLHostname ${DEFAULT_POSTGRESQL_HOSTNAME} |
|
273 |
StrCpy $TextPostgreSQLPort ${DEFAULT_POSTGRESQL_PORT} |
|
274 |
StrCpy $TextPostgreSQLUsername ${DEFAULT_POSTGRESQL_USERNAME} |
|
275 |
StrCpy $TextPostgreSQLPassword ${DEFAULT_POSTGRESQL_PASSWORD} |
|
276 |
||
277 |
Push $R0 |
|
278 |
${GetOptions} $cmdLineParams '/allinone' $R0 |
|
279 |
IfErrors +2 0 |
|
280 |
StrCpy $Option_AllInOne 1 |
|
281 |
Pop $R0 |
|
282 |
||
283 |
StrCmp $Option_AllInOne 1 AllInOneMode |
|
284 |
StrCmp $Option_AllInOne 0 NoAllInOneMode |
|
285 |
||
286 |
AllInOneMode: |
|
287 |
MessageBox MB_OK|MB_ICONINFORMATION "All In One" |
|
288 |
||
289 |
NoAllInOneMode: |
|
290 |
||
291 |
!insertmacro MUI_LANGDLL_DISPLAY
|
|
292 |
||
293 |
ClearErrors
|
|
294 |
EnumRegKey $0 HKLM "SOFTWARE\PostgreSQL" 0 |
|
295 |
IfErrors DoInstallPostgreSQL 0
|
|
296 |
StrCpy $HasPostgreSQL 1 |
|
297 |
||
298 |
DoInstallPostgreSQL: |
|
299 |
FunctionEnd
|
|
300 |
||
301 |
Function PostgreSQLOnBack |
|
302 |
FunctionEnd
|
|
303 |
||
304 |
Function ShowPostgreSQL |
|
305 |
SectionGetFlags ${SectionOpenERP_Server} $0 |
|
306 |
IntOp $0 $0 & ${SF_SELECTED} |
|
307 |
IntCmp $0 ${SF_SELECTED} LaunchPostgreSQLConfiguration |
|
308 |
Abort
|
|
309 |
LaunchPostgreSQLConfiguration: |
|
310 |
||
311 |
nsDialogs::Create /NOUNLOAD 1018 |
|
312 |
Pop $0 |
|
313 |
||
314 |
${If} $0 == error |
|
315 |
Abort
|
|
316 |
${EndIf}
|
|
317 |
||
318 |
GetFunctionAddress $0 PostgreSQLOnBack |
|
319 |
nsDialogs::OnBack $0 |
|
320 |
||
321 |
${NSD_CreateLabel} 0 0 100% 10u $(DESC_PostgreSQLPage)
|
|
322 |
Pop $0 |
|
323 |
||
324 |
${NSD_CreateLabel} 0 45 60u 12u $(DESC_PostgreSQL_Hostname)
|
|
325 |
Pop $0 |
|
326 |
${NSD_CreateText} 100 45 150u 12u $TextPostgreSQLHostname |
|
327 |
Pop $HWNDPostgreSQLHostname |
|
328 |
||
329 |
${NSD_CreateLabel} 0 75 60u 12u $(DESC_PostgreSQL_Port)
|
|
330 |
Pop $0 |
|
331 |
${NSD_CreateNumber} 100 75 150u 12u $TextPostgreSQLPort |
|
332 |
Pop $HWNDPostgreSQLPort |
|
333 |
${NSD_CreateLabel} 0 105 60u 12u $(DESC_PostgreSQL_Username)
|
|
334 |
Pop $0 |
|
335 |
${NSD_CreateText} 100 105 150u 12u $TextPostgreSQLUsername |
|
336 |
Pop $HWNDPostgreSQLUsername |
|
337 |
${NSD_CreateLabel} 0 135 60u 12u $(DESC_PostgreSQL_Password)
|
|
338 |
Pop $0 |
|
339 |
${NSD_CreateText} 100 135 150u 12u $TextPostgreSQLPassword |
|
340 |
Pop $HWNDPostgreSQLPassword |
|
341 |
||
342 |
nsDialogs::Show |
|
343 |
FunctionEnd
|
|
344 |
||
345 |
Function LeavePostgreSQL |
|
346 |
# Before to leave the PostgreSQL configuration screen, we check the values
|
|
347 |
# from the inputs, to be sure we have the right values
|
|
348 |
||
349 |
${NSD_GetText} $HWNDPostgreSQLHostname $TextPostgreSQLHostname |
|
350 |
${NSD_GetText} $HWNDPostgreSQLPort $TextPostgreSQLPort |
|
351 |
${NSD_GetText} $HWNDPostgreSQLUsername $TextPostgreSQLUsername |
|
352 |
${NSD_GetText} $HWNDPostgreSQLPassword $TextPostgreSQLPassword |
|
353 |
||
354 |
StrLen $1 $TextPostgreSQLHostname |
|
355 |
${If} $1 == 0 |
|
356 |
MessageBox MB_ICONEXCLAMATION|MB_OK $(WARNING_HostNameIsEmpty) |
|
357 |
Abort
|
|
358 |
${EndIf}
|
|
359 |
||
360 |
${If} $TextPostgreSQLPort <= 0 |
|
361 |
${OrIf} $TextPostgreSQLPort > 65535 |
|
362 |
MessageBox MB_ICONEXCLAMATION|MB_OK $(WARNING_PortIsWrong) |
|
363 |
Abort
|
|
364 |
${EndIf}
|
|
365 |
||
366 |
StrLen $1 $TextPostgreSQLUsername |
|
367 |
${If} $1 == 0 |
|
368 |
MessageBox MB_ICONEXCLAMATION|MB_OK $(WARNING_UserNameIsEmpty) |
|
369 |
Abort
|
|
370 |
${EndIf}
|
|
371 |
||
372 |
StrLen $1 $TextPostgreSQLPassword |
|
373 |
${If} $1 == 0 |
|
374 |
MessageBox MB_ICONEXCLAMATION|MB_OK $(WARNING_PasswordIsEmpty) |
|
375 |
Abort
|
|
376 |
${EndIf}
|
|
377 |
FunctionEnd
|
|
378 |