Date: Mon, 17 Sep 2012 16:03:46 GMT From: Boris Samorodov <bsam@FreeBSD.org> To: freebsd-gnats-submit@FreeBSD.org Subject: ports/171716: [patch] finance/trytond: some tunning Message-ID: <201209171603.q8HG3kOv090457@red.freebsd.org> Resent-Message-ID: <201209171610.q8HGA8UN053607@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 171716 >Category: ports >Synopsis: [patch] finance/trytond: some tunning >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: update >Submitter-Id: current-users >Arrival-Date: Mon Sep 17 16:10:08 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Boris Samorodov >Release: FreeBSD 10.0-CURRENT >Organization: BSDprint >Environment: FreeBSD bsam.wart.ru 10.0-CURRENT FreeBSD 10.0-CURRENT #34 r240285: Mon Sep 10 01:59:39 SAMT 2012 bsam@bsam.wart.ru:/usr/obj/usr/src/sys/BBX i386 >Description: Great work was done to create the port. However some tunning should be done to let the port run at vanilla system. Those are the problems I tried to overcome. The rc.d script exists at the files directory but is not used so far. The configuration file exists at the distribution file but is not used so far. There is no definition at UIDs file for the user "trytond" defined at rc.d script (the script can not start without that definition). Commands "stop" and "status" can not be used for rc.d script. The option for py-OpenSSL is misspelled. >How-To-Repeat: Install the port at vanilla system. >Fix: . create gid and uid for tryton daemon and use them via USERS and GROUPS variables at Makefile; . install the existing rc.d script (define USE_RC_SUBR at Makefile); . define the command_interpreter variable at the rc.d script (stop and status commands need it); . create needed directories at trytond_prestart (rc.d script) with appropriate gid and launch install once; . rename option OPENSSL -> PYOPENSSL (the former is used for OpenSSL itself); . make use of configuration and sample file (both for the port and for the package); Note: Since now a configuration file is installed, seems that pkg-message "2)" may be changed to smth like "Use the configuration file %%PREFIX%%/etc/trytond.conf to customize the daemon." Patch attached with submission follows: Index: GIDs =================================================================== --- GIDs (revision 304402) +++ GIDs (working copy) @@ -238,5 +238,6 @@ razorback:*:957: gnunet:*:958: c_icap:*:959: +trytond:*:960: nogroup:*:65533: nobody:*:65534: Index: UIDs =================================================================== --- UIDs (revision 304402) +++ UIDs (working copy) @@ -242,4 +242,5 @@ razorback:*:957:957::0:0:Razorback user:/var/run/razorback:/usr/sbin/nologin gnunet:*:958:958::0:0:GNUnet daemon:/var/lib/gnunet:/usr/sbin/nologin c_icap:*:959:959::0:0:c-icap daemon:/var/empty:/usr/sbin/nologin +trytond:*:960:960::0:0:Tryton Daemon:/var/lib/trytond:/usr/sbin/nologin nobody:*:65534:65534::0:0:Unprivileged user:/nonexistent:/usr/sbin/nologin Index: finance/trytond/files/trytond.in =================================================================== --- finance/trytond/files/trytond.in (revision 304402) +++ finance/trytond/files/trytond.in (working copy) @@ -25,6 +25,7 @@ trytond_logdir="${trytond_logdir:-"$(dirname `grep logfile %%PREFIX%%/etc/trytond.conf | awk -F "=" ' { print $2 } ' `)"}" command=%%PREFIX%%/bin/trytond +command_interpreter=%%PYTHON%% command_args="--config=${trytond_config} >/dev/null 2>&1 &" pidfile="${trytond_pidfile:-"$(grep pidfile %%PREFIX%%/etc/trytond.conf | awk -F "=" ' { print $2 } ' |sed 's/[ ]//g' )"}" @@ -34,8 +35,7 @@ trytond_prestart () { - install -d -o ${trytond_user} $(dirname "${trytond_pidfile}") - install -d -o ${trytond_user} ${trytond_logdir} + install -d -o ${trytond_user} -g ${trytond_user} $(dirname "${pidfile}") "${trytond_logdir}" } run_rc_command "$1" Index: finance/trytond/pkg-plist =================================================================== --- finance/trytond/pkg-plist (revision 304402) +++ finance/trytond/pkg-plist (working copy) @@ -494,6 +494,9 @@ %%PYTHON_SITELIBDIR%%/%%PYEASYINSTALL_EGG%%/trytond/wizard/wizard.py %%PYTHON_SITELIBDIR%%/%%PYEASYINSTALL_EGG%%/trytond/wizard/wizard.pyc %%PYTHON_SITELIBDIR%%/%%PYEASYINSTALL_EGG%%/trytond/wizard/wizard.pyo +@unexec if cmp -s %D/etc/trytond.conf.sample %D/etc/trytond.conf; then rm -f %D/etc/trytond.conf; fi +etc/trytond.conf.sample +@exec if [ ! -f %D/etc/trytond.conf ] ; then cp -p %D/%F %B/trytond.conf; fi @dirrm %%PYTHON_SITELIBDIR%%/%%PYEASYINSTALL_EGG%%/trytond/wizard @dirrm %%PYTHON_SITELIBDIR%%/%%PYEASYINSTALL_EGG%%/trytond/webdav/locale @dirrm %%PYTHON_SITELIBDIR%%/%%PYEASYINSTALL_EGG%%/trytond/webdav Index: finance/trytond/Makefile =================================================================== --- finance/trytond/Makefile (revision 304402) +++ finance/trytond/Makefile (working copy) @@ -7,7 +7,7 @@ PORTNAME= trytond PORTVERSION= 2.4.1 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= finance python MASTER_SITES= http://downloads2.tryton.org/${PORTVERSION:R}/ @@ -24,15 +24,20 @@ ${PYTHON_PKGNAMEPREFIX}polib>=0.7.0:${PORTSDIR}/devel/py-polib RUN_DEPENDS:= ${BUILD_DEPENDS} -OPTIONS_DEFINE= WEBDAV OPENSSL PYDOT PYTZ +USERS= trytond +GROUPS= trytond + +OPTIONS_DEFINE= WEBDAV PYOPENSSL PYDOT PYTZ WEBDAV_DESC= Add support for pywebdav -OPENSSL_DESC= Add support for pyOpenSSL +PYOPENSSL_DESC= Add support for pyOpenSSL PYDOT_DESC= Add support for pydot PYTZ_DESC= Add support for pytz +USE_RC_SUBR= ${PORTNAME} SUB_FILES= pkg-message SUB_LIST= PYTHON_SITELIBDIR=${PYTHON_SITELIBDIR} \ - PYEASYINSTALL_EGG=${PYEASYINSTALL_EGG} + PYEASYINSTALL_EGG=${PYEASYINSTALL_EGG} \ + PYTHON=${PYTHON_CMD} USE_PYTHON= yes USE_PYDISTUTILS=easy_install @@ -56,6 +61,10 @@ .endif post-install: + ${CP} -p ${WRKSRC}/etc/${PORTNAME}.conf ${PREFIX}/etc/${PORTNAME}.conf.sample + @if [ ! -f ${PREFIX}/etc/${PORTNAME}.conf ]; then \ + ${CP} -p ${PREFIX}/etc/${PORTNAME}.conf.sample ${PREFIX}/etc/${PORTNAME}.conf ; \ + fi @${CAT} ${PKGMESSAGE} .include <bsd.port.mk> >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201209171603.q8HG3kOv090457>