clamav-unofficial-sigs-3.7.2.ebuild 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. # Copyright 1999-2015 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. DESCRIPTION="Downloads and installs third-party clamav signatures"
  5. HOMEPAGE="https://sourceforge.net/projects/unofficial-sigs"
  6. SRC_URI="mirror://sourceforge/unofficial-sigs/${P}.tar.gz"
  7. LICENSE="BSD"
  8. SLOT="0"
  9. KEYWORDS="amd64 x86"
  10. IUSE=""
  11. # We need its user/group.
  12. DEPEND="app-antivirus/clamav"
  13. # The script relies on either net-misc/socat, or Perl's
  14. # IO::Socket::UNIX. We already depend on Perl, and Gentoo's Perl ships
  15. # with IO::Socket::UNIX, so we can leave out net-misc/socat here.
  16. RDEPEND="${DEPEND}
  17. app-crypt/gnupg
  18. dev-lang/perl
  19. net-dns/bind-tools
  20. net-misc/curl"
  21. src_prepare() {
  22. # First, fix the paths contained in the configuration file. Eventually
  23. # these should be moved under /run, but for now we keep them sync'ed
  24. # with the default clamd.conf.
  25. local pid_default="/var/run/clamd.pid"
  26. local pid_gentoo="/var/run/clamav/clamd.pid"
  27. # clamd listens on a local socket by default. The clamd_socket
  28. # setting needs to be uncommented in the configuration file for it
  29. # to take effect.
  30. local socket_default="#clamd_socket=\"/var/run/clamd.socket\""
  31. local socket_gentoo="clamd_socket=\"/var/run/clamav/clamd.sock\""
  32. sed -i -e '$a\pkg_mgr="emerge"' \
  33. -e "\$a\\pkg_rm=\"emerge -C ${PN}\"" \
  34. -e "s~${socket_default}~${socket_gentoo}~" \
  35. -e "s~${pid_default}~${pid_gentoo}~" \
  36. "${PN}.conf" \
  37. || die "failed to update paths in the ${PN}.conf file"
  38. # Now, change the script's working directory to point to
  39. # /var/lib/${PN}. We'll need to make this writable by the clamav
  40. # user during src_install.
  41. sed -i -e "s~/usr/unofficial-dbs~/var/lib/${PN}~" "${PN}.conf" \
  42. || die "failed to update the work_dir variable in ${PN}.conf"
  43. # Tell the script that it's been configured.
  44. local cfged_default='user_configuration_complete="no"'
  45. local cfged_gentoo='user_configuration_complete="yes"'
  46. sed -i "s/${cfged_default}/${cfged_gentoo}/" "${PN}.conf" \
  47. || die "failed to set user configuration completed in ${PN}.conf"
  48. }
  49. src_install() {
  50. dosbin "${PN}.sh"
  51. # We set the script's working directory to /var/lib/${PN} in
  52. # src_compile, so make sure that the permissions are set correctly
  53. # here. By default, it runs as clamav/clamav.
  54. diropts -m 0755 -o clamav -g clamav
  55. dodir "/var/lib/${PN}"
  56. insinto /etc/logrotate.d
  57. doins "${PN}-logrotate"
  58. insinto /etc
  59. doins "${PN}.conf"
  60. doman "${PN}.8"
  61. dodoc CHANGELOG INSTALL README
  62. }
  63. pkg_postinst() {
  64. elog ''
  65. elog "You will need to select databases in /etc/${PN}.conf."
  66. elog "For details, please see the ${PN}(8) manual page."
  67. elog ''
  68. elog 'An up-to-date description of the available Sanesecurity'
  69. elog 'databases is available at,'
  70. elog ''
  71. elog ' http://sanesecurity.com/usage/signatures/'
  72. elog ''
  73. }