Date: Mon, 2 Oct 2006 09:11:04 -0500 From: "Scot Hetzel" <swhetzel@gmail.com> To: "Markus Dolze" <bsdfan@nurfuerspam.de> Cc: freebsd-ports@freebsd.org Subject: Re: Current usage of sysconfdir Message-ID: <790a9fff0610020711w53b64c98ja9fae62b3a353160@mail.gmail.com> In-Reply-To: <4520B0ED.1070607@nurfuerspam.de> References: <4520B0ED.1070607@nurfuerspam.de>
next in thread | previous in thread | raw e-mail | index | archive | help
On 10/2/06, Markus Dolze <bsdfan@nurfuerspam.de> wrote: > Hello, > > one port I am maintaining recently started using the sysconfdir set by > GNU configure script to install default config files. > > By just using it, it will override user changed config files. > > I am thinking of using passing "--sysconfig=${EXAMPLESDIR}" as > CONFIGURE_ARGS. > > Is EXAMPLESDIR a good/valid location? Should I print some message > pointing the user to this directory? > While EXAMPLESDIR would be a good location for the example config files, the problem is that when you set --sysconfig=${EXAMPLESDIR}, the program will look in EXAMPLESDIR for the config files, instead of the default location (usually PREFIX/etc) for the config files. > I am not sure if it has any side effects (used somewhere within the > code), but I will check for this. > It is usually used within the code to locate where the config files are located. > > What is best current practice of installing default config files for > FreeBSD ports? > The current practice is to patch the source Makefile (1) that is installing the default config files so that they end in "-dist" (2). Then add a check to the ports Makefile to see if there is already a config file installed, if not then copy the example.conf-dist to example.conf. Finally, the pkg-plist file is also changed so that it can create/remove the example.conf file at package creation/removal. pkg-plist: @unexec if cmp -s %D/etc/example.conf %D/etc/example.conf-dist; then rm -f %D/example.conf; fi etc/example.conf-dist @exec [ -f %D/etc/example.conf ] || cp %D/etc/example.conf-dist %D/etc/example.conf Another way that is used by the www/apache22 port, which is to patch the source Makefile (3), so that it installs the default config files in the EXAMPLESDIR, and then tests if theses files exists in PREFIX/etc/apache22, and copy the default config files to this directory when they don't exist. Again the pkg-plist is modified to create/remove the config files from PREFIX/etc/apache22 depending on if they exist. pkg-plist: @unexec if cmp -s %D/etc/apache22/httpd.conf %D/%%EXAMPLESDIR%%/httpd.conf; then rm -f %D/etc/apache22/httpd.conf; fi %%EXAMPLESDIR%%/httpd.conf @exec [ -f %D/etc/apache22/httpd.conf ] || cp %D/%%EXAMPLESDIR%%/httpd.conf %D/etc/apache22/httpd.conf Notes: (1) see www/apache13/files/patch-ab (poor example, as it changes .default to -dist) (2) "-dist" is not standard, as some maintainers use [.-][dist,example,orig,....] (3) see www/apache22/files/patch-Makefile.in Having the example config files in the EXAMPLESDIR would make PREFIX/etc cleaner, as all of the [.-][dist,example,orig,default,...] files wouldn't be there to clutter up that directory. Only problem is that administrators will need to know to look in these 2 directories (PREFIX/etc/, EXAMPLESDIR) for the config files (working copy, example copy), which is solved by displaying a note in PKG_MESSAGE about the EXAMPLESDIR location. Scot -- DISCLAIMER: No electrons were mamed while sending this message. Only slightly bruised.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?790a9fff0610020711w53b64c98ja9fae62b3a353160>