aboutsummaryrefslogtreecommitdiff
path: root/shells/bashc/pkg-deinstall
blob: b32f806813322b6665255f30c344343c780cf91a (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$
#

BASHC="$(echo ${PKG_PREFIX-/usr/local}/bin/bashc | /usr/bin/sed -e 's|//|/|g')"
SHELLS="${PKG_DESTDIR-}/etc/shells"

case $2 in
DEINSTALL)
  if grep -qs "^$BASHC\$" "$SHELLS"; then
    if [ `id -u` -eq 0 ]; then
      TMPSHELLS=`mktemp -t shells`
      grep -v "^$BASHC\$" "$SHELLS" > "$TMPSHELLS"
      cat "$TMPSHELLS" > "$SHELLS"
      rm "$TMPSHELLS"
    else
      echo "Not root, please remove $BASHC from $SHELLS manually"
    fi
  fi
  ;;
esac