1# Part of Odoo. See LICENSE file for full copyright and licensing details.
2
3# TODO: Avoid to uninstall the database
4# TODO: We can update the server or the clients without to uninstall the all-in-one
5# TODO: Add startmenu handling (link to localhost + uninstall)
6
7Unicode True
8
9!include 'MUI2.nsh'
10!include 'FileFunc.nsh'
11!include 'LogicLib.nsh'
12!include 'Sections.nsh'
13!include 'x64.nsh'
14
15!macro IfKeyExists ROOT MAIN_KEY KEY
16    # This macro comes from http://nsis.sourceforge.net/Check_for_a_Registry_Key
17    Push $R0
18    Push $R1
19    Push $R2
20
21    # XXX bug if ${ROOT}, ${MAIN_KEY} or ${KEY} use $R0 or $R1
22
23    StrCpy $R1 "0" # loop index
24    StrCpy $R2 "0" # not found
25
26    ${Do}
27        EnumRegKey $R0 ${ROOT} "${MAIN_KEY}" "$R1"
28        ${If} $R0 == "${KEY}"
29            StrCpy $R2 "1" # found
30            ${Break}
31        ${EndIf}
32        IntOp $R1 $R1 + 1
33    ${LoopWhile} $R0 != ""
34
35    ClearErrors
36
37    Exch 2
38    Pop $R0
39    Pop $R1
40    Exch $R2
41!macroend
42
43!define PUBLISHER 'Odoo S.A.'
44
45!ifndef MAJOR_VERSION
46    !define MAJOR_VERSION '14'
47!endif
48
49!ifndef MINOR_VERSION
50    !define MINOR_VERSION '0'
51!endif
52
53!ifndef REVISION_VERSION
54    !define REVISION_VERSION 'alpha1'
55!endif
56
57!ifndef VERSION
58    !define VERSION "${MAJOR_VERSION}.${MINOR_VERSION}"
59!endif
60
61!ifndef PYTHONVERSION
62	!define PYTHONVERSION '3.7.4'
63!endif
64
65!ifndef SERVICENAME
66	!define SERVICENAME 'odoo-server-${VERSION}'
67!endif
68
69!ifndef TOOLSDIR
70	!define TOOLSDIR 'c:\odoobuild'
71!endif
72
73!define PRODUCT_NAME "Odoo"
74!define DISPLAY_NAME "${PRODUCT_NAME} ${MAJOR_VERSION}.${MINOR_VERSION}"
75
76!define UNINSTALL_BASE_REGISTRY_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall"
77!define UNINSTALL_REGISTRY_KEY "${UNINSTALL_BASE_REGISTRY_KEY}\${DISPLAY_NAME}"
78
79!define UNINSTALL_REGISTRY_KEY_SERVER "${UNINSTALL_BASE_REGISTRY_KEY}\Odoo Server ${VERSION}"
80
81!define REGISTRY_KEY "SOFTWARE\${DISPLAY_NAME}"
82
83!define DEFAULT_POSTGRESQL_HOSTNAME 'localhost'
84!define DEFAULT_POSTGRESQL_PORT 5432
85!define DEFAULT_POSTGRESQL_USERNAME 'openpg'
86!define DEFAULT_POSTGRESQL_PASSWORD 'openpgpwd'
87
88Name '${DISPLAY_NAME}'
89Caption "${PRODUCT_NAME} ${VERSION} Setup"
90OutFile "odoo_setup_${VERSION}.exe"
91SetCompressor /FINAL lzma
92ShowInstDetails show
93
94BrandingText '${PRODUCT_NAME} ${VERSION}'
95
96RequestExecutionLevel admin
97
98!insertmacro GetParameters
99!insertmacro GetOptions
100
101Var Option_AllInOne
102Var HasPostgreSQL
103Var cmdLineParams
104
105Var TextPostgreSQLHostname
106Var TextPostgreSQLPort
107Var TextPostgreSQLUsername
108Var TextPostgreSQLPassword
109
110Var HWNDPostgreSQLHostname
111Var HWNDPostgreSQLPort
112Var HWNDPostgreSQLUsername
113Var HWNDPostgreSQLPassword
114
115!define STATIC_PATH "static"
116!define PIXMAPS_PATH "${STATIC_PATH}\pixmaps"
117
118!define MUI_ABORTWARNING
119!define MUI_ICON "${PIXMAPS_PATH}\odoo-icon.ico"
120
121!define MUI_WELCOMEFINISHPAGE_BITMAP "${PIXMAPS_PATH}\odoo-intro.bmp"
122!define MUI_UNWELCOMEFINISHPAGE_BITMAP "${PIXMAPS_PATH}\odoo-intro.bmp"
123!define MUI_HEADERIMAGE
124!define MUI_HEADERIMAGE_BITMAP "${PIXMAPS_PATH}\odoo-slogan.bmp"
125!define MUI_HEADERIMAGE_BITMAP_NOSTRETCH
126!define MUI_HEADER_TRANSPARENT_TEXT ""
127
128!insertmacro MUI_PAGE_WELCOME
129!insertmacro MUI_PAGE_LICENSE "${STATIC_PATH}\doc\LICENSE"
130!define MUI_COMPONENTSPAGE_SMALLDESC
131!define MUI_PAGE_CUSTOMFUNCTION_LEAVE ComponentLeave
132!insertmacro MUI_PAGE_COMPONENTS
133Page Custom ShowPostgreSQL LeavePostgreSQL
134!insertmacro MUI_PAGE_DIRECTORY
135!insertmacro MUI_PAGE_INSTFILES
136
137!define MUI_FINISHPAGE_NOAUTOCLOSE
138!define MUI_FINISHPAGE_RUN
139!define MUI_FINISHPAGE_RUN_CHECKED
140!define MUI_FINISHPAGE_RUN_TEXT "$(DESC_FinishPageText)"
141!define MUI_FINISHPAGE_RUN_FUNCTION "LaunchLink"
142!define MUI_FINISHPAGE_LINK $(DESC_FinishPage_Link)
143!define MUI_FINISHPAGE_LINK_LOCATION "https://www.odoo.com/page/contactus"
144!insertmacro MUI_PAGE_FINISH
145
146!insertmacro MUI_UNPAGE_WELCOME
147!insertmacro MUI_UNPAGE_CONFIRM
148!insertmacro MUI_UNPAGE_INSTFILES
149!insertmacro MUI_UNPAGE_FINISH
150
151!insertmacro MUI_LANGUAGE "English"
152!insertmacro MUI_LANGUAGE "French"
153!insertmacro MUI_RESERVEFILE_LANGDLL
154
155; English
156LangString DESC_Odoo_Server ${LANG_ENGLISH} "Install the Odoo Server with all the Odoo standard modules."
157LangString DESC_PostgreSQL ${LANG_ENGLISH} "Install the PostgreSQL RDBMS used by Odoo."
158LangString DESC_FinishPage_Link ${LANG_ENGLISH} "Contact Odoo for Partnership and/or Support"
159LangString DESC_AtLeastOneComponent ${LANG_ENGLISH} "You have to choose at least one component"
160LangString DESC_CanNotInstallPostgreSQL ${LANG_ENGLISH} "You can not install the PostgreSQL database without the Odoo Server"
161LangString WARNING_HostNameIsEmpty ${LANG_ENGLISH} "The hostname for the connection to the PostgreSQL Server is empty"
162LangString WARNING_UserNameIsEmpty ${LANG_ENGLISH} "The username for the connection to the PostgreSQL Server is empty"
163LangString WARNING_PasswordIsEmpty ${LANG_ENGLISH} "The password for the connection to the PostgreSQL Server is empty"
164LangString WARNING_PortIsWrong ${LANG_ENGLISH} "The port for the connexion to the PostgreSQL Server is wrong (default: 5432)"
165LangString DESC_PostgreSQLPage ${LANG_ENGLISH} "Configure the information for the PostgreSQL connection"
166LangString DESC_PostgreSQL_Hostname ${LANG_ENGLISH} "Hostname"
167LangString DESC_PostgreSQL_Port ${LANG_ENGLISH} "Port"
168LangString DESC_PostgreSQL_Username ${LANG_ENGLISH} "Username"
169LangString DESC_PostgreSQL_Password ${LANG_ENGLISH} "Password"
170LangString Profile_AllInOne ${LANG_ENGLISH} "All In One"
171LangString Profile_Server ${LANG_ENGLISH} "Server only"
172LangString TITLE_Odoo_Server ${LANG_ENGLISH} "Odoo Server"
173LangString TITLE_PostgreSQL ${LANG_ENGLISH} "PostgreSQL Database"
174LangString DESC_FinishPageText ${LANG_ENGLISH} "Start Odoo"
175
176; French
177LangString DESC_Odoo_Server ${LANG_FRENCH} "Installation du Serveur Odoo avec tous les modules Odoo standards."
178LangString DESC_PostgreSQL ${LANG_FRENCH} "Installation de la base de données PostgreSQL utilisée par Odoo."
179LangString DESC_FinishPage_Link ${LANG_FRENCH} "Contactez Odoo pour un Partenariat et/ou du Support"
180LangString DESC_AtLeastOneComponent ${LANG_FRENCH} "Vous devez choisir au moins un composant"
181LangString DESC_CanNotInstallPostgreSQL ${LANG_FRENCH} "Vous ne pouvez pas installer la base de données PostgreSQL sans le serveur Odoo"
182LangString WARNING_HostNameIsEmpty ${LANG_FRENCH} "L'adresse pour la connection au serveur PostgreSQL est vide"
183LangString WARNING_UserNameIsEmpty ${LANG_FRENCH} "Le nom d'utilisateur pour la connection au serveur PostgreSQL est vide"
184LangString WARNING_PasswordIsEmpty ${LANG_FRENCH} "Le mot de passe pour la connection au serveur PostgreSQL est vide"
185LangString WARNING_PortIsWrong ${LANG_FRENCH} "Le port pour la connection au serveur PostgreSQL est erroné (défaut: 5432)"
186LangString DESC_PostgreSQLPage ${LANG_FRENCH} "Configurez les informations de connection pour le serveur PostgreSQL"
187LangString DESC_PostgreSQL_Hostname ${LANG_FRENCH} "Hôte"
188LangString DESC_PostgreSQL_Port ${LANG_FRENCH} "Port"
189LangString DESC_PostgreSQL_Username ${LANG_FRENCH} "Utilisateur"
190LangString DESC_PostgreSQL_Password ${LANG_FRENCH} "Mot de passe"
191LangString Profile_AllInOne ${LANG_FRENCH} "All In One"
192LangString Profile_Server ${LANG_FRENCH} "Seulement le serveur"
193LangString TITLE_Odoo_Server ${LANG_FRENCH} "Serveur Odoo"
194LangString TITLE_PostgreSQL ${LANG_FRENCH} "Installation du serveur de base de données PostgreSQL"
195LangString DESC_FinishPageText ${LANG_FRENCH} "Démarrer Odoo"
196
197InstType $(Profile_AllInOne)
198InstType $(Profile_Server)
199
200Section $(TITLE_Odoo_Server) SectionOdoo_Server
201    SectionIn 1 2
202
203    # Installing winpython
204    SetOutPath "$INSTDIR\python"
205    ${If} ${RunningX64}
206        File /r /x "__pycache__" "${TOOLSDIR}\WinPy64\python-${PYTHONVERSION}.amd64\*"
207    ${Else}
208        File /r /x "__pycache__" "${TOOLSDIR}\WinPy32\python-${PYTHONVERSION}\*"
209    ${EndIf}
210
211    SetOutPath "$INSTDIR\nssm"
212    File /r /x "src" "${TOOLSDIR}\nssm-2.24\*"
213
214    SetOutPath "$INSTDIR\server"
215    File /r /x "wkhtmltopdf" "..\..\*"
216
217    SetOutPath "$INSTDIR\vcredist"
218    File /r "${TOOLSDIR}\vcredist\*.exe"
219
220    # Install Visual C redistribuable files
221    DetailPrint "Installing Visual C++ redistributable files"
222    ${If} ${RunningX64}
223        nsExec::Exec '"$INSTDIR\vcredist\vc_redist.x64.exe" /q'
224    ${Else}
225        nsExec::Exec '"$INSTDIR\vcredist\vc_redist.x86.exe" /q'
226    ${EndIf}
227
228    SetOutPath "$INSTDIR\thirdparty"
229    File /r "${STATIC_PATH}\wkhtmltopdf\*"
230
231    # If there is a previous install of the Odoo Server, keep the login/password from the config file
232    WriteIniStr "$INSTDIR\server\odoo.conf" "options" "db_host" $TextPostgreSQLHostname
233    WriteIniStr "$INSTDIR\server\odoo.conf" "options" "db_user" $TextPostgreSQLUsername
234    WriteIniStr "$INSTDIR\server\odoo.conf" "options" "db_password" $TextPostgreSQLPassword
235    WriteIniStr "$INSTDIR\server\odoo.conf" "options" "db_port" $TextPostgreSQLPort
236    # Fix the addons path
237    WriteIniStr "$INSTDIR\server\odoo.conf" "options" "addons_path" "$INSTDIR\server\odoo\addons"
238    WriteIniStr "$INSTDIR\server\odoo.conf" "options" "bin_path" "$INSTDIR\thirdparty"
239
240    # if we're going to install postgresql force it's path,
241    # otherwise we consider it's always done and/or correctly tune by users
242    ${If} $HasPostgreSQL == 0
243        WriteIniStr "$INSTDIR\server\odoo.conf" "options" "pg_path" "$INSTDIR\PostgreSQL\bin"
244    ${EndIf}
245
246    DetailPrint "Installing Windows service"
247    nsExec::ExecTOLog '"$INSTDIR\python\python.exe" "$INSTDIR\server\odoo-bin" --stop-after-init --logfile "$INSTDIR\server\odoo.log" -s'
248    ${If} ${RunningX64}
249      nsExec::ExecToLog '"$INSTDIR\nssm\win64\nssm.exe" install ${SERVICENAME} "$INSTDIR\python\python.exe" "\"$INSTDIR\server\odoo-bin\""'
250      nsExec::ExecToLog '"$INSTDIR\nssm\win64\nssm.exe" set ${SERVICENAME} AppDirectory "$\"$INSTDIR\server$\""'
251    ${Else}
252      nsExec::ExecToLog '"$INSTDIR\nssm\win32\nssm.exe" install ${SERVICENAME} "$INSTDIR\python\python.exe" "\"$INSTDIR\server\odoo-bin\""'
253      nsExec::ExecToLog '"$INSTDIR\nssm\win32\nssm.exe" set ${SERVICENAME} AppDirectory "$\"$INSTDIR\server$\""'
254    ${EndIf}
255
256    nsExec::Exec "net stop ${SERVICENAME}"
257    sleep 2
258
259    nsExec::Exec "net start ${SERVICENAME}"
260    sleep 2
261
262SectionEnd
263
264Section $(TITLE_PostgreSQL) SectionPostgreSQL
265    SectionIn 1 2
266    SetOutPath '$TEMP'
267    VAR /GLOBAL postgresql_exe_filename
268    VAR /GLOBAL postgresql_url
269
270    ${If} ${RunningX64}
271        StrCpy $postgresql_exe_filename "postgresql-12.4-1-windows-x64.exe"
272    ${Else}
273        StrCpy $postgresql_exe_filename "postgresql-10.14-1-windows.exe"
274    ${EndIf}
275
276    StrCpy $postgresql_url "https://get.enterprisedb.com/postgresql/$postgresql_exe_filename"
277    nsExec::Exec 'net user openpgsvc /delete'
278
279	inetc::get "$postgresql_url" "$TEMP/$postgresql_exe_filename" /POPUP
280    pop $0
281
282    ReadRegStr $0 HKLM "System\CurrentControlSet\Control\ComputerName\ActiveComputerName" "ComputerName"
283    StrCmp $0 "" win9x
284    Goto done
285    win9x:
286        ReadRegStr $0 HKLM "System\CurrentControlSet\Control\ComputerName\ComputerName" "ComputerName"
287    done:
288    Rmdir /r "$INSTDIR\PostgreSQL"
289    ExecWait '"$TEMP\$postgresql_exe_filename" \
290        --mode unattended \
291        --prefix "$INSTDIR\PostgreSQL" \
292        --datadir "$INSTDIR\PostgreSQL\data" \
293        --servicename "PostgreSQL_For_Odoo" \
294        --serviceaccount "openpgsvc" --servicepassword "0p3npgsvcPWD" \
295        --superaccount "$TextPostgreSQLUsername" --superpassword "$TextPostgreSQLPassword" \
296        --serverport $TextPostgreSQLPort'
297SectionEnd
298
299Section -Post
300    WriteRegExpandStr HKLM "${UNINSTALL_REGISTRY_KEY}" "UninstallString" "$INSTDIR\Uninstall.exe"
301    WriteRegExpandStr HKLM "${UNINSTALL_REGISTRY_KEY}" "InstallLocation" "$INSTDIR"
302    WriteRegStr HKLM       "${UNINSTALL_REGISTRY_KEY}" "DisplayName" "${DISPLAY_NAME}"
303    WriteRegStr HKLM       "${UNINSTALL_REGISTRY_KEY}" "DisplayVersion" "${MAJOR_VERSION}.${MINOR_VERSION}"
304    WriteRegStr HKLM       "${UNINSTALL_REGISTRY_KEY}" "Publisher" "${PUBLISHER}"
305    WriteRegStr HKLM       "${UNINSTALL_REGISTRY_KEY}" "HelpLink" "support@odoo.com"
306    WriteRegStr HKLM       "${UNINSTALL_REGISTRY_KEY}" "HelpTelephone" "+32.81.81.37.00"
307    WriteRegStr HKLM       "${UNINSTALL_REGISTRY_KEY}" "URLInfoAbout" "https://www.odoo.com"
308    WriteRegStr HKLM       "${UNINSTALL_REGISTRY_KEY}" "Contact" "sales@odoo.com"
309    WriteRegDWORD HKLM     "${UNINSTALL_REGISTRY_KEY}" "NoModify" "1"
310    WriteRegDWORD HKLM     "${UNINSTALL_REGISTRY_KEY}" "NoRepair" "1"
311    WriteUninstaller "$INSTDIR\Uninstall.exe"
312SectionEnd
313
314!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
315    !insertmacro MUI_DESCRIPTION_TEXT ${SectionOdoo_Server} $(DESC_Odoo_Server)
316    !insertmacro MUI_DESCRIPTION_TEXT ${SectionPostgreSQL} $(DESC_PostgreSQL)
317!insertmacro MUI_FUNCTION_DESCRIPTION_END
318
319Section "Uninstall"
320    # Check if the server is installed
321    !insertmacro IfKeyExists "HKLM" "${UNINSTALL_REGISTRY_KEY_SERVER}" "UninstallString"
322    Pop $R0
323    ReadRegStr $0 HKLM "${UNINSTALL_REGISTRY_KEY_SERVER}" "UninstallString"
324    ExecWait '"$0" /S'
325
326    nsExec::Exec "net stop ${SERVICENAME}"
327    nsExec::Exec "sc delete ${SERVICENAME}"
328    sleep 2
329
330    Rmdir /r "$INSTDIR\server"
331    Rmdir /r "$INSTDIR\thirdparty"
332    Rmdir /r "$INSTDIR\python"
333    Rmdir /r "$INSTDIR\nssm"
334    DeleteRegKey HKLM "${UNINSTALL_REGISTRY_KEY}"
335SectionEnd
336
337Function .onInit
338    VAR /GLOBAL previous_install_dir
339    ${If} ${RunningX64}
340        SetRegView 64
341    ${EndIf}
342    ReadRegStr $previous_install_dir HKLM "${REGISTRY_KEY}" "Install_Dir"
343    ${If} $previous_install_dir == ""
344        ${If} ${RunningX64}
345            StrCpy $INSTDIR "$PROGRAMFILES64\Odoo ${VERSION}"
346        ${Else}
347            StrCpy $INSTDIR "$PROGRAMFILES\Odoo ${VERSION}"
348        ${EndIf}
349        WriteRegStr HKLM "${REGISTRY_KEY}" "Install_dir" "$INSTDIR"
350    ${EndIf}
351
352    Push $R0
353    ${GetParameters} $cmdLineParams
354    ClearErrors
355    Pop $R0
356
357    StrCpy $Option_AllInOne 0
358    StrCpy $HasPostgreSQL 0
359
360    StrCpy $TextPostgreSQLHostname ${DEFAULT_POSTGRESQL_HOSTNAME}
361    StrCpy $TextPostgreSQLPort ${DEFAULT_POSTGRESQL_PORT}
362    StrCpy $TextPostgreSQLUsername ${DEFAULT_POSTGRESQL_USERNAME}
363    StrCpy $TextPostgreSQLPassword ${DEFAULT_POSTGRESQL_PASSWORD}
364
365    Push $R0
366    ${GetOptions} $cmdLineParams '/allinone' $R0
367    IfErrors +2 0
368    StrCpy $Option_AllInOne 1
369    Pop $R0
370
371    StrCmp $Option_AllInOne 1 AllInOneMode
372    StrCmp $Option_AllInOne 0 NoAllInOneMode
373
374    AllInOneMode:
375        MessageBox MB_OK|MB_ICONINFORMATION "All In One"
376
377    NoAllInOneMode:
378
379    !insertmacro MUI_LANGDLL_DISPLAY
380
381    ClearErrors
382    EnumRegKey $0 HKLM "SOFTWARE\PostgreSQL\Installations" 0
383    IfErrors DoInstallPostgreSQL 0
384    StrCmp $0 "" DoInstallPostgreSQL
385    StrCpy $HasPostgreSQL 1
386    !insertmacro UnselectSection ${SectionPostgreSQL}
387    SectionSetFlags ${SectionPostgreSQL} ${SF_RO}
388
389    DoInstallPostgreSQL:
390FunctionEnd
391
392Function .onSelChange
393    ${If} $HasPostgreSQL == 1
394        !insertmacro UnselectSection ${SectionPostgreSQL}
395    ${EndIf}
396FunctionEnd
397
398Function PostgreSQLOnBack
399FunctionEnd
400
401Function ShowPostgreSQL
402    SectionGetFlags ${SectionOdoo_Server} $0
403    IntOp $0 $0 & ${SF_SELECTED}
404    IntCmp $0 ${SF_SELECTED} LaunchPostgreSQLConfiguration
405    Abort
406    LaunchPostgreSQLConfiguration:
407
408    nsDialogs::Create /NOUNLOAD 1018
409    Pop $0
410
411    ${If} $0 == error
412        Abort
413    ${EndIf}
414
415    GetFunctionAddress $0 PostgreSQLOnBack
416    nsDialogs::OnBack $0
417
418    ${NSD_CreateLabel} 0 0 100% 10u $(DESC_PostgreSQLPage)
419    Pop $0
420
421    ${NSD_CreateLabel} 0 45 60u 12u $(DESC_PostgreSQL_Hostname)
422    Pop $0
423    ${NSD_CreateText} 100 45 150u 12u $TextPostgreSQLHostname
424    Pop $HWNDPostgreSQLHostname
425
426    ${NSD_CreateLabel} 0 75 60u 12u $(DESC_PostgreSQL_Port)
427    Pop $0
428    ${NSD_CreateNumber} 100 75 150u 12u $TextPostgreSQLPort
429    Pop $HWNDPostgreSQLPort
430    ${NSD_CreateLabel} 0 105 60u 12u $(DESC_PostgreSQL_Username)
431    Pop $0
432    ${NSD_CreateText} 100 105 150u 12u $TextPostgreSQLUsername
433    Pop $HWNDPostgreSQLUsername
434    ${NSD_CreateLabel} 0 135 60u 12u $(DESC_PostgreSQL_Password)
435    Pop $0
436    ${NSD_CreateText} 100 135 150u 12u $TextPostgreSQLPassword
437    Pop $HWNDPostgreSQLPassword
438
439    nsDialogs::Show
440FunctionEnd
441
442Function LeavePostgreSQL
443    ${NSD_GetText} $HWNDPostgreSQLHostname $TextPostgreSQLHostname
444    ${NSD_GetText} $HWNDPostgreSQLPort $TextPostgreSQLPort
445    ${NSD_GetText} $HWNDPostgreSQLUsername $TextPostgreSQLUsername
446    ${NSD_GetText} $HWNDPostgreSQLPassword $TextPostgreSQLPassword
447    StrLen $1 $TextPostgreSQLHostname
448    ${If} $1 == 0
449        MessageBox MB_ICONEXCLAMATION|MB_OK $(WARNING_HostNameIsEmpty)
450        Abort
451    ${EndIf}
452
453    ${If} $TextPostgreSQLPort <= 0
454    ${OrIf} $TextPostgreSQLPort > 65535
455        MessageBox MB_ICONEXCLAMATION|MB_OK $(WARNING_PortIsWrong)
456        Abort
457    ${EndIf}
458
459    StrLen $1 $TextPostgreSQLUsername
460    ${If} $1 == 0
461        MessageBox MB_ICONEXCLAMATION|MB_OK $(WARNING_UserNameIsEmpty)
462        Abort
463    ${EndIf}
464
465    StrLen $1 $TextPostgreSQLPassword
466    ${If} $1 == 0
467        MessageBox MB_ICONEXCLAMATION|MB_OK $(WARNING_PasswordIsEmpty)
468        Abort
469    ${EndIf}
470FunctionEnd
471
472Function ComponentLeave
473    SectionGetFlags ${SectionOdoo_Server} $0
474    IntOp $0 $0 & ${SF_SELECTED}
475    IntCmp $0 ${SF_SELECTED} Done
476
477    SectionGetFlags ${SectionPostgreSQL} $0
478    IntOp $0 $0 & ${SF_SELECTED}
479    IntCmp $0 ${SF_SELECTED} DontInstallPostgreSQL
480
481    DontInstallPostgreSQL:
482        MessageBox MB_ICONEXCLAMATION|MB_OK $(DESC_CanNotInstallPostgreSQL)
483        Abort
484    Done:
485FunctionEnd
486
487Function LaunchLink
488    ExecShell "open" "http://localhost:8069/"
489FunctionEnd
490