gooderp18绿色标准版
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

599 Zeilen
22KB

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