aboutsummaryrefslogtreecommitdiff
path: root/shells/psh/pkg-deinstall
blob: ad9fcef929e14f0c0363f3002bd1efc72d400872 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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