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.58.ebuild,v 1.1 2013/04/18 16:50:30 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}"/dropbear-0.46-dbscp.patch |
42 |
sed -i '1i#define _GNU_SOURCE' scpmisc.c || die |
43 |
sed -i \ |
44 |
-e '/SFTPSERVER_PATH/s:".*":"/usr/lib/misc/sftp-server":' \ |
45 |
-e '/XAUTH_COMMAND/s:/X11R6/:/:' \ |
46 |
options.h |
47 |
sed -i \ |
48 |
-e '/pam_start/s:sshd:dropbear:' \ |
49 |
svr-authpam.c || die |
50 |
restore_config options.h |
51 |
} |
52 |
|
53 |
src_configure() { |
54 |
econf \ |
55 |
--disable-bundled-libtom \ |
56 |
$(use_enable zlib) \ |
57 |
$(use_enable pam) \ |
58 |
$(use_enable !bsdpty openpty) \ |
59 |
$(use_enable shadow) \ |
60 |
$(use_enable syslog) |
61 |
} |
62 |
|
63 |
src_compile() { |
64 |
set_options |
65 |
emake ${makeopts[@]} PROGRAMS="${progs[*]}" |
66 |
} |
67 |
|
68 |
src_install() { |
69 |
set_options |
70 |
emake install DESTDIR="${D}" ${makeopts[@]} PROGRAMS="${progs[*]}" |
71 |
doman *.8 |
72 |
newinitd "${FILESDIR}"/dropbear.init.d dropbear |
73 |
newconfd "${FILESDIR}"/dropbear.conf.d dropbear |
74 |
dodoc CHANGES README TODO SMALL MULTI |
75 |
|
76 |
# The multi install target does not install the links |
77 |
if use multicall ; then |
78 |
cd "${ED}"/usr/bin |
79 |
local x |
80 |
for x in ${progs[@]} ; do |
81 |
ln -s dropbearmulti ${x} || die "ln -s dropbearmulti to ${x} failed" |
82 |
done |
83 |
rm -f dropbear |
84 |
dodir /usr/sbin |
85 |
dosym ../bin/dropbearmulti /usr/sbin/dropbear |
86 |
cd "${S}" |
87 |
fi |
88 |
save_config options.h |
89 |
|
90 |
if ! use minimal ; then |
91 |
mv "${ED}"/usr/bin/{,db}scp || die |
92 |
fi |
93 |
|
94 |
pamd_mimic system-remote-login dropbear auth account password session |
95 |
} |
96 |
|
97 |
pkg_preinst() { |
98 |
enewgroup sshd 22 |
99 |
enewuser sshd 22 -1 /var/empty sshd |
100 |
} |