File: cacti.postrm

package info (click to toggle)
cacti 0.6.7-2.2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,000 kB
  • ctags: 1,120
  • sloc: php: 5,059; sql: 922; sh: 302; perl: 81; makefile: 56
file content (113 lines) | stat: -rw-r--r-- 2,784 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#! /bin/sh
# postrm script for mifluz
#
# see: dh_installdeb(1)

set -e

get_config()    
{
        db_get cacti/mysql_server
        mysql_server="$RET"
        db_get cacti/database
        database="$RET"
        db_get cacti/root_mysql
        root_mysql="$RET"
        db_get cacti/root_password
        root_passwd="$RET"
        db_get cacti/username
        username="$RET"
        db_get cacti/password
        password="$RET"
	db_get cacti/purge_db
	purge_db="$RET"
	db_get cacti/webserver
	webserver="$RET"
}



# summary of how this script can be called:
#        * <postrm> `remove'
#        * <postrm> `purge'
#        * <old-postrm> `upgrade' <new-version>
#        * <new-postrm> `failed-upgrade' <old-version>
#        * <new-postrm> `abort-install'
#        * <new-postrm> `abort-install' <old-version>
#        * <new-postrm> `abort-upgrade' <old-version>
#        * <disappearer's-postrm> `disappear' <r>overwrit>r> <new-version>
# for details, see /usr/share/doc/packaging-manual/

case "$1" in
	purge)
	. /usr/share/debconf/confmodule
	db_version 2.0
	get_config
        mysqlpwd=""
        if [ "$root_passwd" != 'none' ]; then
                mysqlpwd="-p${root_passwd}"
        fi
        mysqlcmd="mysql -h ${mysql_server} -u${root_mysql} ${mysqlpwd}"
       includefile=/etc/cacti/apache.conf
                server=${webserver}
                servers=${webserver}
		. /usr/share/wwwconfig-common/apache-uninclude_all.sh
		if [ "$status" = "purge" ]
		then
			restart="${webserver}"
		fi
		test -d /etc/cacti && rm -rf /etc/cacti
		if [ "${purge_db}" = "true" ]
		then
			$mysqlcmd -e "drop database ${database}"
			$mysqlcmd -e "delete from user where user='${username}' and host='${mysql_server}'" mysql
			$mysqlcmd -e "delete from db where user='${username}' and host='${mysql_server}'" mysql
		fi

	;;

       remove)

	. /usr/share/debconf/confmodule
	db_version 2.0
	get_config
        mysqlpwd=""
        if [ "$root_passwd" != 'none' ]; then
                mysqlpwd="-p${root_passwd}"
        fi
        mysqlcmd="mysql -h ${mysql_server} -u${root_mysql} ${mysqlpwd}"

	if [ -f /etc/apache/httpd.conf \
	-a -f /usr/share/wwwconfig-common/apache-uninclude_all.sh ]
	then
		includefile=/etc/cacti/apache.conf
		server=${webserver}
		servers=${webserver}
		. /usr/share/wwwconfig-common/apache-cominclude_all.sh
		if [ "$status" = "comment" ]
		then
			restart="${webserver}"
			. /usr/share/wwwconfig-common/restart.sh
		fi
	fi
	db_stop


        ;;
       upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)


        ;;

    *)
        echo "postrm called with unknown argument \`$1'" >&2
        exit 0

esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0