aboutsummaryrefslogtreecommitdiffstats
path: root/shells/heirloom-sh/pkg-install
blob: 555ee92c82e76c43ad23af6fa7509a88fbea7dd8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh
#
# $FreeBSD$
#

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

case $2 in
POST-INSTALL)
  if [ -d "${SHELLS%/*}" ] && ! grep -qs "^$JSH\$" "$SHELLS"; then
    if [ $(id -u) -eq 0 ]; then
      echo "$JSH" >> "$SHELLS"
    else
      echo "Not root, please add $JSH to $SHELLS manually"
    fi
  fi
  ;;
esac