summaryrefslogtreecommitdiff
path: root/multimedia/linux-divx4linux4/pkg-install
blob: 717da383ae143bbcc0da1538bdeb33ec270f8058 (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/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