[ADD] RedHat: defined the dependencies and added a post-install script to create...
authorSimon Lejeune <sle@openerp.com>
Tue, 2 Sep 2014 10:34:49 +0000 (12:34 +0200)
committerSimon Lejeune <sle@openerp.com>
Tue, 2 Sep 2014 12:13:01 +0000 (14:13 +0200)
setup.cfg
setup/redhat/postinstall.sh [new file with mode: 0644]

index 40062a7..caf0d04 100644 (file)
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,10 +1,42 @@
-[general]
-
-[sdist]
-formats=gztar
+[bdist_rpm]
+post-install = setup/redhat/postinstall.sh
 
-[bdist]
-formats=rpm
+requires =
+  babel
+  libxslt-python
+  pyparsing
+  python-dateutil
+  python-decorator
+  python-docutils
+  python-feedparser
+  python-imaging
+  python-jinja2
+  python-ldap
+  python-lxml
+  python-mako
+  python-mock
+  python-openid
+  python-passlib
+  python-psutil
+  python-psycopg2
+  python-reportlab
+  python-requests
+  python-simplejson
+  python-unittest2
+  python-vobject
+  python-werkzeug
+  python-yaml
+  pytz
 
-[bdist_rpm]
-install_script=setup/setup_rpm.sh
+# -------------------------------------------------------------------
+# CentOS 7 notes
+# -------------------------------------------------------------------
+#
+# These libraries can be installed as system packages thanks to the
+# Fedora EPEL repo (https://fedoraproject.org/wiki/EPEL):
+# rpm -ivh http://dl.fedoraproject.org/pub/epel/beta/7/x86_64/epel-release-7-0.2.noarch.rpm
+# yum update -y && yum upgrade -y
+#
+# Unfortunately, all the needed packages are not yet ported to EPEL7. You can install them with pip:
+# yum install python-pip gcc python-devel -y
+# pip install pydot pyPdf vatnumber xlwt http://download.gna.org/pychart/PyChart-1.39.tar.gz
diff --git a/setup/redhat/postinstall.sh b/setup/redhat/postinstall.sh
new file mode 100644 (file)
index 0000000..bde7db4
--- /dev/null
@@ -0,0 +1,102 @@
+#!/bin/sh
+
+set -e
+
+ODOO_CONFIGURATION_FILE=/etc/openerp/openerp-server.conf
+ODOO_CONFIGURATION_DIR=/etc/openerp
+ODOO_DATA_DIR=/var/lib/openerp
+ODOO_GROUP="openerp"
+ODOO_LOG_DIR=/var/log/openerp
+ODOO_USER="openerp"
+
+if ! getent passwd | grep -q "^openerp:"; then
+    groupadd $ODOO_GROUP
+    adduser --system --no-create-home $ODOO_USER -g $ODOO_GROUP
+fi
+# Register "openerp" as a postgres superuser 
+su - postgres -c "createuser -s openerp" 2> /dev/null || true
+# Configuration file
+mkdir -p $ODOO_CONFIGURATION_DIR
+echo "[options]
+; This is the password that allows database operations:
+; admin_passwd = admin
+db_host = False
+db_port = False
+db_user = openerp
+db_password = False
+addons_path = /usr/local/lib/python2.7/dist-packages/openerp/addons
+" > $ODOO_CONFIGURATION_FILE
+chown $ODOO_USER:$ODOO_GROUP $ODOO_CONFIGURATION_FILE
+chmod 0640 $ODOO_CONFIGURATION_FILE
+# Log
+mkdir -p $ODOO_LOG_DIR
+chown $ODOO_USER:$ODOO_GROUP $ODOO_LOG_DIR
+chmod 0750 $ODOO_LOG_DIR
+# Data dir
+mkdir -p $ODOO_DATA_DIR
+chown $ODOO_USER:$ODOO_GROUP $ODOO_DATA_DIR
+
+echo '#!/bin/sh
+
+### BEGIN INIT INFO
+# Provides:     openerp-server
+# Required-Start:   $remote_fs $syslog
+# Required-Stop:    $remote_fs $syslog
+# Should-Start:     $network
+# Should-Stop:      $network
+# Default-Start:    2 3 4 5
+# Default-Stop:     0 1 6
+# Short-Description:    Enterprise Resource Management software
+# Description:      Open ERP is a complete ERP and CRM software.
+### END INIT INFO
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
+DAEMON=/usr/bin/openerp-server
+NAME=openerp-server
+DESC=openerp-server
+CONFIG=/etc/openerp/openerp-server.conf
+LOGFILE=/var/log/openerp/openerp-server.log
+USER=openerp
+
+test -x ${DAEMON} || exit 0
+
+set -e
+
+do_start () {
+    echo -n "Starting ${DESC}: "
+    start-stop-daemon --start --quiet --pidfile /var/run/${NAME}.pid --chuid ${USER} --background --make-pidfile --exec ${DAEMON} -- --config=${CONFIG} --logfile=${LOGFILE}
+    echo "${NAME}."
+}
+
+do_stop () {
+    echo -n "Stopping ${DESC}: "
+    start-stop-daemon --stop --quiet --pidfile /var/run/${NAME}.pid --oknodo
+    echo "${NAME}."
+}
+
+case "${1}" in
+    start)
+        do_start
+        ;;
+
+    stop)
+        do_stop
+        ;;
+
+    restart|force-reload)
+        echo -n "Restarting ${DESC}: "
+        do_stop
+        sleep 1
+        do_start
+        ;;
+
+    *)
+        N=/etc/init.d/${NAME}
+        echo "Usage: ${NAME} {start|stop|restart|force-reload}" >&2
+        exit 1
+        ;;
+esac
+
+exit 0
+' > /etc/init.d/openerp
+chmod 700 /etc/init.d/openerp
\ No newline at end of file