aboutsummaryrefslogtreecommitdiffstats
path: root/shells/heirloom-sh/pkg-deinstall
blob: 439041a4af1b70344da08e64a418d3c4b4841ae5 (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$
#

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

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