View | Details | Raw Unified | Return to bug 39557
Collapse All | Expand All

(-)pkg-deinstall (+107 lines)
Added Link Here
1
#!/bin/sh
2
#
3
#	$FreeBSD$
4
#
5
# Created by: hetzels@westbend.net
6
7
PKG_USER=${PKG_USER:=www}
8
PKG_GROUP=${PKG_GROUP:=www}
9
10
PKG_PREFIX=${PKG_PREFIX}
11
HOST_NAME=`/bin/hostname`
12
13
AP_CGI=${PKG_PREFIX}/www/cgi-bin
14
AP_CONF=${PKG_PREFIX}/etc/apache
15
AP_DATA=${PKG_PREFIX}/www/data
16
AP_SHARE=${PKG_PREFIX}/share/doc/apache
17
18
IMAGES_DIR=${AP_SHARE}/manual/images
19
IMAGES_VTI=${AP_DATA}/images/_vti_cnf
20
21
remove_user()
22
{
23
	if [ ! -x /usr/sbin/pw ]; then
24
		echo "*** Unable to remove the Apache user and group (${PKG_USER}/${PKG_GROUP})"
25
		exit 69
26
	fi
27
28
	if pw usershow ${PKG_USER} -q > /dev/null; then
29
		olduid=`pw show user ${PKG_USER} 2> /dev/null | cut -d: -f3`
30
		oldgid=`pw show group ${PKG_GROUP} 2> /dev/null | cut -d: -f3`
31
		if [ ${olduid} -ne 80 ]; then
32
			echo "To delete Apache user permanently, use 'pw userdel ${PKG_USER}'"
33
		fi
34
		if [ ${oldgid} -ne 80 ]; then
35
			echo "To delete Apache group permanently, use 'pw groupdel ${PKG_GROUP}'"
36
		fi
37
	fi
38
}
39
40
remove_file()
41
{
42
	local source_dir=$1
43
	local target_dir=$2
44
	local file=$3
45
	local ret=1
46
47
	if [ -f ${target_dir}/${file} ]; then
48
	    if cmp -s ${source_dir}/${file} ${target_dir}/${file} ; then
49
		rm -f ${target_dir}/${file}
50
		ret=0
51
	    fi
52
	fi
53
54
	return ${ret}
55
}
56
57
remove_apache_doc_root ()
58
{
59
    if [ -d ${AP_CGI} ]; then
60
	for file in `ls ${AP_CGI}.default`
61
	{
62
	    remove_file ${AP_CGI}.default ${AP_CGI} ${file}
63
	}
64
    fi
65
66
    if [ -d ${AP_DATA} ]; then
67
	if [ -d ${AP_DATA}/images ] ; then
68
	    for file in apache_pb.gif fplogo.gif powerlogo.gif
69
	    {
70
		if remove_file ${IMAGES_DIR} ${AP_DATA}/images ${file}; then
71
		    if [ -d ${IMAGES_VTI} -a -f ${IMAGES_VTI}/${file} ] ; then
72
			rm ${IMAGES_VTI}/${file}
73
		    fi
74
		fi
75
	    }
76
	    if [ -d ${IMAGES_VTI} ]; then
77
		rmdir ${IMAGES_VTI}
78
	    fi
79
	fi
80
81
	remove_file ${AP_SHARE} ${AP_DATA} index.html.en
82
    fi
83
}
84
85
remove_httpd_conf ()
86
{
87
    if [ -f ${AP_CONF}/httpd.conf ] ; then
88
	/bin/cat ${AP_CONF}/httpd.conf.default | \
89
	    /usr/bin/sed -e 's;@@HOSTNAME@@;'${HOST_NAME}';' \
90
	    > ${AP_CONF}/httpd.conf.tmp
91
	if cmp -s ${AP_CONF}/httpd.conf ${AP_CONF}/httpd.conf.tmp ; then
92
		rm -f ${AP_CONF}/httpd.conf
93
	fi
94
	rm ${AP_CONF}/httpd.conf.tmp
95
    fi
96
}
97
98
case $2 in
99
    DEINSTALL)
100
	remove_apache_doc_root
101
	remove_httpd_conf
102
	;;
103
    POST-DEINSTALL)
104
	remove_user
105
	;;
106
107
esac
(-)pkg-install (-3 / +3 lines)
Lines 134-143 Link Here
134
	create_user
134
	create_user
135
	;;
135
	;;
136
    POST-INSTALL)
136
    POST-INSTALL)
137
	create_apache_doc_root
138
	fix_httpd_conf
137
	# If we are not in batch mode
139
	# If we are not in batch mode
138
        if [ "${PKG_BATCH}" = "NO" ]; then
140
	if [ "${PKG_BATCH}" = "NO" ]; then
139
	    create_apache_doc_root
140
	    fix_httpd_conf
141
	    ${FPINSTALL}
141
	    ${FPINSTALL}
142
	    fix_frontpage_cnf
142
	    fix_frontpage_cnf
143
	    comment_files
143
	    comment_files
(-)pkg-plist (-1 / +4 lines)
Lines 1-3 Link Here
1
bin/checkgid
1
bin/dbmmanage
2
bin/dbmmanage
2
bin/htdigest
3
bin/htdigest
3
bin/htpasswd
4
bin/htpasswd
Lines 645-651 Link Here
645
@dirrm share/doc/apache/manual/vhosts
646
@dirrm share/doc/apache/manual/vhosts
646
@dirrm share/doc/apache/manual
647
@dirrm share/doc/apache/manual
647
@dirrm share/doc/apache
648
@dirrm share/doc/apache
649
@dirrm www/cgi-bin
648
@dirrm www/cgi-bin.default
650
@dirrm www/cgi-bin.default
651
@dirrm www/data/images
652
@dirrm www/data
649
@dirrm www/icons/small
653
@dirrm www/icons/small
650
@dirrm www/icons
654
@dirrm www/icons
651
@dirrm www/proxy
655
@dirrm www/proxy
652

Return to bug 39557