From owner-freebsd-ports@FreeBSD.ORG Tue Jan 26 16:47:34 2010 Return-Path: Delivered-To: ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A287710656A6; Tue, 26 Jan 2010 16:47:34 +0000 (UTC) (envelope-from borja@pexego.es) Received: from ns205739.ovh.net (ns205739.ovh.net [94.23.33.38]) by mx1.freebsd.org (Postfix) with ESMTP id 536758FC15; Tue, 26 Jan 2010 16:47:33 +0000 (UTC) X-Bogosity: Unsure, spamicity=0.989941 X-DKIM: Sendmail DKIM Filter v2.8.3 ns205739.ovh.net o0QGkADC095401 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=pexego.es; s=pexego; t=1264524377; bh=TbJPs+mGcAn98PoE6g1eSGIWI21Kjo27brNAUyr1fiQ=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type:Content-Transfer-Encoding; b=KQF37acVuACj5SFqy429FjuuWplwdQJIYJQJPyoOD4Ef8zb3RuaYHrqGmF+wI11Sf 08drzRgrCrUjN7B2YV/I6BQQ6qbgVQx4kmqeQB3di+ekbQdRvE2IOgTSt5YeFPNzc1 EUh6jhu+w4NNnnKwGE7MbnYTFeZR2d+BYD03/SnE= Received: from albaricoque.pxgo.es (pxgoserver [213.60.87.141]) (authenticated bits=0) by ns205739.ovh.net (8.14.3/8.14.3) with ESMTP id o0QGkADC095401 (version=TLSv1/SSLv3 cipher=DHE-DSS-AES256-SHA bits=256 verify=NO); Tue, 26 Jan 2010 17:46:16 +0100 (CET) (envelope-from borja@pexego.es) Date: Tue, 26 Jan 2010 17:49:03 +0100 From: Francisco de Borja =?ISO-8859-1?Q?L=F3pez_R=EDo?= To: Doug Barton Message-Id: <20100126174903.b144472f.borja@pexego.es> In-Reply-To: <4B5BEDB1.8080308@FreeBSD.org> References: <20100120165147.666592ef.borja@pexego.es> <20100120212640.GE6618@lonesome.com> <7be7a2801001201600j5c772267na6dea944334618be@mail.gmail.com> <20100121093649.7867d810.borja@pexego.es> <20100121095114.12bab6af.borja@pexego.es> <4B5BEDB1.8080308@FreeBSD.org> Organization: Pexego Sistemas =?ISO-8859-1?Q?Inform=E1ticos?= S.L. X-Mailer: Sylpheed 2.5.0 (GTK+ 2.12.11; i386-portbld-freebsd7.0) Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: ports@freebsd.org Subject: Re: New port: finance/openerp-web X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jan 2010 16:47:34 -0000 On Sat, 23 Jan 2010 22:50:25 -0800 Doug Barton wrote: > On 01/21/10 00:51, Francisco de Borja L=F3pez R=EDo wrote: > >=20 > > Sorry, I forgot to add the attachments in my previous email. > >=20 > > These are both the rc.d script and the default configuration file I've > > been using with the current openerp-server port for some time. >=20 > A few notes on the rc.d script. >=20 > 1. The name of the file, PROVIDE, and $name should all match. Perhaps > openerpd, or even erpd? If there is no limitation on that, it should be openerp-web/openerp-server (for the web and server scripts respectively). Let me try if it works with the - > 2. There are quite a few examples of "/usr/local" in there (which is > fine for a running script), please remember to s#/usr/local#%%PREFIX%%#g > for the port. mmm, I've been taking a look at the rc.d scripts in my servers, and all of them have those absolute paths. Did you mean to set %%PREFIX%% in the rc file, or did you mean to generate the rc.d script dinamically when installing the port? > 3. The pidfile=3D should come after load_rc_config, and should look like > this: > pidfile=3D"${_pidfile:-/var/run/openerp-server/openerp-server.pid}" > (substitute of course). Or, consider not allowing the user to > change the location of the pidfile unless there is a good reason to do so. mmm I do something similar to that, first, before load_rc_config, I set pidfile: pidfile=3D"${openerpserver_pidfile}" Then I set openerpserver_pidfile, after the load_rc_config: openerpserver_pidfile=3D ${openerpserver_pidfile:-"/var/run/openerp-server/= openerp-server.pid"} I don't remember exactly where (probably somewhere in the porters handbook), but I've read that the order is not a problem (using openerpserver_pidfile before setting it) (IIRC) > 4. I'm not quite sure what eval "${rcvar}=3D\${${rcvar}:-'NO'}" is > supposed to accomplish, but if it's "set ${name}_enable to NO by > default" it's too clever by half. :) Take a look at > http://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/rc-scri= pts.html > for other ways to simplify the default variable assignments (as well as > some other pointers). I got that from this article: http://www.freebsd.org/doc/en_US.ISO8859-1/articles/rc-scripting/rcng-confd= ummy.html (check point 3) Perhaps it is not needed tough. > 5. Just doing 'touch foo' is always cheaper than testing its existence > first (although it's a micro-optimization) and there is no reason to > test existence anyway. Same goes with the 'mkdir -p'. mmm, you are right, but if you try to create a directory that already exist, a message about the already-existing directory will appear (blabla File exists). IMHO it is always better to check before proceed :) > 6. Instead of `dirname blah` you should use ${blah%/*} for two reasons, > first dirname(1) is in /usr/bin, and may not be available at boot, and > two there is no reason to use it in a shell script when the variable > substitution is cheaper and easier. I got the dirname idea from the milter-bogom port rc.d script. It seemed reasonable for me ;). Anyway, with variable substitution you meant, for example, setting a variable for the directory where the pidfile will be saved, then use that variable when creating the pidfile variable? I mean, instead of: openerpweb_pidfile=3D ${openerpweb_pidfile:-"/var/run/openerp-web/openerp-w= eb.pid"} doing something like: piddir=3D"/var/run/openerp-web/" openerpweb_pidfile=3D${openerpweb_pidfile:-"${piddir}openerp-web.pid"} Then, instead of `dirname ${openerpweb_pidfile}` the script could check only for ${piddir} Was this the idea? > 7. You named your substitute stop_cmd "${name}_poststop" which is > confusing, and I'm not sure why it's necessary. If you're afraid that > rc.d isn't going to actually stop the process for some reason we should > address that. If you feel that you absolutely must have a safety belt > for this make it a real stop_postcmd. Typo, it should be _stop (will be fixed in just a matter of minutes :D, thnx for the report) > I realize that these are a lot of notes, but don't worry ... it's easy > to see that a lot of thought and creativity went into this, which is why > I'm taking the time to try and help improve it. That's exactly what I want, I'm working in more scripts and stuff, so learning some basic stuff before going any further is always a good thing. I've found some more issues while using more and more the port and the scripts, for example, the openerp-server port should create a new account _openerp (to use my rc.d script properly) and the openerp-web port should check if the user exist and, if not, create it (useful for servers that will serve the web client, connecting to a remote openerp server). I'm working on improved versions of the script, will send them soon to the list. Thnk you a lot Doug (And thnx for the portmaster tool too! ;D) >=20 > Doug >=20 > --=20 >=20 > Improve the effectiveness of your Internet presence with > a domain name makeover! http://SupersetSolutions.com/ >=20 > Computers are useless. They can only give you answers. > -- Pablo Picasso >=20 > _______________________________________________ > freebsd-ports@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-ports > To unsubscribe, send any mail to "freebsd-ports-unsubscribe@freebsd.org" --=20 "Do nothing which is of no use." - Miyamoto Musashi --------------------------------------------------------------------- Francisco de Borja Lopez Rio (borja@pexego.es) Pexego Sistemas Informaticos S.L. http://www.pexego.es