Subject: pkg/28978: mail/nmh fixes to honour PKG_SYSCONFBASE
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: Greg A. Woods <woods@weird.com>
List: pkgsrc-bugs
Date: 01/16/2005 07:33:00
>Number: 28978
>Category: pkg
>Synopsis: mail/nmh fixes to honour PKG_SYSCONFBASE
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: pkg-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Jan 16 07:33:00 +0000 2005
>Originator: Greg A. Woods
>Release: pkgsrc-2004Q4
>Organization:
Planix, Inc.; Toronto, Ontario; Canada
>Environment:
System: NetBSD
>Description:
mail/nmh doesn't honour PKG_SYSCONFBASE
>How-To-Repeat:
set PKG_SYSCONFBASE=/etc, install stuff, and then look in
$PREFIX/etc for junk that shouldn't be there...
>Fix:
this is my Sat. night contribution -- others that really irk me,
(but which I'm afraid to try to hack on because they are GNOME :-)
are gnome-libs and gnome-iconedit
cvs diff: Diffing mail/nmh
Index: mail/nmh/DEINSTALL
===================================================================
RCS file: mail/nmh/DEINSTALL
diff -N mail/nmh/DEINSTALL
--- mail/nmh/DEINSTALL 30 Aug 2003 20:22:57 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,22 +0,0 @@
-#!/bin/sh
-#
-# $NetBSD: DEINSTALL,v 1.2 2003/08/30 20:22:57 jlam Exp $
-
-PKGNAME=$1
-STAGE=$2
-
-case ${STAGE} in
-POST-DEINSTALL)
- CONFDIR=${PKG_PREFIX}/etc/nmh
-
- cat << EOF
-===========================================================================
-If you won't be using ${PKGNAME} any longer, you may want to remove the
-following directories:
-
- ${CONFDIR}
-===========================================================================
-EOF
- ;;
-esac
-exit 0
Index: mail/nmh/INSTALL
===================================================================
RCS file: mail/nmh/INSTALL
diff -N mail/nmh/INSTALL
--- mail/nmh/INSTALL 30 Aug 2003 20:22:57 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,42 +0,0 @@
-#! /bin/sh
-#
-# $NetBSD: INSTALL,v 1.3 2003/08/30 20:22:57 jlam Exp $
-#
-
-PKGNAME=$1
-STAGE=$2
-
-case ${STAGE} in
-POST-INSTALL)
- CONFDIR=${PKG_PREFIX}/etc/nmh
-
- echo "Installing configuration files:"
- for file in \
- mhn.defaults \
- mts.conf
- do
- if [ -f ${CONFDIR}/${file} ]
- then
- echo " ${CONFDIR}/${file} already exists"
- else
- echo " ${CONFDIR}/${file}"
- cp ${CONFDIR}/${file}.dist ${CONFDIR}/${file}
- chmod 644 ${CONFDIR}/${file}
- fi
- done
- cat << EOF
-=============================================================
-
-Some files you might need to customize include the following:
-
- ${PKG_PREFIX}/etc/nmh/mhn.defaults
- ${PKG_PREFIX}/etc/nmh/mts.conf
-
-In particular, edit mts.conf to point to an available SMTP
-server if you are not running one locally.
-
-=============================================================
-EOF
- ;;
-esac
-exit 0
Index: mail/nmh/Makefile
===================================================================
RCS file: /cvs/master/m-NetBSD/main/pkgsrc/mail/nmh/Makefile,v
retrieving revision 1.54
diff -u -r1.54 Makefile
--- mail/nmh/Makefile 2 Jan 2004 20:54:17 -0000 1.54
+++ mail/nmh/Makefile 16 Jan 2005 05:17:16 -0000
@@ -26,9 +26,14 @@
# Mail Transport Agent - either "smtp" or "sendmail"
NMH_MTA?= smtp
+USE_PKGINSTALL = YES
+PKG_SYSCONFSUBDIR = nmh
+
+EGDIR = ${PREFIX}/share/examples/nmh
+
GNU_CONFIGURE= # defined
CONFIGURE_ARGS+= --libdir=${PREFIX}/libexec/nmh
-CONFIGURE_ARGS+= --sysconfdir=${PREFIX}/etc/nmh
+CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR}
CONFIGURE_ARGS+= --enable-nmh-pop
CONFIGURE_ARGS+= --with-mts=${NMH_MTA}
@@ -54,6 +59,39 @@
BUILD_DEFS+= NMH_MTA NMH_EDITOR NMH_PAGER NMH_HASH_BACKUP
+CONFS = MailAliases \
+ components \
+ digestcomps \
+ distcomps \
+ forwcomps \
+ mhl.body \
+ mhl.digest \
+ mhl.format \
+ mhl.forward \
+ mhl.headers \
+ mhl.reply \
+ mhn.defaults \
+ mts.conf \
+ rcvdistcomps \
+ rcvdistcomps.outbox \
+ replcomps \
+ replgroupcomps \
+ scan.MMDDYY \
+ scan.YYYYMMDD \
+ scan.default \
+ scan.mailx \
+ scan.nomime \
+ scan.size \
+ scan.time \
+ scan.timely \
+ scan.unseen \
+ tmac.h
+
+CONF_FILES = # empty
+.for FILE in ${CONFS}
+CONF_FILES += ${EGDIR}/${FILE} ${PKG_SYSCONFDIR}/${FILE}
+.endfor
+
.if defined(NMH_HASH_BACKUP) && (${NMH_HASH_BACKUP} == yes)
post-configure:
${MV} ${WRKSRC}/config.h ${WRKSRC}/config.h.bak
@@ -61,21 +99,21 @@
< ${WRKSRC}/config.h.bak > ${WRKSRC}/config.h
.endif
+# this hopefully makes sure the permissions and ownership are right.
+#
+pre-install:
+ ${INSTALL_DATA_DIR} ${EGDIR}
+
# ABOUT CONFIGURATION FILES:
# - mhn.defaults is generated by nmh during make; we don't use that
# copy because its contents depend on what happened to be installed
# on the build system; we want a reliably reconstructable package
-# - mhn.defaults and mts.conf are only created if they don't exist;
-# the PLIST only has mhn.defaults.dist and mts.conf.dist, so that
-# local modifications to the configuration files won't get lost on
-# upgrading the package
post-install:
${INSTALL_DATA_DIR} ${PREFIX}/${DOCDIR}
for f in `${GREP} '^${DOCDIR}/' ${PKGDIR}/PLIST`; do \
${INSTALL_DATA} ${WRKSRC}/`${BASENAME} $$f` ${PREFIX}/${DOCDIR}; \
done
- ${INSTALL_DATA} ${FILESDIR}/mhn.defaults.dist ${PREFIX}/etc/nmh
- PKG_PREFIX=${PREFIX} ${SH} ${INSTALL_FILE} ${PKGNAME} POST-INSTALL
+ ${INSTALL_DATA} ${FILESDIR}/mhn.defaults.dist ${EGDIR}/mhn.defaults
.include "../../mk/bsd.pkg.mk"
Index: mail/nmh/PLIST
===================================================================
RCS file: /cvs/master/m-NetBSD/main/pkgsrc/mail/nmh/PLIST,v
retrieving revision 1.4
diff -u -r1.4 PLIST
--- mail/nmh/PLIST 2 Jan 2004 20:54:17 -0000 1.4
+++ mail/nmh/PLIST 16 Jan 2005 05:18:10 -0000
@@ -38,33 +38,6 @@
bin/viamail
bin/whatnow
bin/whom
-etc/nmh/MailAliases
-etc/nmh/components
-etc/nmh/digestcomps
-etc/nmh/distcomps
-etc/nmh/forwcomps
-etc/nmh/mhl.body
-etc/nmh/mhl.digest
-etc/nmh/mhl.format
-etc/nmh/mhl.forward
-etc/nmh/mhl.headers
-etc/nmh/mhl.reply
-etc/nmh/mhn.defaults.dist
-etc/nmh/mts.conf.dist
-etc/nmh/rcvdistcomps
-etc/nmh/rcvdistcomps.outbox
-etc/nmh/replcomps
-etc/nmh/replgroupcomps
-etc/nmh/scan.MMDDYY
-etc/nmh/scan.YYYYMMDD
-etc/nmh/scan.default
-etc/nmh/scan.mailx
-etc/nmh/scan.nomime
-etc/nmh/scan.size
-etc/nmh/scan.time
-etc/nmh/scan.timely
-etc/nmh/scan.unseen
-etc/nmh/tmac.h
libexec/nmh/ap
libexec/nmh/conflict
libexec/nmh/dp
@@ -148,6 +121,33 @@
share/doc/nmh/MAIL.FILTERING
share/doc/nmh/README
share/doc/nmh/TODO
+share/examples/nmh/MailAliases
+share/examples/nmh/components
+share/examples/nmh/digestcomps
+share/examples/nmh/distcomps
+share/examples/nmh/forwcomps
+share/examples/nmh/mhl.body
+share/examples/nmh/mhl.digest
+share/examples/nmh/mhl.format
+share/examples/nmh/mhl.forward
+share/examples/nmh/mhl.headers
+share/examples/nmh/mhl.reply
+share/examples/nmh/mhn.defaults
+share/examples/nmh/mts.conf
+share/examples/nmh/rcvdistcomps
+share/examples/nmh/rcvdistcomps.outbox
+share/examples/nmh/replcomps
+share/examples/nmh/replgroupcomps
+share/examples/nmh/scan.MMDDYY
+share/examples/nmh/scan.YYYYMMDD
+share/examples/nmh/scan.default
+share/examples/nmh/scan.mailx
+share/examples/nmh/scan.nomime
+share/examples/nmh/scan.size
+share/examples/nmh/scan.time
+share/examples/nmh/scan.timely
+share/examples/nmh/scan.unseen
+share/examples/nmh/tmac.h
@dirrm libexec/nmh
@dirrm share/doc/nmh
-@unexec ${RMDIR} %D/etc/nmh 2>/dev/null || ${TRUE}
+@dirrm share/examples/nmh
Index: mail/nmh/distinfo
===================================================================
RCS file: /cvs/master/m-NetBSD/main/pkgsrc/mail/nmh/distinfo,v
retrieving revision 1.8
diff -u -r1.8 distinfo
--- mail/nmh/distinfo 4 May 2004 06:18:14 -0000 1.8
+++ mail/nmh/distinfo 16 Jan 2005 05:15:52 -0000
@@ -3,9 +3,9 @@
SHA1 (nmh-1.0.4.tar.gz) = 71441a884d898db2fd9184a92e663682536425f5
Size (nmh-1.0.4.tar.gz) = 683215 bytes
SHA1 (patch-aa) = 88e3e0445cb0102bb3748eb2c9503950ae631931
-SHA1 (patch-ca) = 43aaf15dc5d07de03ff912894d7128d03eb1889d
+SHA1 (patch-ca) = 126d53b3af216754c40b828d7c444a6ee077073f
SHA1 (patch-cb) = 6e498988c08e393fdd4e8e27f2ff6ce457e2c803
SHA1 (patch-cd) = 13901025ef3a1b7fc07d0c13f8e1aef3e9bee2d6
SHA1 (patch-ce) = b93b07c3ee82e6ab8599f362e14ad2dbe1955325
SHA1 (patch-ci) = 98f1c80281656d05c460bdb237de3efbf80b9e32
-SHA1 (patch-cj) = 1f8455ddeb9bf46cb8fd1663f904e8ae79d2b9da
+SHA1 (patch-cj) = cb6a8ca83a7a94651668a70c697c4ec5fa402b48
cvs diff: Diffing mail/nmh/files
cvs diff: Diffing mail/nmh/patches
Index: mail/nmh/patches/patch-ca
===================================================================
RCS file: /cvs/master/m-NetBSD/main/pkgsrc/mail/nmh/patches/patch-ca,v
retrieving revision 1.4
diff -u -r1.4 patch-ca
--- mail/nmh/patches/patch-ca 15 Apr 2000 07:56:16 -0000 1.4
+++ mail/nmh/patches/patch-ca 16 Jan 2005 04:57:23 -0000
@@ -5,7 +5,15 @@
--- etc/Makefile.in.orig Wed Mar 15 07:40:47 2000
+++ etc/Makefile.in Sat Apr 15 17:13:49 2000
-@@ -23,6 +23,7 @@
+@@ -15,6 +15,7 @@
+ bindir = @bindir@
+ libdir = @libdir@
+ etcdir = @sysconfdir@
++egdir = @prefix@/share/examples/nmh
+
+ mailspool = @mailspool@
+ masquerade = @masquerade@
+@@ -23,6 +24,7 @@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
@@ -13,17 +21,29 @@
# Path to search for programs to handle MIME
# content. Used to create mhn.defaults
-@@ -84,16 +85,16 @@
- $(INSTALL_DATA) $(srcdir)/$$file $(etcdir)/$$file; \
+@@ -76,31 +78,31 @@
+ install: install-files install-scripts
+
+ install-files:
+- $(top_srcdir)/mkinstalldirs $(etcdir)
++ $(top_srcdir)/mkinstalldirs $(egdir)
+ for file in $(DIST_FILES); do \
+- if [ -f $(etcdir)/$$file ]; then \
+- mv $(etcdir)/$$file $(etcdir)/$$file.old; \
++ if [ -f $(egdir)/$$file ]; then \
++ mv $(egdir)/$$file $(egdir)/$$file.old; \
+ fi; \
+- $(INSTALL_DATA) $(srcdir)/$$file $(etcdir)/$$file; \
++ $(INSTALL_DATA) $(srcdir)/$$file $(egdir)/$$file; \
done
for file in $(GEN_FILES); do \
- if [ -f $(etcdir)/$$file ]; then \
- mv $(etcdir)/$$file $(etcdir)/$$file.old; \
-+ if [ -f $(etcdir)/$$file.dist ]; then \
-+ mv $(etcdir)/$$file.dist $(etcdir)/$$file.old; \
++ if [ -f $(egdir)/$$file ]; then \
++ mv $(egdir)/$$file $(egdir)/$$file.old; \
fi; \
- $(INSTALL_DATA) $$file $(etcdir)/$$file; \
-+ $(INSTALL_DATA) $$file $(etcdir)/$$file.dist; \
++ $(INSTALL_DATA) $$file $(egdir)/$$file; \
done
install-scripts:
@@ -34,3 +54,11 @@
done
uninstall: uninstall-files uninstall-scripts
+
+ uninstall-files:
+ for file in $(FILES); do \
+- rm -f $(etcdir)/$$file; \
++ rm -f $(egdir)/$$file; \
+ done
+
+ uninstall-scripts:
Index: mail/nmh/patches/patch-cj
===================================================================
RCS file: /cvs/master/m-NetBSD/main/pkgsrc/mail/nmh/patches/patch-cj,v
retrieving revision 1.1
diff -u -r1.1 patch-cj
--- mail/nmh/patches/patch-cj 6 Jan 2004 09:18:21 -0000 1.1
+++ mail/nmh/patches/patch-cj 16 Jan 2005 05:15:44 -0000
@@ -4,7 +4,15 @@
--- man/Makefile.in.orig 2000-01-27 20:14:58.000000000 +0000
+++ man/Makefile.in 2004-01-02 20:38:09.000000000 +0000
-@@ -78,6 +78,9 @@
+@@ -17,6 +17,7 @@
+ bindir = @bindir@
+ libdir = @libdir@
+ etcdir = @sysconfdir@
++egdir = @prefix@/share/examples/nmh
+ mandir = @mandir@
+ manext1 = 1
+ manext5 = 5
+@@ -78,6 +79,9 @@
fmtdump.$(manext8) install-mh.$(manext8) mh-mts.$(manext8) \
post.$(manext8)
@@ -14,7 +22,18 @@
# source for man pages
DIST_MAN = ali.man anno.man ap.man burst.man comp.man conflict.man \
dist.man dp.man flist.man fmtdump.man folder.man forw.man \
-@@ -138,6 +141,14 @@
+@@ -129,8 +133,8 @@
+
+ # install the include file for man pages
+ install-hdr:
+- $(top_srcdir)/mkinstalldirs $(etcdir)
+- $(INSTALL_DATA) tmac.h $(etcdir)/tmac.h
++ $(top_srcdir)/mkinstalldirs $(egdir)
++ $(INSTALL_DATA) tmac.h $(egdir)/tmac.h
+
+ # install the man pages in man1
+ install-man1:
+@@ -138,6 +142,14 @@
for file in $(MAN1); do \
$(INSTALL_DATA) $$file $(mandir)/man$(manext1) ; \
done
@@ -29,3 +48,12 @@
# install the man pages in man5
install-man5:
+@@ -163,7 +175,7 @@
+
+ # uninstall the include file for man pages
+ uninstall-hdr:
+- rm -f $(etcdir)/tmac.h
++ rm -f $(egdir)/tmac.h
+
+ # uninstall the man pages in man1
+ uninstall-man1: