aboutsummaryrefslogtreecommitdiff
path: root/ports-mgmt/pkg_install-devel/pkg-deinstall
blob: 08ffba95976318b88a603aec90641eed417264df (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
#!/bin/sh
#
# $FreeBSD$
#

PAX=/bin/pax
ECHO_CMD=echo
RM=/bin/rm
BACKUPDIR=/var/backups

PREFIX=${PKG_PREFIX:-/usr/local}
if [ "${PREFIX}" = "/usr" ]; then
  MANPREFIX="${PREFIX}/share"
else
  MANPREFIX="${PREFIX}"
fi

case $2 in
POST-DEINSTALL)
  if [ "${PREFIX}" = "/usr" ]; then
    if [ -e "${BACKUPDIR}/pkg_install.tgz" ]; then
      ${PAX} -r -pe -z -f "${BACKUPDIR}/pkg_install.tgz"
      ${RM} "${BACKUPDIR}/pkg_install.tgz"
      ${ECHO_CMD} "===>  Base pkg_install restored."
    fi
  fi
  ;;
esac