From 69807b51dd28a1c7b39d6fe97802422f6055f75a Mon Sep 17 00:00:00 2001 From: dougb Date: Sun, 5 Dec 2010 07:51:49 +0000 Subject: Remove CONFLICTS for the old pine stuff, it's been long enough Fix the problem mentioned in the PR related to a feature of the port that is useful, or dangerous depending on how you look at it. :) If you run 'alpine -conf > file' it will merge in values from your existing global conf file (/usr/local/etc/alpine.conf) and spit out a new file with any new features added. The port used this feature when I took it over, and I maintained that behavior because it is useful. However, it is different from the traditional behavior of installing a clean foo.conf.sample file, and maintaining foo.conf only if it differs from the sample. My solution to this problem is different than the PR's, but does not involve patching the source. Using the pkg-install file and taking advantage of the default behavior of the alpine -conf feature I have created the best of both worlds, a clean .sample, and merging in local changes if they exist. Since I'm changing stuff anyway, do both sides of the process in a more security-conscious way. Bump PORTREVISION since the package is now different PR: ports/148859 Submitted by: Ganael Laplanche --- mail/alpine/Makefile | 7 ++----- mail/alpine/pkg-install | 32 ++++++++++++++++++++++++++++++++ mail/alpine/pkg-plist | 7 ++----- 3 files changed, 36 insertions(+), 10 deletions(-) create mode 100644 mail/alpine/pkg-install (limited to 'mail/alpine') diff --git a/mail/alpine/Makefile b/mail/alpine/Makefile index 15fb53e65946..2262189ae554 100644 --- a/mail/alpine/Makefile +++ b/mail/alpine/Makefile @@ -7,7 +7,7 @@ PORTNAME?= alpine PORTVERSION= 2.00 -PORTREVISION?= 1 +PORTREVISION?= 2 CATEGORIES?= mail news ipv6 MASTER_SITES= ftp://ftp.cac.washington.edu/alpine/ \ http://dougbarton.us/Downloads/alpine-${PORTVERSION}/ @@ -48,8 +48,6 @@ CONFIGURE_ARGS+=--with-system-pinerc=${PREFIX}/etc/alpine.conf \ .endif CONFIGURE_ARGS+=--with-debug-level=2 -CONFLICTS= pico-4* pine4-4* - USE_OPENSSL= yes .include @@ -182,8 +180,7 @@ post-install: ${INSTALL_DATA} ${WRKSRC}/doc/tech-notes.txt ${DOCSDIR} ${INSTALL_DATA} ${WRKSRC}/doc/tech-notes/*.html ${DOCSDIR}/tech-notes .endif - ${PREFIX}/bin/alpine -P ${PREFIX}/etc/alpine.conf -conf >${WRKSRC}/alpine.conf - ${INSTALL_DATA} ${WRKSRC}/alpine.conf ${PREFIX}/etc/alpine.conf + PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL @${CAT} ${PKGMESSAGE} .endif # !defined(PICO_ALPINE_SLAVE) diff --git a/mail/alpine/pkg-install b/mail/alpine/pkg-install new file mode 100644 index 000000000000..c7e0a18d5aed --- /dev/null +++ b/mail/alpine/pkg-install @@ -0,0 +1,32 @@ +#!/bin/sh + +[ "$2" = 'POST-INSTALL' ] || exit 0 + +PATH=/bin:/usr/bin +export PATH + +TDIR=`mktemp -d ${TMPDIR:-/tmp}/alpine-conf.XXXXXXXX` + +if [ -s "${PKG_PREFIX}/etc/alpine.conf" ]; then + mv ${PKG_PREFIX}/etc/alpine.conf ${TDIR}/alpine.conf.installed +fi + +${PKG_PREFIX}/bin/alpine -conf > ${TDIR}/alpine.conf.sample +install -o root -g wheel -m 444 ${TDIR}/alpine.conf.sample ${PKG_PREFIX}/etc/alpine.conf.sample + +[ -s "${TDIR}/alpine.conf.installed" ] && mv ${TDIR}/alpine.conf.installed ${PKG_PREFIX}/etc/alpine.conf + +${PKG_PREFIX}/bin/alpine -conf > ${TDIR}/alpine.conf + +if [ -e "${PKG_PREFIX}/etc/alpine.conf" ]; then + if ! cmp -s ${TDIR}/alpine.conf ${PKG_PREFIX}/etc/alpine.conf; then + unlink ${PKG_PREFIX}/etc/alpine.conf + install -o root -g wheel -m 444 ${TDIR}/alpine.conf ${PKG_PREFIX}/etc/alpine.conf + fi +else + cp -p ${PKG_PREFIX}/etc/alpine.conf.sample ${PKG_PREFIX}/etc/alpine.conf +fi + +rm -rf $TDIR + +exit 0 diff --git a/mail/alpine/pkg-plist b/mail/alpine/pkg-plist index 400015b10245..b28fcd400048 100644 --- a/mail/alpine/pkg-plist +++ b/mail/alpine/pkg-plist @@ -1,11 +1,8 @@ -@unexec %D/bin/alpine -conf >%D/etc/alpine.conf.tmp -@unexec if cmp -s %D/etc/alpine.conf %D/etc/alpine.conf.tmp; then rm -f %D/etc/alpine.conf; fi -@unexec rm -f %D/etc/alpine.conf.tmp +@unexec /usr/bin/cmp -s %D/etc/alpine.conf %D/etc/alpine.conf.sample && /bin/unlink %D/etc/alpine.conf || true bin/alpine bin/rpdump bin/rpload -@exec %D/bin/alpine -P %D/etc/alpine.conf -conf >%D/etc/alpine.conf.tmp -@exec /bin/mv %D/etc/alpine.conf.tmp %D/etc/alpine.conf +etc/alpine.conf.sample %%PORTDOCS%%%%DOCSDIR%%/LICENSE %%PORTDOCS%%%%DOCSDIR%%/NOTICE %%PORTDOCS%%%%DOCSDIR%%/README -- cgit