Installing 'config' file with port

2009-03-02 Thread Jerry
I know that is is probably obviously; however, I still can not get it
to work. This is the first time I have tried to do this, so bear with
me.

I am creating a port that will install a 'config' file in the
/usr/local/etc directory. Reading through the 'Porters Handbook, I
cam across this example.

post-install:
@if [ ! -f ${PREFIX}/etc/orbit.conf ]; then \
${CP} -p ${PREFIX}/etc/orbit.conf.sample ${PREFIX}/etc/orbit.conf ; \
fi

First, when I write the 'config' file, do I place it under the ports
'files' directory and give it a .in.

Second, what do I have to do to get the file installed in the config
directory?

The program does not come with a config file by default. If that should
change, how would I go about using it instead of the one I created?

-- 
Jerry
ges...@yahoo.com

Those who can, do; those who can't, write.
Those who can't write work for the Bell Labs Record.


signature.asc
Description: PGP signature


Re: Installing 'config' file with port

2009-03-02 Thread Torfinn Ingolfsen
Hello,

On Mon, Mar 2, 2009 at 3:02 PM, Jerry ges...@yahoo.com wrote:
 I am creating a port that will install a 'config' file in the
 /usr/local/etc directory. Reading through the 'Porters Handbook, I
 cam across this example.

 post-install:
   �...@if [ ! -f ${PREFIX}/etc/orbit.conf ]; then \
        ${CP} -p ${PREFIX}/etc/orbit.conf.sample ${PREFIX}/etc/orbit.conf ; \
    fi

This is done so that the config file is not overwritten if it is
already there (think port upgrade). If the config file exists already,
just copy the *.conf.sample file without renaming it.


 First, when I write the 'config' file, do I place it under the ports
 'files' directory and give it a .in.

Yes, the files directory is a good place.
Why not simply call it 'application.conf' (if that is the name it will
have) or 'application.conf.sample'?


 Second, what do I have to do to get the file installed in the config
 directory?

copy it in the post-install target?

 The program does not come with a config file by default. If that should
 change, how would I go about using it instead of the one I created?

Change the port when you know the location and name of the file, perhaps?
However, if you think that distributing a config file with this
application wold be useful, perhaps you should talk to the upstream
developers and get them to include a config file?

HTH
-- 
Regards,
Torfinn Ingolfsen
___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org


Re: Installing 'config' file with port

2009-03-02 Thread Wesley Shields
On Mon, Mar 02, 2009 at 06:58:57PM +0100, Torfinn Ingolfsen wrote:
 Hello,
 
 On Mon, Mar 2, 2009 at 3:02 PM, Jerry ges...@yahoo.com wrote:
  I am creating a port that will install a 'config' file in the
  /usr/local/etc directory. Reading through the 'Porters Handbook, I
  cam across this example.
 
  post-install:
  ? ?...@if [ ! -f ${PREFIX}/etc/orbit.conf ]; then \
  ? ? ? ?${CP} -p ${PREFIX}/etc/orbit.conf.sample ${PREFIX}/etc/orbit.conf ; \
  ? ?fi
 
 This is done so that the config file is not overwritten if it is
 already there (think port upgrade). If the config file exists already,
 just copy the *.conf.sample file without renaming it.

Don't forget the corresponding part in pkg-plist so that the same thing
is done when the package is used.

-- WXS
___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org