open-iscsi-2.0.873.ebuild 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. # Copyright 1999-2015 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. inherit versionator linux-info eutils flag-o-matic toolchain-funcs
  5. MY_P="${PN}-$(replace_version_separator 2 "-")"
  6. DESCRIPTION="Open-iSCSI is a high performance, transport independent, multi-platform implementation of RFC3720"
  7. HOMEPAGE="http://www.open-iscsi.org/"
  8. SRC_URI="http://www.open-iscsi.org/bits/${MY_P}.tar.gz"
  9. LICENSE="GPL-2"
  10. SLOT="0"
  11. KEYWORDS="~alpha amd64 ~arm ~ia64 ~mips ~ppc ~ppc64 ~sparc x86"
  12. IUSE="debug slp"
  13. DEPEND="slp? ( net-libs/openslp )"
  14. RDEPEND="${DEPEND}
  15. sys-fs/lsscsi
  16. sys-apps/util-linux"
  17. S="${WORKDIR}/${MY_P}"
  18. pkg_setup() {
  19. linux-info_pkg_setup
  20. if kernel_is -lt 2 6 16; then
  21. die "Sorry, your kernel must be 2.6.16-rc5 or newer!"
  22. fi
  23. # Needs to be done, as iscsid currently only starts, when having the iSCSI
  24. # support loaded as module. Kernel builtion options don't work. See this for
  25. # more information:
  26. # https://groups.google.com/group/open-iscsi/browse_thread/thread/cc10498655b40507/fd6a4ba0c8e91966
  27. # If there's a new release, check whether this is still valid!
  28. CONFIG_CHECK_MODULES="SCSI_ISCSI_ATTRS ISCSI_TCP"
  29. if linux_config_exists; then
  30. for module in ${CONFIG_CHECK_MODULES}; do
  31. linux_chkconfig_module ${module} || ewarn "${module} needs to be built as module (builtin doesn't work)"
  32. done
  33. fi
  34. }
  35. src_prepare() {
  36. epatch "${FILESDIR}"/${P}-Makefiles.patch
  37. sed -i -e 's:^\(iscsid.startup\)\s*=.*:\1 = /usr/sbin/iscsid:' etc/iscsid.conf || die
  38. }
  39. src_configure() {
  40. cd utils/open-isns || die
  41. # SSL (--with-security) is broken
  42. econf $(use_with slp) \
  43. --without-security
  44. }
  45. src_compile() {
  46. use debug && append-flags -DDEBUG_TCP -DDEBUG_SCSI
  47. KSRC="${KV_DIR}" CFLAGS="" \
  48. emake \
  49. OPTFLAGS="${CFLAGS}" \
  50. AR="$(tc-getAR)" CC="$(tc-getCC)" \
  51. user
  52. }
  53. src_install() {
  54. emake DESTDIR="${ED}" sbindir="/usr/sbin" install
  55. dodoc README THANKS
  56. docinto test/
  57. dodoc test/*
  58. insinto /etc/iscsi
  59. newins "${FILESDIR}"/initiatorname.iscsi initiatorname.iscsi.example
  60. # udev pieces
  61. insinto /lib/udev/rules.d
  62. doins "${FILESDIR}"/99-iscsi.rules
  63. exeinto /etc/udev/scripts
  64. doexe "${FILESDIR}"/iscsidev.sh
  65. newconfd "${FILESDIR}"/iscsid-conf.d iscsid
  66. newinitd "${FILESDIR}"/iscsid-init.d iscsid
  67. keepdir /var/db/iscsi
  68. fperms 700 /var/db/iscsi
  69. fperms 600 /etc/iscsi/iscsid.conf
  70. }