tt-rss-20160527.ebuild 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. inherit user eutils webapp vcs-snapshot
  5. DESCRIPTION="Tiny Tiny RSS - A web-based news feed (RSS/Atom) aggregator using AJAX"
  6. HOMEPAGE="http://tt-rss.org/"
  7. SRC_URI="https://dev.gentoo.org/~tomka/files/${P}.tar.bz2"
  8. LICENSE="GPL-3"
  9. KEYWORDS="~amd64 ~mips ~x86"
  10. IUSE="daemon +mysqli postgres"
  11. DEPEND="
  12. daemon? ( dev-lang/php:*[mysqli?,postgres?,pcntl,curl] )
  13. !daemon? ( dev-lang/php:*[mysqli?,postgres?,curl] )
  14. virtual/httpd-php:*
  15. "
  16. RDEPEND="${DEPEND}"
  17. REQUIRED_USE="|| ( mysqli postgres )"
  18. need_httpd_cgi # From webapp.eclass
  19. pkg_setup() {
  20. webapp_pkg_setup
  21. if use daemon; then
  22. enewgroup ttrssd
  23. enewuser ttrssd -1 /bin/sh /dev/null ttrssd
  24. fi
  25. }
  26. src_prepare() {
  27. # Customize config.php-dist so that the right 'DB_TYPE' is already set (according to the USE flag)
  28. einfo "Customizing config.php-dist..."
  29. if use mysqli && ! use postgres; then
  30. sed -i \
  31. -e "/define('DB_TYPE',/{s:pgsql:mysql:}" \
  32. config.php-dist || die
  33. fi
  34. sed -i \
  35. -e "/define('DB_TYPE',/{s:// \(or mysql\):// pgsql \1:}" \
  36. config.php-dist || die
  37. # per 462578
  38. epatch_user
  39. }
  40. src_install() {
  41. webapp_src_preinst
  42. insinto "/${MY_HTDOCSDIR}"
  43. doins -r *
  44. keepdir "/${MY_HTDOCSDIR}"/feed-icons
  45. for DIR in cache lock feed-icons; do
  46. webapp_serverowned -R "${MY_HTDOCSDIR}/${DIR}"
  47. done
  48. # In the old days we put a config.php directly and tried to
  49. # protect it with the following which did not work reliably.
  50. # These days we only install the config.php-dist file.
  51. # webapp_configfile "${MY_HTDOCSDIR}"/config.php
  52. if use daemon; then
  53. webapp_postinst_txt en "${FILESDIR}"/postinstall-en-with-daemon.txt
  54. newinitd "${FILESDIR}"/ttrssd.initd-r2 ttrssd
  55. newconfd "${FILESDIR}"/ttrssd.confd-r1 ttrssd
  56. insinto /etc/logrotate.d/
  57. newins "${FILESDIR}"/ttrssd.logrotated ttrssd
  58. elog "After upgrading, please restart ttrssd"
  59. else
  60. webapp_postinst_txt en "${FILESDIR}"/postinstall-en.txt
  61. fi
  62. webapp_src_install
  63. }
  64. pkg_postinst() {
  65. elog "You need to merge config.php and config.php-dist manually now."
  66. webapp_pkg_postinst
  67. }