From renato@data.galle.com.br  Tue May  3 16:13:28 2005
Return-Path: <renato@data.galle.com.br>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 9F8C516A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Tue,  3 May 2005 16:13:28 +0000 (GMT)
Received: from data.galle.com.br (data.galle.com.br [200.246.25.10])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 6A09343D76
	for <FreeBSD-gnats-submit@freebsd.org>; Tue,  3 May 2005 16:13:27 +0000 (GMT)
	(envelope-from renato@data.galle.com.br)
Received: from data.galle.com.br (data.galle.com.br [200.246.25.10])
	by data.galle.com.br (8.13.1/8.13.1) with ESMTP id j43GDQQ5007651
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 3 May 2005 13:13:26 -0300 (BRST)
	(envelope-from renato@data.galle.com.br)
Received: (from root@localhost)
	by data.galle.com.br (8.13.1/8.13.1/Submit) id j43GDLUh007650;
	Tue, 3 May 2005 13:13:21 -0300 (BRST)
	(envelope-from renato)
Message-Id: <200505031613.j43GDLUh007650@data.galle.com.br>
Date: Tue, 3 May 2005 13:13:21 -0300 (BRST)
From: Renato Botelho <freebsd@galle.com.br>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [MAINTAINER] shells/perlsh: change the way used to change /etc/shells
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         80583
>Category:       ports
>Synopsis:       [MAINTAINER] shells/perlsh: change the way used to change /etc/shells
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Tue May 03 16:20:01 GMT 2005
>Closed-Date:    Wed May 04 05:47:35 GMT 2005
>Last-Modified:  Wed May 04 05:47:35 GMT 2005
>Originator:     Renato Botelho
>Release:        FreeBSD 5.3-RELEASE-p9 i386
>Organization:
Galle Folheados - http://www.galle.com.br
>Environment:
System: FreeBSD data.galle.com.br 5.3-RELEASE-p9 FreeBSD 5.3-RELEASE-p9 #9: Fri Apr 15 07:52:00 BRST 2005
>Description:
- Change the way used to add/remove the shell on /etc/shells,
  use pkg-install and pkg-deinstall (both stoled from shells/bash)
  to do it.
- Remove pre-install section, it's not more needed on this version,
  because Makefile is created correctly changing Makefile.PL

Added file(s):
- pkg-deinstall
- pkg-install

Generated with FreeBSD Port Tools 0.63
>How-To-Repeat:
>Fix:

--- perlsh-1.8.patch begins here ---
Index: Makefile
===================================================================
RCS file: /home/ncvs/ports/shells/perlsh/Makefile,v
retrieving revision 1.19
diff -u -r1.19 Makefile
--- Makefile	18 Apr 2005 16:08:18 -0000	1.19
+++ Makefile	3 May 2005 16:11:43 -0000
@@ -29,16 +29,7 @@
 	Psh::Strategy.3 \
 	Psh::StrategyBunch.3
 
-pre-install:
-	@${PERL} -pi -e "s:/usr/local:${PREFIX}:g" ${WRKSRC}/Makefile;
-	@${PERL} -pi -e "s:/usr/local/man/man1:${MAN3PREFIX}/man/man1:g" ${WRKSRC}/Makefile;
-	@${PERL} -pi -e "s:/usr/local/lib/perl5/5.00503/man/man3:${MAN3PREFIX}/man/man3:g" ${WRKSRC}/Makefile;
-
 post-install:
-	@${ECHO_MSG} "Updating /etc/shells"
-	@${CP} /etc/shells /etc/shells.bak
-	@(${GREP} -v ${PREFIX}/bin/psh /etc/shells.bak; \
-	${ECHO_CMD} ${PREFIX}/bin/psh) > /etc/shells
-	@${RM} /etc/shells.bak
+	@${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
 
 .include <bsd.port.mk>
Index: pkg-deinstall
===================================================================
RCS file: pkg-deinstall
diff -N pkg-deinstall
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ pkg-deinstall	3 May 2005 16:11:43 -0000
@@ -0,0 +1,22 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+PSH="${PKG_PREFIX-/usr/local}/bin/psh"
+SHELLS="${PKG_DESTDIR-}/etc/shells"
+
+case $2 in
+DEINSTALL)
+  if grep -qs "^$PSH\$" "$SHELLS"; then
+    if [ `id -u` -eq 0 ]; then
+      TMPSHELLS=`mktemp -t shells`
+      grep -v "^$PSH\$" "$SHELLS" > "$TMPSHELLS"
+      cat "$TMPSHELLS" > "$SHELLS"
+      rm "$TMPSHELLS"
+    else
+      echo "Not root, please remove $PSH from $SHELLS manually"
+    fi
+  fi
+  ;;
+esac
Index: pkg-install
===================================================================
RCS file: pkg-install
diff -N pkg-install
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ pkg-install	3 May 2005 16:11:43 -0000
@@ -0,0 +1,19 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+PSH="${PKG_PREFIX-/usr/local}/bin/psh"
+SHELLS="${PKG_DESTDIR-}/etc/shells"
+
+case $2 in
+POST-INSTALL)
+  if [ -d "${SHELLS%/*}" ] && ! grep -qs "^$PSH\$" "$SHELLS"; then
+    if [ `id -u` -eq 0 ]; then
+      echo "$PSH" >> "$SHELLS"
+    else
+      echo "Not root, please add $PSH to $SHELLS manually"
+    fi
+  fi
+  ;;
+esac
Index: pkg-plist
===================================================================
RCS file: /home/ncvs/ports/shells/perlsh/pkg-plist,v
retrieving revision 1.12
diff -u -r1.12 pkg-plist
--- pkg-plist	19 Apr 2005 17:46:52 -0000	1.12
+++ pkg-plist	3 May 2005 16:11:43 -0000
@@ -1,7 +1,5 @@
 @comment $FreeBSD: ports/shells/perlsh/pkg-plist,v 1.12 2005/04/19 17:46:52 leeym Exp $
 bin/psh
-@exec echo "updating /etc/shells"; cp /etc/shells /etc/shells.bak; (grep -v %D/%F /etc/shells.bak; echo %D/%F) >/etc/shells; rm -f /etc/shells.bak
-@unexec echo "updating /etc/shells"; cp /etc/shells /etc/shells.bak; (grep -v %D/%F /etc/shells.bak) >/etc/shells; rm -f /etc/shells.bak
 share/psh/complete/debian
 share/psh/complete/perl
 share/psh/complete/standard
--- perlsh-1.8.patch ends here ---

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: clsung 
State-Changed-When: Wed May 4 05:47:23 GMT 2005 
State-Changed-Why:  
Committed, Thank you. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=80583 
>Unformatted:
