Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Sep 2012 00:57:12 +0000 (UTC)
From:      Wen Heping <wen@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r304423 - in head: . finance/trytond finance/trytond/files
Message-ID:  <201209180057.q8I0vCiM013541@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: wen
Date: Tue Sep 18 00:57:12 2012
New Revision: 304423
URL: http://svn.freebsd.org/changeset/ports/304423

Log:
  - 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
  - Make use of configuration and sample file (both for the port and for the package)
  
  PR:		171716
  Submitted by:	bsam@, Matthias Petermann <matthias@d2ux.net>(via Email)

Modified:
  head/GIDs
  head/UIDs
  head/finance/trytond/Makefile
  head/finance/trytond/files/pkg-message.in
  head/finance/trytond/files/trytond.in
  head/finance/trytond/pkg-plist

Modified: head/GIDs
==============================================================================
--- head/GIDs	Mon Sep 17 20:47:33 2012	(r304422)
+++ head/GIDs	Tue Sep 18 00:57:12 2012	(r304423)
@@ -238,5 +238,6 @@ pandora:*:956:
 razorback:*:957:
 gnunet:*:958:
 c_icap:*:959:
+trytond:*:960:
 nogroup:*:65533:
 nobody:*:65534:

Modified: head/UIDs
==============================================================================
--- head/UIDs	Mon Sep 17 20:47:33 2012	(r304422)
+++ head/UIDs	Tue Sep 18 00:57:12 2012	(r304423)
@@ -242,4 +242,5 @@ pandora:*:956:956::0:0:Pandora FMS user:
 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:trytond daemon:/var/empty:/usr/sbin/nologin
 nobody:*:65534:65534::0:0:Unprivileged user:/nonexistent:/usr/sbin/nologin

Modified: head/finance/trytond/Makefile
==============================================================================
--- head/finance/trytond/Makefile	Mon Sep 17 20:47:33 2012	(r304422)
+++ head/finance/trytond/Makefile	Tue Sep 18 00:57:12 2012	(r304423)
@@ -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 @@ BUILD_DEPENDS=	${PYTHON_SITELIBDIR}/mx/_
 		${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
@@ -43,7 +48,7 @@ USE_PYDISTUTILS=easy_install
 RUN_DEPENDS+=	${PYTHON_PKGNAMEPREFIX}PyWebDAV>=0:${PORTSDIR}/www/py-pywebdav
 .endif
 
-.if ${PORT_OPTIONS:MOPENSSL}
+.if ${PORT_OPTIONS:MPYOPENSSL}
 RUN_DEPENDS+=	${PYTHON_PKGNAMEPREFIX}openssl>=0:${PORTSDIR}/security/py-openssl
 .endif
 
@@ -56,6 +61,11 @@ RUN_DEPENDS+=	${PYTHON_PKGNAMEPREFIX}pyt
 .endif
 
 post-install:
-		@${CAT} ${PKGMESSAGE}
+	${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>

Modified: head/finance/trytond/files/pkg-message.in
==============================================================================
--- head/finance/trytond/files/pkg-message.in	Mon Sep 17 20:47:33 2012	(r304422)
+++ head/finance/trytond/files/pkg-message.in	Tue Sep 18 00:57:12 2012	(r304423)
@@ -5,9 +5,8 @@ Before you start the trytond server, you
 
 1) Install a PostgreSQL server.
 
-2) Edit the file :
-%%PYTHON_SITELIBDIR%%/%%PYEASYINSTALL_EGG%%/trytond/config.py
-based on the configuration of your PostgreSQL server.
+2) Use the configuration file %%PREFIX%%/etc/trytond.conf
+to customize the daemon.
 
 For more information, see the DOCUMENTATION:
 

Modified: head/finance/trytond/files/trytond.in
==============================================================================
--- head/finance/trytond/files/trytond.in	Mon Sep 17 20:47:33 2012	(r304422)
+++ head/finance/trytond/files/trytond.in	Tue Sep 18 00:57:12 2012	(r304423)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-# $FreeBSD$
+# $FreeBSD: ports/finance/trytond/files/trytond.in,v 1.1 2012/08/18 07:18:24 wen Exp $
 #
 # PROVIDE: trytond
 # REQUIRE: postgresql LOGIN
@@ -25,6 +25,7 @@ trytond_user="${trytond_user:-"trytond"}
 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 @@ start_precmd="${name}_prestart"
 
 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"

Modified: head/finance/trytond/pkg-plist
==============================================================================
--- head/finance/trytond/pkg-plist	Mon Sep 17 20:47:33 2012	(r304422)
+++ head/finance/trytond/pkg-plist	Tue Sep 18 00:57:12 2012	(r304423)
@@ -494,6 +494,9 @@ bin/trytond
 %%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



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