1
0

salt.postrm 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/bin/sh -e
  2. # Purge config files, logs, and directories created after package install.
  3. # Note that user-specified alternate locations for these are not affected.
  4. #
  5. # rename to salt-'common|master|minion|syndic'.postrm and call with "purge"
  6. clean_common() {
  7. # remove shared job cache and other runtime directories
  8. rm -rf \
  9. /var/cache/salt \
  10. /var/log/salt \
  11. /var/run/salt \
  12. 2> /dev/null
  13. }
  14. clean_conf() {
  15. # remove config and log file for master, minion, or syndic
  16. rm -rf \
  17. /etc/salt/pki/$1 \
  18. /var/cache/salt/$1 \
  19. /var/log/salt/$1 \
  20. /var/run/salt/$1 \
  21. 2> /dev/null
  22. }
  23. purgefiles() {
  24. case "$pkg" in
  25. master|minion|syndic)
  26. clean_conf $pkg ;;
  27. common)
  28. clean_common ;;
  29. *)
  30. echo "$0 unknown package \`$1'" 1>&2
  31. exit 1 ;;
  32. esac
  33. }
  34. pkg=`echo $0 | cut -f1 -d. | cut -f2 -d-`
  35. case "$1" in
  36. remove)
  37. ;;
  38. purge)
  39. purgefiles
  40. ;;
  41. upgrade|failed-upgrade|disappear|abort-install|abort-upgrade)
  42. ;;
  43. *)
  44. echo "$0 unknown action \`$1'" 1>&2
  45. exit 1 ;;
  46. esac
  47. # This tag is required:
  48. #DEBHELPER#
  49. exit 0