freebsd-ports/ports-mgmt/pkg_install-devel/pkg-install
Oliver Eikemeier 51318f1756 - remove sourceforge from MASTER_SITES
- install in /usr/local by default
- conflict with sysutils/pkg_install
2004-01-27 17:36:08 +00:00

46 lines
1.1 KiB
Bash

#!/bin/sh
#
# $FreeBSD$
#
PAX=/bin/pax
ECHO_CMD=echo
MKDIR="/bin/mkdir -p"
RM=/bin/rm
BACKUPDIR=/var/backups
TOOLS="add check create delete info sign update version"
PREFIX=${PKG_PREFIX:-/usr/local}
if [ "${PREFIX}" = "/usr" ]; then
MANPREFIX="${PREFIX}/share"
else
MANPREFIX="${PREFIX}"
fi
case $2 in
PRE-INSTALL)
if [ "${PREFIX}" = "/usr" ]; then
if [ -e "${BACKUPDIR}/pkg_install.tgz" ]; then
${ECHO_CMD} "===> Please remove \`\`${BACKUPDIR}/pkg_install.tgz'' manually."
exit 1
fi
if [ "${PREFIX}" = "/usr" ]; then
files=""
for tool in ${TOOLS}; do
if [ -e "${PREFIX}/sbin/pkg_${tool}" ]; then
files="${files} ${PREFIX}/sbin/pkg_${tool}"
fi
if [ -e "${MANPREFIX}/man/man1/pkg_${tool}.1.gz" ]; then
files="${files} ${MANPREFIX}/man/man1/pkg_${tool}.1.gz"
${RM} -f "${MANPREFIX}/man/cat1/pkg_${tool}.1.gz"
fi
done
${MKDIR} ${BACKUPDIR}
${PAX} -w -z -f "${BACKUPDIR}/pkg_install.tgz" ${files}
${RM} -f ${files}
${ECHO_CMD} "===> Base pkg_install saved."
fi
fi
;;
esac