From owner-freebsd-ports@FreeBSD.ORG Mon Oct 2 14:11:07 2006 Return-Path: X-Original-To: freebsd-ports@freebsd.org Delivered-To: freebsd-ports@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0C25716A412 for ; Mon, 2 Oct 2006 14:11:07 +0000 (UTC) (envelope-from swhetzel@gmail.com) Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.175]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6ABB643D4C for ; Mon, 2 Oct 2006 14:11:05 +0000 (GMT) (envelope-from swhetzel@gmail.com) Received: by ug-out-1314.google.com with SMTP id m2so463937uge for ; Mon, 02 Oct 2006 07:11:04 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=B+AnQZ1OZpIBSJx6eyFIg55Ram2lQsmmWZYWthps67HJJ+gAvbMPBRDS+RJ0VNk98kDO8M8/MemxE2E6BL3fq6fyinLj39yErcW1v5BYI5sLgtUAunVB8K1LSUZ6P+WDmknxNWADo4apU6jNnXpaejyRyqE8BqCZCGG4dqwbGOQ= Received: by 10.67.101.8 with SMTP id d8mr5307872ugm; Mon, 02 Oct 2006 07:11:04 -0700 (PDT) Received: by 10.67.86.15 with HTTP; Mon, 2 Oct 2006 07:11:04 -0700 (PDT) Message-ID: <790a9fff0610020711w53b64c98ja9fae62b3a353160@mail.gmail.com> Date: Mon, 2 Oct 2006 09:11:04 -0500 From: "Scot Hetzel" To: "Markus Dolze" In-Reply-To: <4520B0ED.1070607@nurfuerspam.de> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <4520B0ED.1070607@nurfuerspam.de> Cc: freebsd-ports@freebsd.org Subject: Re: Current usage of sysconfdir 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: Mon, 02 Oct 2006 14:11:07 -0000 On 10/2/06, Markus Dolze 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.