From owner-freebsd-ports-bugs@FreeBSD.ORG Fri Dec 24 11:50:20 2004 Return-Path: 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 1276616A4CF for ; Fri, 24 Dec 2004 11:50:20 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id D026143D41 for ; Fri, 24 Dec 2004 11:50:19 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.1/8.13.1) with ESMTP id iBOBoJnB007974 for ; Fri, 24 Dec 2004 11:50:19 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.1/8.13.1/Submit) id iBOBoJVu007973; Fri, 24 Dec 2004 11:50:19 GMT (envelope-from gnats) Resent-Date: Fri, 24 Dec 2004 11:50:19 GMT Resent-Message-Id: <200412241150.iBOBoJVu007973@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, dirk.meyer@dinoex.sub.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1BEEE16A4CE for ; Fri, 24 Dec 2004 11:45:43 +0000 (GMT) Received: from uucp.dinoex.sub.de (uucp.dinoex.sub.de [194.45.71.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id CCEE743D54 for ; Fri, 24 Dec 2004 11:45:41 +0000 (GMT) (envelope-from dm@home.dinoex.sub.de) Received: from home.dinoex.sub.de (home.dinoex.sub.de [194.45.71.22]) by uucp.dinoex.sub.de (8.13.2/8.13.2) with ESMTP id iBOBjAsi056355 for ; Fri, 24 Dec 2004 12:45:10 +0100 (CET) (envelope-from dm@home.dinoex.sub.de) Received: (from dm@localhost) by home.dinoex.sub.de (8.13.2/8.13.1/Submit) id iBOBjEJh068541; Fri, 24 Dec 2004 12:45:14 +0100 (CET) (envelope-from dm) Message-Id: <200412241145.iBOBjEJh068541@home.dinoex.sub.de> Date: Fri, 24 Dec 2004 12:45:14 +0100 (CET) From: dirk.meyer@dinoex.sub.org To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: ports/75464: bsd.port.mk install default configuration files X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: dirk.meyer@dinoex.sub.org List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Dec 2004 11:50:20 -0000 >Number: 75464 >Category: ports >Synopsis: bsd.port.mk install default configuration files >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Fri Dec 24 11:50:19 GMT 2004 >Closed-Date: >Last-Modified: >Originator: Dirk Meyer >Release: FreeBSD 4.11-PRERELEASE i386 >Organization: privat >Environment: FreeBSD ports >Description: - add new features: PORTEXAMPLES, similar to PORTDOCS ETC_DEFAULT_FILES for default configuration files >How-To-Repeat: Install all sample files not in etc, but in /usr/local/share/examples//default/ eg in the apache13-modssl port you like to specify: ETC_DEFAULT_FILES = \ apache/access.conf apache/httpd.conf \ apache/magic apache/mime.types \ apache/srm.conf \ rc.d/apache.sh bsd.port.mk will handle: - the pkg-plist entrys for the samples - the installation when the coresponding files in /usr/local/etc/ does not exist. - the deinstalltion check, preserving existing configuration files. - create and removal of subdirectories. >Fix: apply this patch: Index: bsd.port.mk =================================================================== RCS file: /home/pcvs/ports/Mk/bsd.port.mk,v retrieving revision 1.502 diff -u -r1.502 bsd.port.mk --- bsd.port.mk 23 Dec 2004 01:35:38 -0000 1.502 +++ bsd.port.mk 24 Dec 2004 11:34:10 -0000 @@ -553,6 +553,28 @@ # installed (for example because NOPORTDOCS is defined). # Useful for dynamically generated documentation. # +# Set the following to specify all documentation your port installs into +# ${EXAMPLESDIR} +# +# PORTEXAMPLES - A list of files and directories relative to EXAMPLESDIR. +# Shell glob patterns can be used, directories include +# the entire subtree of contained files and directories. +# Useful for dynamically generated examples. +# +# ETC_DEFAULT_DIR - A directory relative to EXAMPLESDIR, which contains +# default configuration files. +# Default: "default" +# +# ETC_TARGET_DIR - A directory relative to PREFIX, which contains +# configuration files for this port at runtime +# Default: "etc" +# +# ETC_DEFAULT_FILES - A list of files that are installed relative to +# ETC_DEFAULT_DIR, to create a default configuration +# when this config file is not present in +# ETC_TARGET_DIR. This files are removed on deinstall +# only when they have not beenn altered. +# # Default targets and their behaviors: # # fetch - Retrieves ${DISTFILES} (and ${PATCHFILES} if defined) @@ -3645,7 +3667,8 @@ _INSTALL_SUSEQ= check-umask install-mtree pre-su-install \ pre-su-install-script do-install post-install \ post-install-script add-plist-info add-plist-docs \ - add-plist-post compress-man run-ldconfig fake-pkg security-check + add-plist-examples add-plist-post compress-man \ + fake-pkg security-check _PACKAGE_DEP= install _PACKAGE_SEQ= package-message pre-package pre-package-script \ do-package post-package-script @@ -4758,6 +4781,57 @@ .endif .endif +add-plist-docs: add-plist-examples + +.if !target(add-plist-examples) +add-plist-examples: +.if defined(PORTEXAMPLES) + @if ${EGREP} -qe '^@cw?d' ${TMPPLIST} && \ + [ "`${SED} -En -e '/^@cw?d[ ]*/s,,,p' ${TMPPLIST} | ${TAIL} -n 1`" != "${PREFIX}" ]; then \ + ${ECHO_CMD} "@cwd ${PREFIX}" >> ${TMPPLIST}; \ + fi +.if defined(ETC_DEFAULT_FILES) + @${FIND} -P ${ETC_DEFAULT_FILES:S/^/${EXAMPLESDIR_ETC}\//} ! -type d | \ + while read sample; do \ + src="%D/$${sample#${PREFIX}/}"; \ + dst="%D/${ETC_TARGET_DIR}$${sample#${EXAMPLESDIR_ETC}}"; \ + echo '@unexec if cmp -s "'$${dst}'" "'$${src}'"; then rm -f "'$${dst}'"; else echo "preserving '$${dst}'" >&2; fi';\ + done >> ${TMPPLIST} +.endif + @${FIND} -P ${PORTEXAMPLES:S/^/${EXAMPLESDIR}\//} ! -type d | \ + ${SED} -ne 's,^${PREFIX}/,,p' >> ${TMPPLIST} +.if defined(ETC_DEFAULT_FILES) + @${FIND} -P -d ${EXAMPLESDIR_ETC} -type d | \ + while read dir; do \ + dst="${ETC_TARGET_DIR}$${dir#${EXAMPLESDIR_ETC}}"; \ + etc="${ETC_DEFAULT_DIR}"; \ + if [ "$${#dst}" -gt "$${#etc}" ]; then echo '@exec mkdir -p "'$${dst}'"'; fi; \ + done >> ${TMPPLIST} + @${FIND} -P ${ETC_DEFAULT_FILES:S/^/${EXAMPLESDIR_ETC}\//} ! -type d | \ + while read sample; do \ + src="%D/$${sample#${PREFIX}/}"; \ + dst="%D/${ETC_TARGET_DIR}$${sample#${EXAMPLESDIR_ETC}}"; \ + echo '@exec [ ! -f "'$${dst}'" ] && cp "'$${src}'" "'$${dst}'"';\ + done >> ${TMPPLIST} + @${FIND} -P -d ${EXAMPLESDIR_ETC} -type d | \ + while read dir; do \ + dst="${ETC_TARGET_DIR}$${dir#${EXAMPLESDIR_ETC}}"; \ + etc="${ETC_DEFAULT_DIR}"; \ + if [ "$${#dst}" -gt "$${#etc}" ]; then echo "@unexec rmdir %D/$${dst} 2>/dev/null || true"; fi; \ + dst="$${dir#${PREFIX}/}"; \ + echo "@dirrm $${dst}"; \ + done >> ${TMPPLIST} +.endif + @${FIND} -P -d ${PORTEXAMPLES:S/^/${EXAMPLESDIR}\//} -type d | \ + ${SED} -ne 's,^${PREFIX}/,@dirrm ,p' >> ${TMPPLIST} + @if [ -d "${EXAMPLESDIR}" ]; then \ + ${ECHO_CMD} "@unexec rmdir %D/${EXAMPLESDIR:S,^${PREFIX}/,,} 2>/dev/null || true" >> ${TMPPLIST}; \ + fi +.else + @${DO_NADA} +.endif +.endif + # If we're installing into a non-standard PREFIX, we need to remove that directory at # deinstall-time add-plist-post: >Release-Note: >Audit-Trail: >Unformatted: