summaryrefslogtreecommitdiff
path: root/build/sun/preremove
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2014-10-26 12:33:50 +0400
committerIgor Pashev <pashev.igor@gmail.com>2014-10-26 12:33:50 +0400
commit47e6e7c84f008a53061e661f31ae96629bc694ef (patch)
tree648a07f3b5b9d67ce19b0fd72e8caa1175c98f1a /build/sun/preremove
downloadpcp-debian.tar.gz
Debian 3.9.10debian/3.9.10debian
Diffstat (limited to 'build/sun/preremove')
-rwxr-xr-xbuild/sun/preremove43
1 files changed, 43 insertions, 0 deletions
diff --git a/build/sun/preremove b/build/sun/preremove
new file mode 100755
index 0000000..221ce4c
--- /dev/null
+++ b/build/sun/preremove
@@ -0,0 +1,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