diff options
author | scheidell <scheidell@FreeBSD.org> | 2012-06-12 20:56:54 +0800 |
---|---|---|
committer | scheidell <scheidell@FreeBSD.org> | 2012-06-12 20:56:54 +0800 |
commit | 420b03290b70b71a0a94aaa16c8c03c0c006b088 (patch) | |
tree | d024e57ec91c69d1da1c38c7dbaa17515ffe1af8 | |
parent | 3bb753d6c7477a8761a2313fc87e0960f34581de (diff) | |
download | freebsd-ports-gnome-420b03290b70b71a0a94aaa16c8c03c0c006b088.tar.gz freebsd-ports-gnome-420b03290b70b71a0a94aaa16c8c03c0c006b088.tar.zst freebsd-ports-gnome-420b03290b70b71a0a94aaa16c8c03c0c006b088.zip |
- Fix installation problems by changing how pid is checked
- Add note to pkg-message about postgresql server
PR: ports/166534
Submitted by: Laurent Berthelet <laurent@ospowa.com> (maintainer)
Reported by: Franck PORCHER <franck.porcher@gmail.com>
-rw-r--r-- | finance/openerp-server/Makefile | 17 | ||||
-rw-r--r-- | finance/openerp-server/files/openerp-server.conf.in | 15 | ||||
-rw-r--r-- | finance/openerp-server/files/openerpd.in | 103 | ||||
-rw-r--r-- | finance/openerp-server/files/pkg-message.in | 9 |
4 files changed, 92 insertions, 52 deletions
diff --git a/finance/openerp-server/Makefile b/finance/openerp-server/Makefile index b7e02036916a..c742daaedc74 100644 --- a/finance/openerp-server/Makefile +++ b/finance/openerp-server/Makefile @@ -7,7 +7,7 @@ PORTNAME= openerp-server PORTVERSION= 6.0.3 -PORTREVISION= 1 +PORTREVISION= 2 PORTEPOCH= 1 CATEGORIES= finance python MASTER_SITES= http://www.openerp.com/download/stable/source/ @@ -29,20 +29,7 @@ BUILD_DEPENDS= ${PYTHON_SITELIBDIR}/PIL/__init__.py:${PORTSDIR}/graphics/py-imag ${PYTHON_PKGNAMEPREFIX}mako>0:${PORTSDIR}/textproc/py-mako \ ${PYTHON_PKGNAMEPREFIX}dateutil>0:${PORTSDIR}/devel/py-dateutil \ ${PYTHON_SITELIBDIR}/reportlab/__init__.py:${PORTSDIR}/print/py-reportlab2 -RUN_DEPENDS= ${PYTHON_SITELIBDIR}/PIL/__init__.py:${PORTSDIR}/graphics/py-imaging \ - ${PYTHON_SITELIBDIR}/libxml2.py:${PORTSDIR}/textproc/py-libxml2 \ - ${PYTHON_PKGNAMEPREFIX}pytz>0:${PORTSDIR}/devel/py-pytz \ - ${PYTHON_SITELIBDIR}/mx/__init__.py:${PORTSDIR}/lang/py-mx-base \ - ${PYTHON_PKGNAMEPREFIX}psycopg2>0:${PORTSDIR}/databases/py-psycopg2 \ - ${PYTHON_PKGNAMEPREFIX}chart>0:${PORTSDIR}/graphics/py-chart \ - ${PYTHON_PKGNAMEPREFIX}pydot>0:${PORTSDIR}/graphics/py-pydot \ - ${PYTHON_PKGNAMEPREFIX}libxslt>0:${PORTSDIR}/textproc/py-libxslt \ - ${PYTHON_PKGNAMEPREFIX}lxml>0:${PORTSDIR}/devel/py-lxml \ - ${PYTHON_PKGNAMEPREFIX}xml>0:${PORTSDIR}/textproc/py-xml \ - ${PYTHON_PKGNAMEPREFIX}yaml>0:${PORTSDIR}/devel/py-yaml \ - ${PYTHON_PKGNAMEPREFIX}mako>0:${PORTSDIR}/textproc/py-mako \ - ${PYTHON_PKGNAMEPREFIX}dateutil>0:${PORTSDIR}/devel/py-dateutil \ - ${PYTHON_SITELIBDIR}/reportlab/__init__.py:${PORTSDIR}/print/py-reportlab2 +RUN_DEPENDS:= ${BUILD_DEPENDS} USE_RC_SUBR= openerpd SUB_FILES= openerp-server.conf pkg-message diff --git a/finance/openerp-server/files/openerp-server.conf.in b/finance/openerp-server/files/openerp-server.conf.in index f374b6796164..1e6ca334b097 100644 --- a/finance/openerp-server/files/openerp-server.conf.in +++ b/finance/openerp-server/files/openerp-server.conf.in @@ -2,6 +2,8 @@ # # This is an example configuration file, just copy it # to openerp-server.conf and edit it to suit your needs. +# +# Patch submitted by (c) Franck Porcher, Ph.D, to smooth some default values [options] # Basic daemon configuration options ################## @@ -18,7 +20,7 @@ xmlrpc = True netrpc = True secure = False cache_timeout = 100000 -pidfile = /var/run/openerp-server/openerp-server.pid +pidfile = /var/run/openerp/openerp-server.pid reportgz = False admin_passwd = admin login_message = False @@ -27,15 +29,15 @@ csv_internal_sep = , translate_modules = ['all'] # Logging options ##################################### -syslog = False +syslog = True log_level = info -logfile = /var/log/openerp-server.log +logfile = /var/log/openerp/openerp-server.log assert_exit_level = warn # Database options #################################### -db_name = openerp-server -db_user = openerp-server -db_password = openerp-server +db_name = openerp +db_user = openerp +db_password = openerp db_host = localhost db_maxconn = 64 pg_path = /usr/local/bin @@ -52,4 +54,3 @@ email_from = False # Use demo files? ##################################### # without_demo = True # demo = {} - diff --git a/finance/openerp-server/files/openerpd.in b/finance/openerp-server/files/openerpd.in index 240e2ebaba47..e642c6653665 100644 --- a/finance/openerp-server/files/openerpd.in +++ b/finance/openerp-server/files/openerpd.in @@ -1,73 +1,116 @@ #!/bin/sh - +# # PROVIDE: openerpd # REQUIRE: postgresql LOGIN # -# Add the following lines to /etc/rc.conf -# to enable this service: +# Add the following lines to /etc/rc.conf to enable openerp-server +# # -# openerpd_enable (bool): Set to NO by default. -# Set it to YES to enable mongod. +# openerpd_enable (bool): Set to "NO" by default, +# Set it to "YES" to enable openerp-server # -# Additional configurable variables: -# openerpd_config (path): Set to %%PREFIX%%/etc/openerp-server.conf -# by default. Additional configuration. You -# can also use openerpd_flags for additional -# command line arguments. +# openerpd_config (str): The path to the openerp-server configuration file +# (defaults to %%PREFIX%%/etc/openerp-server.conf) +# +# openerpd_flags (str): Extra arguments to be used when invoking +# the openerp-server daemon. +# +# Patch submitted by (c) Franck Porcher, Ph.D, to fix some issues regarding +# pidfile, log files, and discrepencies with the main configuration file. -. /etc/rc.subr +# getval varname file [default_value] [separator_char] +# - Discard comment lines (any text leading with blanks then #) +# - Retain only the last value set -name="openerpd" -rcvar=openerpd_enable +. /etc/rc.subr + +name=openerpd command=%%PREFIX%%/bin/openerp-server +rcvar=openerpd_enable load_rc_config $name -: ${openerpd_enable="NO"} -: ${openerpd_config="%%PREFIX%%/etc/openerp-server.conf"} -: ${openerpd_user="openerpd"} +openerpd_enable="${openerpd_enable-"NO"}" +openerpd_config="${openerpd_config-"%%PREFIX%%/etc/openerp-server.conf"}" +openerpd_user="${openerpd_user-"openerpd"}" +openerpd_pidfile="${openerpd_pidfile:-"$(grep pidfile %%PREFIX%%/etc/openerp-server.conf | awk -F "=" ' { print $2 } ' |sed 's/[ ]//g' )"}" +openerpd_logdir="${openerpd_logdir:-"$(dirname `grep logfile %%PREFIX%%/etc/openerp-server.conf | awk -F "=" ' { print $2 } ' `)"}" +openerpd_flags="${openerpd_flags:-"--config=${openerpd_config}"}" -openerpd_pidfile=${openerpd_pidfile:-"/var/run/openerp-server/openerpd.pid"} -openerpd_config=${openerpd_config:-"/usr/local/etc/openerpd.conf"} -openerpd_flags=${openerpd_flags:-"--config=${openerpd_config}"} +# /etc/rc.subr use $pidfile (not ${name}_pidfile) +pidfile="${openerpd_pidfile}" -required_files="$openerpd_config" +required_files="${openerpd_config}" start_precmd="${name}_prestart" stop_cmd="${name}_stop" +status_cmd="${name}_status" +getval_cmd="${name}_getval" openerpd_prestart() { - if [ ! -d `dirname ${openerpd_pidfile}` ] + local d + + d="$(dirname "${openerpd_pidfile}")" + if [ ! -d "${d}" ] then - mkdir -p `dirname ${openerpweb_pidfile}` + mkdir -p "${d}" fi - chown ${openerpd_user} `dirname ${openerpd_pidfile}` + chown "${openerpd_user}" "${d}" + + d="$openerpd_logdir" + if [ ! -d "${d}" ] + then + mkdir -p "${d}" + fi + chown "${openerpd_user}" "${d}" } openerpd_stop() { - # ensure the server is stopped - if [ -f ${openerpd_pidfile} ] + # Try its best to stop the service + if [ -f "${openerpd_pidfile}" ] then echo "Stopping ${name}." - kill -15 `cat ${openerpd_pidfile}` + kill -15 "$(cat "${openerpd_pidfile}")" else - openerpd_pid=`pgrep -f "openerp-server.py ${openerpd_flags}"` - if [ ${openerpd_pid} ] + # echo "Looking for (openerp-server.py ${openerpd_flags})" + openerpd_pid=$(pgrep -f "openerp-server.py ${openerpd_flags}") + if [ -n "${openerpd_pid}" ] then echo "Stopping ${name}." - kill -15 ${openerpd_pid} + kill -15 "${openerpd_pid}" else echo "${name} not running? (pidfile not found)" fi fi } +openerpd_status() +{ + # Try its best to find the service's status + if [ -f "${openerpd_pidfile}" ] + then + openerpd_pid="$(cat "${openerpd_pidfile}")" + fi + + if [ -z "${openerpd_pid}" ] + then + openerpd_pid=$(pgrep -f "openerp-server.py ${openerpd_flags}") + [ -n "${openerpd_pid}" ] && echo "${openerpd_pid}" > "${openerpd_pidfile}" + fi + + if [ -n "${openerpd_pid}" ] + then + echo "${name} running with pid: $openerpd_pid" + else + echo "${name} not running? (pid not found)" + fi +} -command_args="-c $openerpd_config >/dev/null 2>&1 &" +command_args=" >/dev/null 2>&1 &" load_rc_config $name run_rc_command "$1" diff --git a/finance/openerp-server/files/pkg-message.in b/finance/openerp-server/files/pkg-message.in index 4827f7412af6..941158e7e011 100644 --- a/finance/openerp-server/files/pkg-message.in +++ b/finance/openerp-server/files/pkg-message.in @@ -7,4 +7,13 @@ If you want start it when the system boot, please add this line to your /etc/rc.conf: openerpd_enable="YES" +If postgresql is not configured, openerp-server will not start. +You can try something like this : + +[root] # su - <PGSQL> +[PGSQL] $ openerp_dbuser=db_user #look in %%PREFIX%%/etc/openerp-server.conf +[PGSQL] $ openerp_dbname=db_name #look in %%PREFIX%%/etc/openerp-server.conf +[PGSQL] $ createuser $openerp_dbuser +[PGSQL] $ createdb --owner=${openerp_dbuser} --encoding=UTF-8 --locale=en_EN.UTF-8 ${openerp_dbname} "OpenERP initial database" + ************************************************************************ |