freebsd-ports/multimedia/linux-divx4linux4/pkg-install
Mario Sergio Fujikawa Ferreira 536a812562 o After repo copy from divx4linux: this port will hold previous
DiVX version 4.0
	- add NO_LATEST_LINK
	- install under divx4 prefixes

Repo copy by:	joe
Approved by:	kris (repo copy)
2002-04-22 22:28:49 +00:00

78 lines
1.5 KiB
Bash

#!/bin/sh
# $FreeBSD$
[ $# != 2 ] && exit 1
PKGNAME=$1
ACTION=$2
LIB_DIR=/usr/lib/divx4
ETC_DIR=${PKG_PREFIX}/etc
ETC_FILE=ld.so.conf
FMT=fmt
GREP=grep
LDCONFIG=/compat/linux/sbin/ldconfig
PERL=perl
case "$ACTION" in
POST-INSTALL)
echo "$PKGNAME: ======> <======"
if [ -f ${ETC_DIR}/${ETC_FILE} ]
then
IS_IT_THERE=`${GREP} -E -e "^${LIB_DIR}$" ${ETC_DIR}/${ETC_FILE}`
if [ -z "${IS_IT_THERE}" ]
then
echo "${LIB_DIR}" >> ${ETC_DIR}/${ETC_FILE}
fi
${LDCONFIG}
else
echo "$PKGNAME: ERROR: There is NO ${ETC_DIR}/${ETC_FILE}" | ${FMT}
echo "$PKGNAME: ERROR: Check your system." | ${FMT}
fi
echo "$PKGNAME: ======> <======"
;;
DEINSTALL)
echo "$PKGNAME: ======> <======"
if [ -f ${ETC_DIR}/${ETC_FILE} ]
then
IS_IT_THERE=`${GREP} -E -e "^${LIB_DIR}$" ${ETC_DIR}/${ETC_FILE}`
if [ -n "${IS_IT_THERE}" ]
then
${PERL} -pi -e "s|^${LIB_DIR}\n$||" \
${ETC_DIR}/${ETC_FILE}
else
echo "$PKGNAME: ERROR: Existing ${ETC_DIR}/${ETC_FILE} configuration file was modified by hand." | ${FMT}
echo "$PKGNAME: You probably edited it by hand. Therefore, I can't automatically modify it."
echo "$PKGNAME: There is no problem."
echo "$PKGNAME: Just make sure it does not contain a line with '${LIB_DIR}'"
fi
${LDCONFIG}
else
echo "$PKGNAME: ERROR: There is NO ${ETC_DIR}/${ETC_FILE}" | ${FMT}
echo "$PKGNAME: ERROR: Check your system." | ${FMT}
fi
echo "$PKGNAME: ======> <======"
;;
PRE-INSTALL|POST-DEINSTALL)
;;
*)
exit 1
;;
esac
exit