diff options
| author | Simon Lejeune <sle@openerp.com> | 2014-11-26 14:08:05 +0100 |
|---|---|---|
| committer | Simon Lejeune <sle@openerp.com> | 2014-11-28 16:40:55 +0100 |
| commit | be96dd85959528b86f7535b9b4cc0dc86981ca33 (patch) | |
| tree | cb0c20771883627cbe2ef563649e35f6fe87860d /setup/redhat | |
| parent | 50a4da99f051d125b8435477657ee2b115a8e0bd (diff) | |
[FIX] Packaging: RedHat: install in /usr and add systemd unit file
By default, the package was installed in /usr/local/lib/python2.7 in CentOS7.
It is problematic because most of other python packages are installed in /usr/lib
and also because /usr/local/lib is not in the default PYTHONPATH. It's fixed by
overriding the install script and forcing prefix to be /usr.
Added a minimal systemd unitfile.
Adapted tests accordingly.
Diffstat (limited to 'setup/redhat')
| -rw-r--r-- | setup/redhat/install.sh | 3 | ||||
| -rw-r--r-- | setup/redhat/postinstall.sh | 89 |
2 files changed, 17 insertions, 75 deletions
diff --git a/setup/redhat/install.sh b/setup/redhat/install.sh new file mode 100644 index 00000000000..a74c7cd975b --- /dev/null +++ b/setup/redhat/install.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -e +python setup.py install --prefix=/usr --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES diff --git a/setup/redhat/postinstall.sh b/setup/redhat/postinstall.sh index 437fdcec426..d12621bf8a0 100644 --- a/setup/redhat/postinstall.sh +++ b/setup/redhat/postinstall.sh @@ -25,7 +25,7 @@ db_host = False db_port = False db_user = $ODOO_USER db_password = False -addons_path = /usr/local/lib/python2.7/dist-packages/openerp/addons +addons_path = /usr/lib/python2.7/site-packages/openerp/addons " > $ODOO_CONFIGURATION_FILE chown $ODOO_USER:$ODOO_GROUP $ODOO_CONFIGURATION_FILE chmod 0640 $ODOO_CONFIGURATION_FILE @@ -37,81 +37,20 @@ chmod 0750 $ODOO_LOG_DIR mkdir -p $ODOO_DATA_DIR chown $ODOO_USER:$ODOO_GROUP $ODOO_DATA_DIR -INIT_FILE=/etc/init.d/openerp +INIT_FILE=/lib/systemd/system/odoo.service touch $INIT_FILE chmod 0700 $INIT_FILE -# FIXME this is a copy of debian/init file. -# If anyone know how to tell bdist_rpm to use this file directly... cat << 'EOF' > $INIT_FILE -#!/bin/bash -### BEGIN INIT INFO -# Provides: openerp-server -# Required-Start: $remote_fs $syslog -# Required-Stop: $remote_fs $syslog -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Start openerp daemon at boot time -# Description: Enable service provided by daemon. -# X-Interactive: true -### END INIT INFO -## more info: http://wiki.debian.org/LSBInitScripts - -PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin -DAEMON=/usr/bin/openerp-server -NAME=openerp -DESC=openerp -CONFIG=/etc/odoo/openerp-server.conf -LOGFILE=/var/log/odoo/openerp-server.log -PIDFILE=/var/run/${NAME}.pid -USER=odoo -export LOGNAME=$USER - -test -x $DAEMON || exit 0 -set -e - -function _start() { - start-stop-daemon --start --quiet --pidfile $PIDFILE --chuid $USER:$USER --background --make-pidfile --exec $DAEMON -- --config $CONFIG --logfile $LOGFILE -} - -function _stop() { - start-stop-daemon --stop --quiet --pidfile $PIDFILE --oknodo --retry 3 - rm -f $PIDFILE -} - -function _status() { - start-stop-daemon --status --quiet --pidfile $PIDFILE - return $? -} - - -case "$1" in - start) - echo -n "Starting $DESC: " - _start - echo "ok" - ;; - stop) - echo -n "Stopping $DESC: " - _stop - echo "ok" - ;; - restart|force-reload) - echo -n "Restarting $DESC: " - _stop - sleep 1 - _start - echo "ok" - ;; - status) - echo -n "Status of $DESC: " - _status && echo "running" || echo "stopped" - ;; - *) - N=/etc/init.d/$NAME - echo "Usage: $N {start|stop|restart|force-reload|status}" >&2 - exit 1 - ;; -esac - -exit 0 +[Unit] +Description=Odoo Open Source ERP and CRM +After=network.target + +[Service] +Type=simple +User=odoo +Group=odoo +ExecStart=/usr/bin/odoo.py --config=/etc/odoo/openerp-server.conf + +[Install] +WantedBy=multi-user.target EOF |
