File: preremove

package info (click to toggle)
pcp 7.1.0-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 252,748 kB
  • sloc: ansic: 1,483,656; sh: 182,366; xml: 160,462; cpp: 83,813; python: 24,980; perl: 18,327; yacc: 6,877; lex: 2,864; makefile: 2,738; awk: 165; fortran: 60; java: 52
file content (43 lines) | stat: -rwxr-xr-x 937 bytes parent folder | download
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
#

PATH=/usr/sbin:$PATH; export 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