summaryrefslogtreecommitdiff
path: root/www/twiki/files/pkg-deinstall.in
blob: 7422d743c9a21b973d41df06980503e8b3a0450d (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
#!/bin/sh
#
# $FreeBSD: /tmp/pcvs/ports/www/twiki/files/pkg-deinstall.in,v 1.1 2008-04-22 08:36:40 sat Exp $
#

TWDIR=%%TWDIR%%
WWWDIR=%%WWWDIR%%

case $2 in
	DEINSTALL)
		cd ${TWDIR}/
		find -s * -not -type d | while read file; do
			if [ -e ${WWWDIR}/$file ]; then
				if cmp -s ${WWWDIR}/$file $file; then
					rm -f ${WWWDIR}/$file
				else
					echo "${WWWDIR}/$file changed, skipping"
				fi
			else
				echo "${WWWDIR}/$file lost"
			fi
		done
		find -ds * -type d | while read dir; do
			rmdir ${WWWDIR}/$dir/ 2>/dev/null || true
		done
		rmdir ${WWWDIR}/ 2>/dev/null || true
		rmdir %%PREFIX%%/www 2>/dev/null || true
		;;
	POST-DEINSTALL)
		;;
	*)
		echo "Unexpected Argument $2!"
		exit 1
		;;
esac
exit 0