postfixadmin.postinst 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/bin/bash
  2. set -e
  3. if [ "$1" = "configure" ]; then
  4. # configure DB stuff via dbconfig-common
  5. dbc_generate_include=php:/etc/postfixadmin/dbconfig.inc.php
  6. dbc_generate_include_args="-O root:www-data -m 640 -U"
  7. . /usr/share/debconf/confmodule
  8. . /usr/share/dbconfig-common/dpkg/postinst
  9. dbc_go postfixadmin $@
  10. fi
  11. # remove legacy apache and lighthttpd configuration symlink,
  12. # conf.d is no longer supported with Apache 2.4
  13. if [ "$(readlink /etc/apache2/conf.d/postfixadmin)" = "../../postfixadmin/apache.conf" ]; then
  14. rm -f /etc/apache2/conf.d/postfixadmin
  15. fi
  16. if [ "$(readlink /etc/lighttpd/conf-available/postfixadmin)" = "../../postfixadmin/lighttpd.conf" ]; then
  17. rm -f /etc/lighttpd/conf-available/postfixadmin
  18. fi
  19. # Try and avoid templates_c being in /usr/share/postfixadmin and ensure it's writeable by the webserver
  20. if [ ! -d /var/cache/postfixadmin ]; then
  21. mkdir -p /var/cache/postfixadmin
  22. chown www-data:root /var/cache/postfixadmin
  23. chmod 700 /var/cache/postfixadmin
  24. ln -s /var/cache/postfixadmin /usr/share/postfixadmin/templates_c
  25. fi
  26. # See : https://sourceforge.net/p/postfixadmin/bugs/376/ - remove any existing templates_c files on upgrade.
  27. if [ -d /usr/share/postfixadmin/templates_c ]; then
  28. find /usr/share/postfixadmin/templates_c -type f -delete
  29. fi
  30. if [ -d /usr/share/postfixadmin/templates_c ]; then
  31. chown www-data /usr/share/postfixadmin/templates_c
  32. fi
  33. if [ -d /var/cache/postfixadmin ]; then
  34. find /var/cache/postfixadmin -type f -delete
  35. chown www-data /var/cache/postfixadmin
  36. fi
  37. #DEBHELPER#
  38. exit 0