summaryrefslogtreecommitdiff
path: root/shells/bash/pkg-install
blob: 99417b66ba6e603b2c8d97ffb849357ee15a7d6e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/sh
#
# $FreeBSD$
#

BASH="$(echo ${PKG_PREFIX-/usr/local}/bin/bash | /usr/bin/sed -e 's|//|/|g')"
RBASH="$(echo ${PKG_PREFIX-/usr/local}/bin/rbash | /usr/bin/sed -e 's|//|/|g')"
SHELLS="/etc/shells"

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