forked from saltstack/salt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
salt.postrm
55 lines (49 loc) · 1.13 KB
/
salt.postrm
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
#!/bin/sh -e
# Purge config files, logs, and directories created after package install.
# Note that user-specified alternate locations for these are not affected.
#
# rename to salt-'common|master|minion|syndic'.postrm and call with "purge"
clean_common() {
# remove shared job cache and other runtime directories
rm -rf \
/var/cache/salt \
/var/log/salt \
/var/run/salt \
2> /dev/null
}
clean_conf() {
# remove config and log file for master, minion, or syndic
rm -rf \
/etc/salt/pki/$1 \
/var/cache/salt/$1 \
/var/log/salt/$1 \
/var/run/salt/$1 \
2> /dev/null
}
purgefiles() {
case "$pkg" in
master|minion|syndic)
clean_conf $pkg ;;
common)
clean_common ;;
*)
echo "$0 unknown package \`$1'" 1>&2
exit 1 ;;
esac
}
pkg=`echo $0 | cut -f1 -d. | cut -f2 -d-`
case "$1" in
remove)
;;
purge)
purgefiles
;;
upgrade|failed-upgrade|disappear|abort-install|abort-upgrade)
;;
*)
echo "$0 unknown action \`$1'" 1>&2
exit 1 ;;
esac
# This tag is required:
#DEBHELPER#
exit 0