summaryrefslogtreecommitdiff
path: root/build/sun/preremove
blob: 221ce4c643326b65486f421ee59fe81d4666d967 (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
#!/bin/sh
#
# Stop PCP related services before removing the package
#

export PATH=/usr/sbin:$PATH

svcs -H svc:/application/pcp/\* \
| while read state ts svc; do
	if [ "$state" = "online" ] ; then
		svcadm -v disable -s $svc
	fi
	svccfg delete -f $svc
done

if [ -f /etc/pcp.conf ]
then
    # for all the configuration files we know about, the goal is it
    # have files with a .pre suffix unless we're certain they have
    # not been locally altered
    #
    . /etc/pcp.conf
    for conf in \
	$PCP_PMCDCONF_PATH $PCP_PMCDOPTIONS_PATH $PCP_PMCDRCLOCAL_PATH \
	$PCP_PMIECONTROL_PATH $PCP_PMLOGGERCONTROL_PATH \
	$PCP_PMPROXYOPTIONS_PATH $PCP_PMWEBDOPTIONS_PATH
    do
	if [ -f $conf.orig -a -f $conf ]
	then
	    if cmp -s $conf.orig $conf
	    then
		# file not changed since installation
		rm $conf.orig
	    else
		cp $conf $conf.pre
		rm $conf.orig
	    fi
	elif [ -f $conf ]
	then
	    cp $conf $conf.pre
	fi
    done
fi