odoo.spec 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. %global name odoo
  2. %global release 1
  3. %global unmangled_version %{version}
  4. Summary: Odoo Server
  5. Name: %{name}
  6. Version: %{version}
  7. Release: %{release}
  8. Source0: %{name}-%{unmangled_version}.tar.gz
  9. License: LGPL-3
  10. Group: Development/Libraries
  11. BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
  12. Prefix: %{_prefix}
  13. BuildArch: noarch
  14. Vendor: Odoo S.A. <info@odoo.com>
  15. Requires: sassc
  16. BuildRequires: python3-devel
  17. BuildRequires: pyproject-rpm-macros
  18. Url: https://www.odoo.com
  19. %description
  20. Odoo is a complete ERP and CRM. The main features are accounting (analytic
  21. and financial), stock management, sales and purchases management, tasks
  22. automation, marketing campaigns, help desk, POS, etc. Technical features include
  23. a distributed server, an object database, a dynamic GUI,
  24. customizable reports, and XML-RPC interfaces.
  25. %generate_buildrequires
  26. %pyproject_buildrequires
  27. %prep
  28. %autosetup
  29. %build
  30. %py3_build
  31. %install
  32. %py3_install
  33. %post
  34. #!/bin/sh
  35. set -e
  36. ODOO_CONFIGURATION_DIR=/etc/odoo
  37. ODOO_CONFIGURATION_FILE=$ODOO_CONFIGURATION_DIR/odoo.conf
  38. ODOO_DATA_DIR=/var/lib/odoo
  39. ODOO_GROUP="odoo"
  40. ODOO_LOG_DIR=/var/log/odoo
  41. ODOO_LOG_FILE=$ODOO_LOG_DIR/odoo-server.log
  42. ODOO_USER="odoo"
  43. if ! getent passwd | grep -q "^odoo:"; then
  44. groupadd $ODOO_GROUP
  45. adduser --system --no-create-home $ODOO_USER -g $ODOO_GROUP
  46. fi
  47. # Register "$ODOO_USER" as a postgres user with "Create DB" role attribute
  48. su - postgres -c "createuser -d -R -S $ODOO_USER" 2> /dev/null || true
  49. # Configuration file
  50. mkdir -p $ODOO_CONFIGURATION_DIR
  51. # can't copy debian config-file as addons_path is not the same
  52. if [ ! -f $ODOO_CONFIGURATION_FILE ]
  53. then
  54. echo "[options]
  55. ; This is the password that allows database operations:
  56. ; admin_passwd = admin
  57. db_host = False
  58. db_port = False
  59. db_user = $ODOO_USER
  60. db_password = False
  61. addons_path = %{python3_sitelib}/odoo/addons
  62. default_productivity_apps = True
  63. " > $ODOO_CONFIGURATION_FILE
  64. chown $ODOO_USER:$ODOO_GROUP $ODOO_CONFIGURATION_FILE
  65. chmod 0640 $ODOO_CONFIGURATION_FILE
  66. fi
  67. # Log
  68. mkdir -p $ODOO_LOG_DIR
  69. chown $ODOO_USER:$ODOO_GROUP $ODOO_LOG_DIR
  70. chmod 0750 $ODOO_LOG_DIR
  71. # Data dir
  72. mkdir -p $ODOO_DATA_DIR
  73. chown $ODOO_USER:$ODOO_GROUP $ODOO_DATA_DIR
  74. INIT_FILE=/lib/systemd/system/odoo.service
  75. touch $INIT_FILE
  76. chmod 0700 $INIT_FILE
  77. cat << EOF > $INIT_FILE
  78. [Unit]
  79. Description=Odoo Open Source ERP and CRM
  80. After=network.target
  81. [Service]
  82. Type=simple
  83. User=odoo
  84. Group=odoo
  85. ExecStart=/usr/bin/odoo --config $ODOO_CONFIGURATION_FILE --logfile $ODOO_LOG_FILE
  86. KillMode=mixed
  87. [Install]
  88. WantedBy=multi-user.target
  89. EOF
  90. %files
  91. %{_bindir}/odoo
  92. %{python3_sitelib}/%{name}-*.egg-info
  93. %{python3_sitelib}/%{name}