dropbear-2016.73.ebuild 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="5"
  4. inherit eutils savedconfig pam user
  5. DESCRIPTION="small SSH 2 client/server designed for small memory environments"
  6. HOMEPAGE="http://matt.ucc.asn.au/dropbear/dropbear.html"
  7. SRC_URI="http://matt.ucc.asn.au/dropbear/releases/${P}.tar.bz2
  8. http://matt.ucc.asn.au/dropbear/testing/${P}.tar.bz2"
  9. LICENSE="MIT"
  10. SLOT="0"
  11. KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~amd64-linux ~x86-linux"
  12. IUSE="bsdpty minimal multicall pam +shadow static +syslog zlib"
  13. LIB_DEPEND="zlib? ( sys-libs/zlib[static-libs(+)] )
  14. dev-libs/libtommath[static-libs(+)]"
  15. RDEPEND="!static? ( ${LIB_DEPEND//\[static-libs(+)]} )
  16. pam? ( virtual/pam )"
  17. DEPEND="${RDEPEND}
  18. static? ( ${LIB_DEPEND} )"
  19. RDEPEND+=" pam? ( >=sys-auth/pambase-20080219.1 )"
  20. REQUIRED_USE="pam? ( !static )"
  21. set_options() {
  22. progs=(
  23. dropbear dbclient dropbearkey
  24. $(usex minimal "" "dropbearconvert scp")
  25. )
  26. makeopts=(
  27. MULTI=$(usex multicall 1 0)
  28. STATIC=$(usex static 1 0)
  29. )
  30. }
  31. src_prepare() {
  32. epatch "${FILESDIR}"/${PN}-0.46-dbscp.patch
  33. sed -i \
  34. -e '/SFTPSERVER_PATH/s:".*":"/usr/lib/misc/sftp-server":' \
  35. options.h || die
  36. sed -i \
  37. -e '/pam_start/s:sshd:dropbear:' \
  38. svr-authpam.c || die
  39. restore_config options.h
  40. }
  41. src_configure() {
  42. # XXX: Need to add libtomcrypt to the tree and re-enable this.
  43. # --disable-bundled-libtom
  44. econf \
  45. $(use_enable zlib) \
  46. $(use_enable pam) \
  47. $(use_enable !bsdpty openpty) \
  48. $(use_enable shadow) \
  49. $(use_enable syslog)
  50. }
  51. src_compile() {
  52. set_options
  53. emake "${makeopts[@]}" PROGRAMS="${progs[*]}"
  54. }
  55. src_install() {
  56. set_options
  57. emake "${makeopts[@]}" PROGRAMS="${progs[*]}" DESTDIR="${D}" install
  58. doman *.8
  59. newinitd "${FILESDIR}"/dropbear.init.d dropbear
  60. newconfd "${FILESDIR}"/dropbear.conf.d dropbear
  61. dodoc CHANGES README TODO SMALL MULTI
  62. # The multi install target does not install the links right.
  63. if use multicall ; then
  64. cd "${ED}"/usr/bin
  65. local x
  66. for x in "${progs[@]}" ; do
  67. ln -sf dropbearmulti ${x} || die "ln -s dropbearmulti to ${x} failed"
  68. done
  69. rm -f dropbear
  70. dodir /usr/sbin
  71. dosym ../bin/dropbearmulti /usr/sbin/dropbear
  72. cd "${S}"
  73. fi
  74. save_config options.h
  75. if ! use minimal ; then
  76. mv "${ED}"/usr/bin/{,db}scp || die
  77. fi
  78. pamd_mimic system-remote-login dropbear auth account password session
  79. }
  80. pkg_preinst() {
  81. enewgroup sshd 22
  82. enewuser sshd 22 -1 /var/empty sshd
  83. }