From owner-freebsd-ports-bugs@FreeBSD.ORG Thu Dec 15 15:10:06 2005 Return-Path: X-Original-To: freebsd-ports-bugs@hub.freebsd.org Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2ACC516A41F for ; Thu, 15 Dec 2005 15:10:06 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 509FD43D69 for ; Thu, 15 Dec 2005 15:10:02 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id jBFFA25N069187 for ; Thu, 15 Dec 2005 15:10:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id jBFFA223069181; Thu, 15 Dec 2005 15:10:02 GMT (envelope-from gnats) Resent-Date: Thu, 15 Dec 2005 15:10:02 GMT Resent-Message-Id: <200512151510.jBFFA223069181@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Florent Thoumie Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 502FD16A420 for ; Thu, 15 Dec 2005 15:08:44 +0000 (GMT) (envelope-from flz@xbsd.org) Received: from smtp.xbsd.org (xbsd.org [82.233.2.192]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8990D43D49 for ; Thu, 15 Dec 2005 15:08:43 +0000 (GMT) (envelope-from flz@xbsd.org) Received: from localhost (localhost.xbsd.org [127.0.0.1]) by smtp.xbsd.org (Postfix) with ESMTP id 5D6CF11ABD for ; Thu, 15 Dec 2005 16:08:42 +0100 (CET) Received: from smtp.xbsd.org ([127.0.0.1]) by localhost (srv1.xbsd.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 80329-02 for ; Thu, 15 Dec 2005 16:08:34 +0100 (CET) Received: from cream.xbsd.org (cream.xbsd.org [192.168.42.6]) by smtp.xbsd.org (Postfix) with SMTP id 74B051144D for ; Thu, 15 Dec 2005 16:08:34 +0100 (CET) Received: by cream.xbsd.org (sSMTP sendmail emulation); Thu, 15 Dec 2005 16:07:41 +0000 Message-Id: <20051215150834.74B051144D@smtp.xbsd.org> Date: Thu, 15 Dec 2005 16:07:41 +0000 From: "Florent Thoumie" To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: ports/90436: [bsd.port.mk] Add a way to handle configuration files X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Florent Thoumie List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Dec 2005 15:10:06 -0000 >Number: 90436 >Category: ports >Synopsis: [bsd.port.mk] Add a way to handle configuration files >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: update >Submitter-Id: current-users >Arrival-Date: Thu Dec 15 15:10:02 GMT 2005 >Closed-Date: >Last-Modified: >Originator: Florent Thoumie >Release: FreeBSD 6.0-RELEASE amd64 >Organization: Xbsd.org >Environment: System: FreeBSD cream.xbsd.org 6.0-RELEASE FreeBSD 6.0-RELEASE #4: Mon Dec 5 02:31:46 UTC 2005 root@cream.xbsd.org:/usr/src/sys/amd64/compile/CREAM amd64 >Description: Install configuration files from samples. Removes some ugly @exec/@unexec lines from packing lists. Make sure that these files are created both by ports and packages. Introduces two new variables : - CONF_FILES : files to be created, relative to ${PREFIX}. (default: empty) - CONF_SUFX : configuration files samples suffix. (default: .sample) Just make sure that foo.conf.sample gets installed in ${PREFIX}/etc/foo/ and set CONF_FILES= etc/foo/foo.conf. >How-To-Repeat: >Fix: --- conf_files.diff begins here --- --- /usr/ports/Mk/bsd.port.mk.orig Thu Dec 15 13:50:25 2005 +++ /usr/ports/Mk/bsd.port.mk Thu Dec 15 14:07:14 2005 @@ -1529,6 +1529,10 @@ .endif .endif +.if defined(CONF_FILES) +CONF_SUFX?= .sample +.endif + .if defined(USE_ICONV) LIB_DEPENDS+= iconv.3:${PORTSDIR}/converters/libiconv .endif @@ -3703,8 +3707,8 @@ _INSTALL_SUSEQ= check-umask install-mtree pre-su-install \ pre-su-install-script do-install install-desktop-entries \ post-install post-install-script add-plist-info \ - add-plist-docs add-plist-post install-rc-script compress-man \ - run-ldconfig fake-pkg security-check + add-plist-docs add-plist-post install-rc-script install-conf \ + compress-man run-ldconfig fake-pkg security-check _PACKAGE_DEP= install _PACKAGE_SEQ= package-message pre-package pre-package-script \ do-package post-package-script @@ -4832,6 +4836,11 @@ @${MKDIR} `${DIRNAME} ${TMPPLIST}` @if [ ! -f ${DESCR} ]; then ${ECHO_CMD} "** Missing pkg-descr for ${PKGNAME}."; exit 1; fi @>${TMPPLIST} +.if defined(CONF_FILES) +.for conf in ${CONF_FILES} + @${ECHO_CMD} "@unexec if cmp -s %D/${conf} %D/${conf}${CONF_SUFX}; then rm %D/${conf}; fi" >> ${TMPPLIST} +.endfor +.endif @for file in ${PLIST_FILES}; do \ ${ECHO_CMD} $${file} | ${SED} ${PLIST_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} >> ${TMPPLIST}; \ done @@ -4957,6 +4966,20 @@ ${ECHO_CMD} "etc/rc.d/$${i%.sh}.sh" >> ${TMPPLIST}; \ done .endif +.else + @${DO_NADA} +.endif +.endif + +.if !target(install-conf) +install-conf: +.if defined(CONF_FILES) + @${ECHO_CMD} "===> Installing configuration file(s)" + @${ECHO_CMD} "@cwd ${PREFIX}" >> ${TMPPLIST} +.for conf in ${CONF_FILES} + ${INSTALL_DATA} ${PREFIX}/${conf}${CONF_SUFX} ${PREFIX}/${conf} + @${ECHO_CMD} "@exec [ -f %D/${conf} ] || cp %D/${conf}${CONF_SUFX} %D/${conf}" >> ${TMPPLIST} +.endfor .else @${DO_NADA} .endif --- conf_files.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted: