aboutsummaryrefslogtreecommitdiffstats
path: root/ports-mgmt/portaudit/pkg-req
blob: 5a8ba2d087db47fc0b3f5ccf29470a6cea871226 (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
28
29
30
31
32
#!/bin/sh
#
# $FreeBSD$
#

case $2 in
INSTALL)
  if [ -z "${PKG_INFO}" ]; then
    if [ -x "%%LOCALBASE%%/sbin/pkg_info" ]; then
      PKG_INFO="%%LOCALBASE%%/sbin/pkg_info"
    else
      PKG_INFO="/usr/sbin/pkg_info"
    fi
  fi

  if [ ! -x "${PKG_INFO}" ]; then
    echo "${PKG_INFO} missing, please install port sysutils/pkg_install-devel"
    exit 1
  fi

  PKG_INSTALL_VER=`${PKG_INFO} -qP 2>/dev/null`
  if [ -z "${PKG_INSTALL_VER}" -o "${PKG_INSTALL_VER}" -lt %%REQPKGVER%% ]; then
    echo "${PKG_INFO} is too old, please update port sysutils/pkg_install-devel"
    exit 1
  fi

  if [ "`echo FreeBSD | tr -s .`" != "FreeBSD" ]; then
    echo "tr(1) is broken."
    exit 1
  fi
  ;;
esac