Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 May 2012 06:50:07 GMT
From:      Laurent Berthelet <laurent@ospowa.com>
To:        freebsd-ports-bugs@FreeBSD.org
Subject:   Re: ports/166534: finance/openerp-server, finance/openerp-web: OpenERP misconfiguration
Message-ID:  <201205070650.q476o7Hd001943@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR ports/166534; it has been noted by GNATS.

From: Laurent Berthelet <laurent@ospowa.com>
To: bug-followup@FreeBSD.org, franck.porcher@gmail.com
Cc:  
Subject: Re: ports/166534: finance/openerp-server, finance/openerp-web: OpenERP
 misconfiguration
Date: Mon, 07 May 2012 08:38:14 +0200

 This is a multi-part message in MIME format.
 --------------010402080906070900010303
 Content-Type: text/plain; charset=ISO-8859-1; format=flowed
 Content-Transfer-Encoding: 7bit
 
 Hi,
 
 Here is the patch.
 I can't have the submited version to work so I changed the way pidfile 
 and logfile
 are set up.
 
 For the postgresql part, I have just added a message in pkg-message as it
 can be installed on another computer.
 
 Cheers.
 
 Laurent
 
 
 --------------010402080906070900010303
 Content-Type: text/plain; charset=UTF-8;
  name="openerp-server.diff"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
  filename="openerp-server.diff"
 
 Index: files/openerp-server.conf.in
 ===================================================================
 RCS file: /home/ncvs/ports/finance/openerp-server/files/openerp-server.conf.in,v
 retrieving revision 1.1
 diff -u -r1.1 openerp-server.conf.in
 --- files/openerp-server.conf.in	8 Mar 2010 06:26:53 -0000	1.1
 +++ files/openerp-server.conf.in	7 May 2012 06:35:49 -0000
 @@ -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 @@
  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 @@
  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 @@
  # Use demo files? #####################################
  # without_demo = True
  # demo = {}
 -
 Index: files/openerpd.in
 ===================================================================
 RCS file: /home/ncvs/ports/finance/openerp-server/files/openerpd.in,v
 retrieving revision 1.5
 diff -u -r1.5 openerpd.in
 --- files/openerpd.in	14 Jan 2012 08:55:42 -0000	1.5
 +++ files/openerpd.in	7 May 2012 06:35:49 -0000
 @@ -1,73 +1,115 @@
  #!/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 /usr/local/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.
 +
 +#  getval varname file [default_value] [separator_char]
 +#  - Discard comment lines (any text leading with blanks then #)
 +#  - Retain only the last value set
 +
 +name=openerpd
 +command=/usr/local/bin/openerp-server
  
  . /etc/rc.subr
  
 -name="openerpd"
  rcvar=openerpd_enable
 +load_rc_config "${name}"
  
 -command=%%PREFIX%%/bin/openerp-server
 -
 -load_rc_config $name
 +openerpd_enable="${openerpd_enable-"NO"}"
 +openerpd_config="${openerpd_config-"/usr/local/etc/openerp-server.conf"}"
 +openerpd_user="${openerpd_user-"openerpd"}"
 +openerpd_pidfile="${openerpd_pidfile:-"$(grep pidfile /usr/local/etc/openerp-server.conf | awk -F "=" ' { print $2 } ' |sed 's/[ ]//g' )"}"
 +openerpd_logdir="${openerpd_logdir:-"$(dirname `grep logfile /usr/local/etc/openerp-server.conf | awk -F "=" ' { print $2 } ' `)"}"
 +openerpd_flags="${openerpd_flags:-"--config=${openerpd_config}"}"
  
 -: ${openerpd_enable="NO"}
 -: ${openerpd_config="%%PREFIX%%/etc/openerp-server.conf"}
 -: ${openerpd_user="openerpd"}
 -
 -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 "${d}"
 +    fi
 +    chown "${openerpd_user}" "${d}"
 +
 +    d="$openerpd_logdir"
 +    if [ ! -d "${d}" ]
      then
 -        mkdir -p `dirname ${openerpweb_pidfile}`
 +        mkdir -p "${d}"
      fi
 -    chown ${openerpd_user} `dirname ${openerpd_pidfile}`
 +    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"
 Index: files/pkg-message.in
 ===================================================================
 RCS file: /home/ncvs/ports/finance/openerp-server/files/pkg-message.in,v
 retrieving revision 1.1
 diff -u -r1.1 pkg-message.in
 --- files/pkg-message.in	8 Mar 2010 06:26:53 -0000	1.1
 +++ files/pkg-message.in	7 May 2012 06:35:49 -0000
 @@ -7,4 +7,13 @@
  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 /usr/local/etc/openerp-server.conf
 +[PGSQL] $ openerp_dbname=db_name #look in /usr/local/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"
 +
  ************************************************************************
 
 --------------010402080906070900010303--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201205070650.q476o7Hd001943>