procname when ruby is used

Steve Wills swills at FreeBSD.org
Wed Aug 29 19:57:38 UTC 2012


On 08/29/12 15:39, Steve Wills wrote:
> On 08/29/12 15:28, Steve Wills wrote:
>> Hi,
>>
>> I've encountered a situation with an rc script that I'm not sure how to
>> solve. The issue is summarized well in this PR:
>>
>> http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/170980
>>
>> Basically, the "ruby" that's in use can vary because ruby 1.8 or ruby
>> 1.9 may be used. There may be "ruby", "ruby18" or "ruby19" or perhaps
>> other things. There is a function in the bsd.ruby.mk that replaces the
>> shebang lines of ruby scripts, causing the issue in the PR (which I've
>> verified). I'm not sure how I can change the rc script to accommodate
>> the variance. Any suggestions?
>>
> 
> Naturally I come up with a workaround just after sending...
> 
> name="mcollectived"
> command="%%PREFIX%%/sbin/${name}"
> procname="%%PREFIX%%/bin/`head -n1 ${command} | sed -e 's,.*/,,'`"
> 
> rc people, is this too ugly? :)
> 

Sorry for the spam. Someone on IRC suggested a cleaner way:

name="mcollectived"
command="%%PREFIX%%/sbin/${name}"
read procname <"${command}"
procname="%%PREFIX%%/bin/${procname##*/}"

Opinions?

Steve


More information about the freebsd-ruby mailing list