aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCheng-Lung Sung <clsung@FreeBSD.org>2005-05-04 05:47:17 +0000
committerCheng-Lung Sung <clsung@FreeBSD.org>2005-05-04 05:47:17 +0000
commitcab771a7f914446bd6863a894399df5243610694 (patch)
treef71e6d2072ff2da22211737957510d9deec9fc39
parentb2e30b8793362ed0f18a3d4e5749ada9435717a7 (diff)
downloadports-cab771a7f914446bd6863a894399df5243610694.tar.gz
ports-cab771a7f914446bd6863a894399df5243610694.zip
Notes
-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
-rw-r--r--shells/psh/Makefile11
-rw-r--r--shells/psh/pkg-deinstall22
-rw-r--r--shells/psh/pkg-install19
-rw-r--r--shells/psh/pkg-plist2
8 files changed, 84 insertions, 24 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
diff --git a/shells/psh/Makefile b/shells/psh/Makefile
index a63de2eb5545..aa9b46da987e 100644
--- a/shells/psh/Makefile
+++ b/shells/psh/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/psh/pkg-deinstall b/shells/psh/pkg-deinstall
new file mode 100644
index 000000000000..ad9fcef929e1
--- /dev/null
+++ b/shells/psh/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/psh/pkg-install b/shells/psh/pkg-install
new file mode 100644
index 000000000000..ff6fa57b1f71
--- /dev/null
+++ b/shells/psh/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/psh/pkg-plist b/shells/psh/pkg-plist
index 8e263dd38ac6..c34c69a29dc7 100644
--- a/shells/psh/pkg-plist
+++ b/shells/psh/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