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