ip-sentinel-0.12.ebuild 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. # Copyright 1999-2014 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. inherit eutils user
  5. DESCRIPTION="Prevent unauthorized usage of IPs in the local ethernet broadcastdomain by answering ARP-requests"
  6. HOMEPAGE="http://www.nongnu.org/ip-sentinel/"
  7. LICENSE="GPL-2"
  8. SRC_URI="https://savannah.nongnu.org/download/ip-sentinel/${P}.tar.bz2"
  9. SLOT="0"
  10. KEYWORDS="x86"
  11. DOCS=( AUTHORS ChangeLog NEWS README THANKS )
  12. src_install() {
  13. default
  14. newinitd "${FILESDIR}"/ip-sentinel.init ip-sentinel
  15. newconfd "${FILESDIR}"/ip-sentinel.conf.d ip-sentinel
  16. insinto /etc
  17. newins "${FILESDIR}"/ip-sentinel.cfg ip-sentinel.cfg
  18. }
  19. pkg_setup() {
  20. enewgroup ipsentinel
  21. enewuser ipsentinel -1 -1 -1 ipsentinel
  22. }
  23. pkg_postinst() {
  24. elog "You can edit /etc/conf.d/ip-sentinel to customize startup daemon"
  25. elog "settings."
  26. elog
  27. elog "Default ip-sentinel config is in /etc/ip-sentinel.cfg"
  28. elog
  29. elog "The ip-sentinel ebuild has chroot support."
  30. elog "If you like to run ip-sentinel in chroot AND this is a new install OR"
  31. elog "your ip-sentinel doesn't already run in chroot, simply run:"
  32. elog "emerge --config =${CATEGORY}/${PF}"
  33. elog "Before running the above command you might want to change the chroot"
  34. elog "dir in /etc/conf.d/ip-sentinel, otherwise /chroot/ip-sentinel will be used."
  35. echo
  36. ewarn "And please! DO NOT START THIS DAEMON thoughtlessly."
  37. ewarn "If you DO this will BLOCK ALL communication inside your ethernet"
  38. ewarn "segment!!! If you have any doubts do not start ip-sentinel."
  39. }
  40. pkg_config() {
  41. CHROOT=`sed -n 's/^[[:blank:]]\?CHROOT="\([^"]\+\)"/\1/p' /etc/conf.d/ip-sentinel 2>/dev/null`
  42. if [ ! -d "${CHROOT:=/chroot/ip-sentinel}" ] ; then
  43. ebegin "Setting up the chroot directory"
  44. mkdir -m 0755 -p "${CHROOT}/etc"
  45. cp -R /etc/ip-sentinel.cfg "${CHROOT}/etc"
  46. eend
  47. if [ "`grep '^#[[:blank:]]\?CHROOT' /etc/conf.d/ip-sentinel`" ] ; then
  48. sed -e '/^#[[:blank:]]\?CHROOT/s/^#[[:blank:]]\?//' \
  49. -i /etc/conf.d/ip-sentinel
  50. fi
  51. else
  52. eerror
  53. eerror "${CHROOT} already exists. Quitting."
  54. eerror
  55. fi
  56. }