Conflicting rc.d script and port dist directory

Doug Barton dougb at FreeBSD.org
Sun Dec 18 01:26:20 PST 2005


Scot Hetzel wrote:

>>> Simon L. Nielsen pí?e v so 17. 12. 2005 v 21:10 +0100:
>>>> Hey,
>>>>
>>>> I'm in the process of adding an rc.d script to the security/isakmpd
>>>> port, but I have run into a problem.
>>>>
>>>> I have added "USE_RC_SUBR= isakmpd" to the port Makefile and created
>>>> the rc.d script as files/isakmpd.in.
>>>>
>>>> The isakmpd distfile extracts the source to isakmpd/ in the the work
>>>> directory, which the conflicts with the rc.d script generation
>>>> (SUB_FILES), since it tries to create ${WRKDIR}/${file} as a file.

Simon, I ran into this working on the compat[45]x ports, FYI. I'm sorry you 
ran into the same problem, but it tells me that this is a bigger problem 
than I first thought it would be, so it needs a more comprehensive solution. 
For now, you're safe naming the file isakmpd.sh.in.

> I don't see this as a hack. Any rc.d script placed in ${WORK}
> directory should have the .sh extention to avoid conflicts with
> similar named directories.  When the port installs the rc.d script, it
> should check OSVERSION to determine if the script should be
> installed/not-installed with the .sh suffix.

We had a good discussion about this topic on freebsd-rc Friday night, here's 
what I'm thinking. In a world way down the road when both the ports and base 
infrastructures are updated, and all the ports with boot scripts are fixed, 
we'll likely revert the change which runs all scripts in a subshell, and 
restore the differentiation between scripts named foo, and those named 
foo.sh. Namely that the latter will be sourced into the rc shell, and the 
former run in a subshell. We'd like to have this same facility available to 
port authors, as there may be a good reason for a port to do this. Thus, we 
want to be able to support both ways of installing boot scripts for ports.

Still thinking down the road, I think what we want is for the file in files/ 
to be named <filename>.in, with <filename> as whatever the port wants to be 
installed as, foo, or foo.sh. The file that goes in WRKDIR should probably 
be named something like <filename>.out, rather than just <filename>, 
regardless of what the filename wants to be. Then, the ports infrastructure 
can take <filename>.out and install it. If it's being installed on a 
pre-local_startup-MFC system, it should always be installed as foo.sh. If 
it's on a post local_startup system, it should be installed as either foo or 
foo.sh based on <filename>.in.

If we agree that this is where we want to end up, then we have to decide how 
we want to get there. I would suggest that we make the change to 
$WRKDIR/<filename>.out immediately (or whatever suffix y'all want to use). 
Then we can start fixing the filenames in all the ports that already have 
USE_RC_SUBR. Then we can go to work on the ports that haven't been converted 
yet. At some point in this equation we have to add the code to bsd.port.mk 
that determines whether to install foo or foo.sh based on OSVERSION, but I'm 
not as concerned about the timing of that change because the base rc code 
already runs everything in a subshell, and so far I haven't heard anyone 
clamoring to run a foo.sh script that gets sourced into the shell.

I hope that this is useful. I'm sure that there are still some more corner 
cases that need to be worked out, but I'm excited that we're making progress.

Doug

-- 

     This .signature sanitized for your protection



More information about the freebsd-ports mailing list