Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Jul 2004 23:55:47 +0900 (JST)
From:      Hideyuki KURASHINA <rushani@FreeBSD.org>
To:        FreeBSD-gnats-submit@FreeBSD.org, freebsd-ports-bugs@FreeBSD.org
Cc:        mharo@FreeBSD.org
Subject:   Re: ports/69288: [PATCH] security/sudo: Fix deinstall
Message-ID:  <20040720.235547.30101387.rushani@FreeBSD.org>
In-Reply-To: <200407191340.i6JDeEUc059120@freefall.freebsd.org>
References:  <20040719.223232.71185611.rushani@FreeBSD.org> <200407191340.i6JDeEUc059120@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

In a previous PR, one of changes I requested was removing
${PREFIX}/etc/sudoers in the ``pkg-plist'' if it is identical
with ${EXAMPLESDIR}/sudoers.

After sending a PR, I've got a suggestion about where to remove the config
file from Umemoto-san.  That point is utilizing ``pkg-deinstall''.
I believe it is reasonable for consistency because we use ``pkg-install''
for package.

I've made a patch again.  Please apply following patch (While I'm here,
use EXAMPLESDIR in both ``pkg-install'' and ``pkg-deinstall'').

Regards,

-- rushani

Index: Makefile
===================================================================
RCS file: /home/ncvs/ports/security/sudo/Makefile,v
retrieving revision 1.63
diff -u -r1.63 Makefile
--- Makefile	20 Jul 2004 08:30:14 -0000	1.63
+++ Makefile	20 Jul 2004 14:43:48 -0000
@@ -7,7 +7,7 @@
 
 PORTNAME=	sudo
 PORTVERSION=	1.6.7.5
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	security
 MASTER_SITES=	http://www.sudo.ws/sudo/dist/ \
 		http://probsd.org/sudoftp/ \
@@ -51,10 +51,21 @@
 MAN5=		sudoers.5
 MAN8=		sudo.8 visudo.8
 
+PKGDEINSTALL=	${WRKDIR}/pkg-deinstall
+PKGINSTALL=	${WRKDIR}/pkg-install
+
 post-patch:
 	@${REINPLACE_CMD} -e 's|^|#|g' ${WRKSRC}/sample.sudoers
+	@${SED} -e "s|%%PREFIX%%|${PREFIX}|g" \
+		-e "s|%%EXAMPLESDIR%%|${EXAMPLESDIR}|g" \
+		${.CURDIR}/pkg-install > ${PKGINSTALL}
+	@${SED} -e "s|%%PREFIX%%|${PREFIX}|g" \
+		-e "s|%%EXAMPLESDIR%%|${EXAMPLESDIR}|g" \
+		${.CURDIR}/pkg-deinstall > ${PKGDEINSTALL}
 
 post-install:
-	${INSTALL_DATA} ${WRKSRC}/sample.sudoers ${PREFIX}/etc/sudoers.sample
+	@${MKDIR} ${EXAMPLESDIR}
+	${INSTALL_DATA} ${WRKSRC}/sudoers ${EXAMPLESDIR}/sudoers
+	${INSTALL_DATA} ${WRKSRC}/sample.sudoers ${EXAMPLESDIR}/sudoers.sample
 
 .include <bsd.port.post.mk>
Index: pkg-deinstall
===================================================================
RCS file: pkg-deinstall
diff -N pkg-deinstall
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ pkg-deinstall	20 Jul 2004 14:42:18 -0000
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+PKG_PREFIX=${PKG_PREFIX:=%%PREFIX%%}
+EXAMPLESDIR=${EXAMPLESDIR:=%%EXAMPLESDIR%%}
+
+if [ $2 != "DEINSTALL" ]; then
+  exit 0
+fi
+
+if cmp -s ${PKG_PREFIX}/etc/sudoers ${EXAMPLESDIR}/sudoers; then
+  rm -f ${PKG_PREFIX}/etc/sudoers
+fi
Index: pkg-install
===================================================================
RCS file: /home/ncvs/ports/security/sudo/pkg-install,v
retrieving revision 1.4
diff -u -r1.4 pkg-install
--- pkg-install	20 Jul 2004 08:30:14 -0000	1.4
+++ pkg-install	20 Jul 2004 14:46:09 -0000
@@ -1,10 +1,15 @@
 #!/bin/sh
+
+PKG_PREFIX=${PKG_PREFIX:=%%PREFIX%%}
+EXAMPLESDIR=${EXAMPLESDIR:=%%EXAMPLESDIR%%}
+
 if [ $2 != "POST-INSTALL" ]; then
   exit 0
 fi
+
 if [ -e ${PKG_PREFIX}/etc/sudoers ]; then
   echo "Will not overwrite existing ${PKG_PREFIX}/etc/sudoers file."
 else
-  cp -p ${PKG_PREFIX}/etc/sudoers.sample ${PKG_PREFIX}/etc/sudoers
+  cp -p ${EXAMPLESDIR}/sudoers ${PKG_PREFIX}/etc/sudoers
   chmod 440 ${PKG_PREFIX}/etc/sudoers
 fi
Index: pkg-plist
===================================================================
RCS file: /home/ncvs/ports/security/sudo/pkg-plist,v
retrieving revision 1.9
diff -u -r1.9 pkg-plist
--- pkg-plist	20 Jul 2004 08:30:14 -0000	1.9
+++ pkg-plist	20 Jul 2004 14:43:03 -0000
@@ -1,4 +1,5 @@
-@unexec if cmp -s %D/etc/sudoers %D/etc/sudoers.sample; then rm -f %D/etc/sudoers; fi
 bin/sudo
-etc/sudoers.sample
 sbin/visudo
+%%EXAMPLESDIR%%/sudoers
+%%EXAMPLESDIR%%/sudoers.sample
+@dirrm %%EXAMPLESDIR%%



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040720.235547.30101387.rushani>