aboutsummaryrefslogtreecommitdiffstats
path: root/shells/perlsh
diff options
context:
space:
mode:
authorclsung <clsung@FreeBSD.org>2005-05-04 13:47:17 +0800
committerclsung <clsung@FreeBSD.org>2005-05-04 13:47:17 +0800
commitb335eb28da42e263b9b0f39f6e8441404475bc96 (patch)
treeb12f72e241526e505e5755a69ad974136b8035a3 /shells/perlsh
parent31667514e2d238154147b200a6583b5a6f1f3160 (diff)
downloadfreebsd-ports-gnome-b335eb28da42e263b9b0f39f6e8441404475bc96.tar.gz
freebsd-ports-gnome-b335eb28da42e263b9b0f39f6e8441404475bc96.tar.zst
freebsd-ports-gnome-b335eb28da42e263b9b0f39f6e8441404475bc96.zip
- 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 PR: 80583 Submitted by: Renato Botelho (maintainer)
Diffstat (limited to 'shells/perlsh')
-rw-r--r--shells/perlsh/Makefile11
-rw-r--r--shells/perlsh/pkg-deinstall22
-rw-r--r--shells/perlsh/pkg-install19
-rw-r--r--shells/perlsh/pkg-plist2
4 files changed, 42 insertions, 12 deletions
diff --git a/shells/perlsh/Makefile b/shells/perlsh/Makefile
index a63de2eb5545..aa9b46da987e 100644
--- a/shells/perlsh/Makefile
+++ b/shells/perlsh/Makefile
@@ -29,16 +29,7 @@ MAN3= Psh::Completion.3 \
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>
diff --git a/shells/perlsh/pkg-deinstall b/shells/perlsh/pkg-deinstall
new file mode 100644
index 000000000000..ad9fcef929e1
--- /dev/null
+++ b/shells/perlsh/pkg-deinstall
@@ -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
diff --git a/shells/perlsh/pkg-install b/shells/perlsh/pkg-install
new file mode 100644
index 000000000000..ff6fa57b1f71
--- /dev/null
+++ b/shells/perlsh/pkg-install
@@ -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
diff --git a/shells/perlsh/pkg-plist b/shells/perlsh/pkg-plist
index 8e263dd38ac6..c34c69a29dc7 100644
--- a/shells/perlsh/pkg-plist
+++ b/shells/perlsh/pkg-plist
@@ -1,7 +1,5 @@
@comment $FreeBSD$
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