File: postrm

package info (click to toggle)
b2evolution 0.9.2-3%2Betch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 12,972 kB
  • ctags: 5,460
  • sloc: php: 58,989; sh: 298; makefile: 36
file content (58 lines) | stat: -rw-r--r-- 980 bytes parent folder | download | duplicates (2)
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
#! /bin/sh
# postrm script for b2evolution
#
# see: dh_installdeb(1)

set -e

# source debconf stuff
. /usr/share/debconf/confmodule

NAME="b2evolution"
db_get b2evolution/db_name || true
DB_NAME="$RET"

B2EVO_PATH=/usr/share/b2evolution


b2evo_db_remove() {
mysql --defaults-extra-file=/etc/mysql/debian.cnf <<EOF
CONNECT mysql;
delete from user where user='$NAME'; 
DELETE FROM db WHERE User = '$NAME';
DELETE FROM tables_priv WHERE User = '$NAME';
DELETE FROM columns_priv WHERE User = '$NAME';
FLUSH PRIVILEGES ;
DROP DATABASE IF EXISTS $DB_NAME;
EOF
}



case "$1" in

	remove)
	;;

	purge)
		rm -rf /etc/b2evolution/

		db_get b2evolution/db_ask || true
		if [ "$RET" = "true" ]; then
			db_subst b2evolution/db_remove b2evo_db_name "$DB_NAME"  || true
			db_input high b2evolution/db_remove || true
			db_go || true
			db_get b2evolution/db_remove || true
			if [ "$RET" = "true" ]; then
				b2evo_db_remove
			fi
		fi
		
		db_purge || true
	;;

esac

#DEBHELPER#

exit 0