salt/pkg/salt.postrm

59 lines
1.2 KiB
Plaintext
Raw Normal View History

2012-11-24 01:17:57 +00:00
#!/bin/sh -e
# Purge config files, logs, and directories created after package install.
# Note that user-specified alternate locations for these are not affected.
2012-12-04 09:21:38 +00:00
#
# rename to salt-'common|master|minion|syndic'.postrm and call with "purge"
clean_common() {
2012-11-21 20:49:18 +00:00
# remove shared job cache and other runtime directories
rm -rf \
/etc/salt \
/var/cache/salt \
/var/log/salt \
/var/run/salt \
2> /dev/null
}
2012-11-21 20:49:18 +00:00
clean_conf() {
# remove config and log file for master, minion, or syndic
rm -rf \
/etc/salt/"$1" \
/etc/salt/"$1".d \
/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)
2012-12-04 09:21:38 +00:00
purgefiles
;;
upgrade|failed-upgrade|disappear|abort-install|abort-upgrade)
;;
*)
echo "$0 unknown action \`$1'" 1>&2
exit 1 ;;
esac
2012-12-04 09:21:38 +00:00
# This tag is required:
2012-11-24 01:17:57 +00:00
#DEBHELPER#
exit 0