From c39f14401355954a0c5d01b7a2a0a655ee06a993 Mon Sep 17 00:00:00 2001
From: "Marc G. Fournier" <scrappy@FreeBSD.org>
Date: Sat, 15 Apr 2006 16:23:50 +0000
Subject: After a recent discussion on freebsd-ports, I have modified the Horde
 ports, so that they now do not overwrite existing configuration files. Rather
 than backing up the old ones and allowing the user to merge the files by
 hand, config files are left untouched.

Submitted by:   Shaun Amott <shaun@inerd.com>
---
 mail/ingo/Makefile               | 11 ++++-------
 mail/ingo/files/pkg-deinstall.in |  9 +++------
 mail/ingo/files/pkg-install.in   | 23 +++++++++++++++++++++++
 mail/ingo/pkg-plist              |  3 ---
 4 files changed, 30 insertions(+), 16 deletions(-)
 create mode 100644 mail/ingo/files/pkg-install.in

(limited to 'mail/ingo')

diff --git a/mail/ingo/Makefile b/mail/ingo/Makefile
index a588201045ea..cb777f1eba0f 100644
--- a/mail/ingo/Makefile
+++ b/mail/ingo/Makefile
@@ -20,7 +20,7 @@ MASTER_SITES=	ftp://ftp.horde.org/pub/ingo/				\
 DISTNAME=	${PORTNAME}-h3-${PORTVERSION}
 
 MAINTAINER=	shaun@inerd.com
-COMMENT=	Horde's email-filter management application
+COMMENT=	Horde\'s email-filter management application
 
 #-----------------------------------------------------------------------
 # You may define this option:
@@ -39,7 +39,7 @@ USE_APACHE=	1.3+	# needed to test APACHE_VERSION
 PLIST_SUB=	INGODIR=${LINGODIR}  HORDE_INC=${HORDE_INC:S|^${LOCALBASE}/||}
 PKGMESSAGE=	${WRKDIR}/pkg-message
 PKGDEINSTALL=	${WRKDIR}/pkg-deinstall
-SUB_FILES=	pkg-message pkg-deinstall
+SUB_FILES=	pkg-message pkg-install pkg-deinstall
 SUB_LIST=	INGODIR=${INGODIR}
 
 DOCS=		LICENSE README docs/CHANGES docs/CREDITS docs/INSTALL	\
@@ -76,11 +76,7 @@ do-install:
 	@${CP} -Rp ${WRKSRC}/${REP} ${INGODIR}
 .endfor
 	@${CP} -p  ${WRKSRC}/*.php ${INGODIR}
-.for FILE in ${CONFFILE}
-	@if [ ! -f ${CONFDIR}/${FILE} ]; then \
-	  ${CP} ${CONFDIR}/${FILE}.dist ${CONFDIR}/${FILE} ; \
-	fi
-.endfor
+
 	@${CHOWN} -R ${WWWOWN}:${WWWGRP} ${INGODIR}
 	@${CHMOD} -R o-rwx ${CONFDIR}
 	@${INSTALL_DATA} ${WRKDIR}/httpd-ingo.conf ${HORDE_INC}
@@ -93,6 +89,7 @@ do-install:
 .endif
 
 post-install:
+	@${SETENV} ${SCRIPTS_ENV} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
 	@${ECHO_MSG}
 	@${CAT} ${PKGMESSAGE}
 	@${ECHO_MSG}
diff --git a/mail/ingo/files/pkg-deinstall.in b/mail/ingo/files/pkg-deinstall.in
index 2289e8963491..9d8d08de9224 100644
--- a/mail/ingo/files/pkg-deinstall.in
+++ b/mail/ingo/files/pkg-deinstall.in
@@ -12,13 +12,10 @@ if [ -z "${PACKAGE_BUILDING}" ]; then
   for cf in `ls %%INGODIR%%/config/*php`; do
     diff -bBqw $cf $cf.dist >/dev/null 2>&1
     case $? in
-      0)  # original config file, will be deleted by pkg-plist
+      0)  # original config file, delete it
+          rm -f $cf
           ;;
-      1)  # config file has been updated, must be backuped
-          cp -p $cf $cf.previous
-          echo "===> Backing-up..."
-          echo "--->   $cf has been saved ***"
-          echo "--->      as $cf.previous ***"
+      1)  # config file has been updated, leave it alone
           ;;
       *)  # not found?
           ;;
diff --git a/mail/ingo/files/pkg-install.in b/mail/ingo/files/pkg-install.in
new file mode 100644
index 000000000000..3a7bcda4b76a
--- /dev/null
+++ b/mail/ingo/files/pkg-install.in
@@ -0,0 +1,23 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+PATH=/usr/sbin:/usr/bin:/bin ; export PATH
+
+case $2 in
+    PRE-INSTALL)
+    ;;
+
+    POST-INSTALL)
+        if [ -z "${PACKAGE_BUILDING}" ]; then
+            # Copy over sample config files unless they already exist
+
+            for cf in `ls %%INGODIR%%/config/*.dist | sed -e 's/\.dist//g'`; do
+                if [ ! -f $cf ]; then
+                    cp -p $cf.dist $cf
+                fi
+            done
+        fi
+    ;;
+esac
diff --git a/mail/ingo/pkg-plist b/mail/ingo/pkg-plist
index d2a668f47dae..cf0f451d0826 100644
--- a/mail/ingo/pkg-plist
+++ b/mail/ingo/pkg-plist
@@ -8,12 +8,9 @@
 %%PORTDOCS%%%%DOCSDIR%%/TODO
 %%INGODIR%%/blacklist.php
 %%INGODIR%%/config/.htaccess
-%%INGODIR%%/config/backends.php
 %%INGODIR%%/config/backends.php.dist
 %%INGODIR%%/config/conf.xml
-%%INGODIR%%/config/fields.php
 %%INGODIR%%/config/fields.php.dist
-%%INGODIR%%/config/prefs.php
 %%INGODIR%%/config/prefs.php.dist
 %%INGODIR%%/filters.php
 %%INGODIR%%/forward.php
-- 
cgit v1.2.3