Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 May 2005 13:13:21 -0300 (BRST)
From:      Renato Botelho <freebsd@galle.com.br>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/80583: [MAINTAINER] shells/perlsh: change the way used to change /etc/shells
Message-ID:  <200505031613.j43GDLUh007650@data.galle.com.br>
Resent-Message-ID: <200505031620.j43GK13u029840@freefall.freebsd.org>

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

>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:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Tue May 03 16:20:01 GMT 2005
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:



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