summaryrefslogtreecommitdiffstats
path: root/ports-mgmt/pkg_install-devel/pkg-deinstall
blob: 32c71c3ad15f5cfe69f5a2e026babe804ae90e11 (plain)
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="${TARGETDIR}/share"
else
  MANPREFIX="${TARGETDIR}"
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
OpenPOWER on IntegriCloud