mailbase-1.ebuild 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. # Copyright 1999-2014 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. inherit pam eutils user
  4. DESCRIPTION="MTA layout package"
  5. SRC_URI=""
  6. HOMEPAGE="https://www.gentoo.org/"
  7. LICENSE="GPL-2"
  8. SLOT="0"
  9. KEYWORDS="alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
  10. IUSE="pam"
  11. RDEPEND="pam? ( virtual/pam )"
  12. S=${WORKDIR}
  13. pkg_setup() {
  14. enewgroup mail 12
  15. enewuser mail 8 -1 /var/spool/mail mail
  16. enewuser postmaster 14 -1 /var/spool/mail
  17. }
  18. src_install() {
  19. dodir /etc/mail
  20. insinto /etc/mail
  21. doins "${FILESDIR}"/aliases || die
  22. insinto /etc
  23. doins "${FILESDIR}"/mailcap || die
  24. keepdir /var/spool/mail
  25. fowners root:mail /var/spool/mail
  26. fperms 0775 /var/spool/mail
  27. dosym /var/spool/mail /var/mail
  28. newpamd "${FILESDIR}"/common-pamd-include pop
  29. newpamd "${FILESDIR}"/common-pamd-include imap
  30. if use pam ; then
  31. local p
  32. for p in pop3 pop3s pops ; do
  33. dosym pop /etc/pam.d/${p} || die
  34. done
  35. for p in imap4 imap4s imaps ; do
  36. dosym imap /etc/pam.d/${p} || die
  37. done
  38. fi
  39. }
  40. get_permissions_oct() {
  41. if [[ ${USERLAND} = GNU ]] ; then
  42. stat -c%a "${ROOT}$1"
  43. elif [[ ${USERLAND} = BSD ]] ; then
  44. stat -f%p "${ROOT}$1" | cut -c 3-
  45. fi
  46. }
  47. pkg_postinst() {
  48. if [[ "$(get_permissions_oct /var/spool/mail)" != "775" ]] ; then
  49. echo
  50. ewarn "Your ${ROOT}/var/spool/mail/ directory permissions differ from"
  51. ewarn " those which mailbase set when you first installed it (0775)."
  52. ewarn " If you did not change them on purpose, consider running:"
  53. ewarn
  54. ewarn " chmod 0775 ${ROOT}/var/spool/mail/"
  55. echo
  56. fi
  57. }