summaryrefslogtreecommitdiff
path: root/www/geeklog/DEINSTALL
blob: ef3da7015d524a1d9502b68df5004e4c7950d35b (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
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
# $NetBSD: DEINSTALL,v 1.3 2006/07/23 13:21:09 taca Exp $

GEEKLOG_DIR="@GEEKLOG_DIR@"
GEEKLOG_EXAMPLESDIR="@GEEKLOG_EXAMPLESDIR@"
GEEKLOG_PUBDIR="@GEEKLOG_PUBDIR@"
GEEKLOG_TMPL_SUB="@GEEKLOG_TMPL_SUB@"
GEEKLOG_TMPL_DIR="@GEEKLOG_TMPL_DIR@"

case ${STAGE} in
DEINSTALL)
	(cd ${GEEKLOG_TMPL_DIR}
	${FIND} ${GEEKLOG_TMPL_SUB} -type f -print | \
		while read f; do
			file="${GEEKLOG_PUBDIR}/$f"
			if ${TEST} -f ${file} -a -f ${f} && \
			    ${CMP} -s ${file} ${f}; then
				${RM} -f ${file}
			fi
		done
	cd ${GEEKLOG_PUBDIR}
	${FIND} -d ${GEEKLOG_TMPL_SUB} -type d -print |
		while read d; do
			${RMDIR} ${d} 2>/dev/null
		done
	# XXX: work around for remaining config.php and system/lib-custom.php
	conf_files="${GEEKLOG_EXAMPLESDIR}/config.php \
			${GEEKLOG_DIR}/config.php \
			${GEEKLOG_EXAMPLESDIR}/system/lib-custom.php \
			${GEEKLOG_DIR}/system/lib-custom.php"
	file_list=
	set ${conf_files}
	while ${TEST} $# -gt 0; do
		eg=$1; shift
		cf=$1; shift
		if ${TEST} -f ${cf} -a -f ${eg} && ${CMP} -s ${cf} ${eg}; then
			${RM} ${cf}
		else
			file_list="${file_list} ${cf}"
		fi
	done
	if ${TEST} -n "${file_list}"; then
		${ECHO} "==========================================================================="
		${ECHO} "The following files are no longer being used by ${PKGNAME},"
		${ECHO} "and they can be removed if no other packages are using them:"
		${ECHO} ""
		for f in ${file_list}; do
		${ECHO} "	${f}"
		done
		${ECHO} ""
		${ECHO} "==========================================================================="
	fi
	)
	;;

esac