1 |
# Copyright 1999-2009 Gentoo Foundation |
2 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
# $Header: /var/cvsroot/gentoo-x86/net-misc/openssh/openssh-5.1_p1-r3.ebuild,v 1.5 2009/08/13 06:30:33 vapier Exp $ |
4 |
|
5 |
inherit eutils flag-o-matic multilib autotools pam |
6 |
|
7 |
# Make it more portable between straight releases |
8 |
# and _p? releases. |
9 |
PARCH=${P/_/} |
10 |
|
11 |
X509_PATCH="${PARCH}+x509-6.1.1.diff.gz" |
12 |
LDAP_PATCH="${PARCH/openssh/openssh-lpk}-0.3.10.patch.gz" |
13 |
HPN_PATCH="${PARCH}-hpn13v5.diff.gz" |
14 |
|
15 |
DESCRIPTION="Port of OpenBSD's free SSH release" |
16 |
HOMEPAGE="http://www.openssh.org/" |
17 |
SRC_URI="mirror://openbsd/OpenSSH/portable/${PARCH}.tar.gz |
18 |
http://www.sxw.org.uk/computing/patches/openssh-5.0p1-gsskex-20080404.patch |
19 |
${LDAP_PATCH:+ldap? ( mirror://gentoo/${LDAP_PATCH} )} |
20 |
${X509_PATCH:+X509? ( http://roumenpetrov.info/openssh/x509-6.1.1/${X509_PATCH} )} |
21 |
${HPN_PATCH:+hpn? ( http://www.psc.edu/networking/projects/hpn-ssh/${HPN_PATCH} )}" |
22 |
#${LDAP_PATCH:+ldap? ( http://dev.inversepath.com/openssh-lpk/${LDAP_PATCH} )} |
23 |
|
24 |
LICENSE="as-is" |
25 |
SLOT="0" |
26 |
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~sparc-fbsd ~x86 ~x86-fbsd" |
27 |
IUSE="static pam tcpd kerberos skey selinux X509 ldap smartcard hpn libedit X" |
28 |
|
29 |
RDEPEND="pam? ( virtual/pam ) |
30 |
kerberos? ( virtual/krb5 ) |
31 |
selinux? ( >=sys-libs/libselinux-1.28 ) |
32 |
skey? ( >=sys-auth/skey-1.1.5-r1 ) |
33 |
ldap? ( net-nds/openldap ) |
34 |
libedit? ( dev-libs/libedit ) |
35 |
>=dev-libs/openssl-0.9.6d |
36 |
>=sys-libs/zlib-1.2.3 |
37 |
smartcard? ( dev-libs/opensc ) |
38 |
tcpd? ( >=sys-apps/tcp-wrappers-7.6 ) |
39 |
X? ( x11-apps/xauth ) |
40 |
userland_GNU? ( sys-apps/shadow )" |
41 |
DEPEND="${RDEPEND} |
42 |
dev-util/pkgconfig |
43 |
virtual/os-headers |
44 |
sys-devel/autoconf" |
45 |
RDEPEND="${RDEPEND} |
46 |
pam? ( >=sys-auth/pambase-20081028 )" |
47 |
PROVIDE="virtual/ssh" |
48 |
|
49 |
S=${WORKDIR}/${PARCH} |
50 |
|
51 |
pkg_setup() { |
52 |
# this sucks, but i'd rather have people unable to `emerge -u openssh` |
53 |
# than not be able to log in to their server any more |
54 |
maybe_fail() { [[ -z ${!2} ]] && use ${1} && echo ${1} ; } |
55 |
local fail=" |
56 |
$(maybe_fail X509 X509_PATCH) |
57 |
$(maybe_fail ldap LDAP_PATCH) |
58 |
" |
59 |
fail=$(echo ${fail}) |
60 |
if [[ -n ${fail} ]] ; then |
61 |
eerror "Sorry, but this version does not yet support features" |
62 |
eerror "that you requested: ${fail}" |
63 |
eerror "Please mask ${PF} for now and check back later:" |
64 |
eerror " # echo '=${CATEGORY}/${PF}' >> /etc/portage/package.mask" |
65 |
die "booooo" |
66 |
fi |
67 |
} |
68 |
|
69 |
src_unpack() { |
70 |
unpack ${PARCH}.tar.gz |
71 |
cd "${S}" |
72 |
|
73 |
sed -i \ |
74 |
-e '/_PATH_XAUTH/s:/usr/X11R6/bin/xauth:/usr/bin/xauth:' \ |
75 |
pathnames.h || die |
76 |
|
77 |
use X509 && epatch "${DISTDIR}"/${X509_PATCH} "${FILESDIR}"/${PN}-5.1_p1-x509-{headers,hpn-glue}.patch |
78 |
use smartcard && epatch "${FILESDIR}"/openssh-3.9_p1-opensc.patch |
79 |
if ! use X509 ; then |
80 |
if [[ -n ${LDAP_PATCH} ]] && use ldap ; then |
81 |
# The patch for bug 210110 64-bit stuff is now included. |
82 |
epatch "${DISTDIR}"/${LDAP_PATCH} |
83 |
epatch "${FILESDIR}"/${PN}-5.1_p1-ldap-hpn-glue.patch |
84 |
fi |
85 |
#epatch "${DISTDIR}"/openssh-5.0p1-gsskex-20080404.patch #115553 #216932 |
86 |
else |
87 |
use ldap && ewarn "Sorry, X509 and ldap don't get along, disabling ldap" |
88 |
fi |
89 |
epatch "${FILESDIR}"/${PN}-4.7_p1-GSSAPI-dns.patch #165444 integrated into gsskex |
90 |
[[ -n ${HPN_PATCH} ]] && use hpn && epatch "${DISTDIR}"/${HPN_PATCH} |
91 |
epatch "${FILESDIR}"/${PN}-4.7p1-selinux.diff #191665 |
92 |
|
93 |
sed -i "s:-lcrypto:$(pkg-config --libs openssl):" configure{,.ac} || die |
94 |
|
95 |
epatch "${FILESDIR}"/${P}-null-banner.patch #244222 |
96 |
epatch "${FILESDIR}"/${P}-escaped-banner.patch #244222 |
97 |
epatch "${FILESDIR}"/${P}-better-ssp-check.patch |
98 |
|
99 |
# Disable PATH reset, trust what portage gives us. bug 254615 |
100 |
sed -i -e 's:^PATH=/:#PATH=/:' configure || die |
101 |
|
102 |
eautoreconf |
103 |
} |
104 |
|
105 |
src_compile() { |
106 |
addwrite /dev/ptmx |
107 |
addpredict /etc/skey/skeykeys #skey configure code triggers this |
108 |
|
109 |
local myconf="" |
110 |
if use static ; then |
111 |
append-ldflags -static |
112 |
use pam && ewarn "Disabling pam support becuse of static flag" |
113 |
myconf="${myconf} --without-pam" |
114 |
else |
115 |
myconf="${myconf} $(use_with pam)" |
116 |
fi |
117 |
|
118 |
econf \ |
119 |
--with-ldflags="${LDFLAGS}" \ |
120 |
--disable-strip \ |
121 |
--sysconfdir=/etc/ssh \ |
122 |
--libexecdir=/usr/$(get_libdir)/misc \ |
123 |
--datadir=/usr/share/openssh \ |
124 |
--with-privsep-path=/var/empty \ |
125 |
--with-privsep-user=sshd \ |
126 |
--with-md5-passwords \ |
127 |
--with-ssl-engine \ |
128 |
${LDAP_PATCH:+$(use ldap && use_with ldap)} \ |
129 |
$(use_with libedit) \ |
130 |
$(use_with kerberos kerberos5 /usr) \ |
131 |
$(use_with tcpd tcp-wrappers) \ |
132 |
$(use_with selinux) \ |
133 |
$(use_with skey) \ |
134 |
$(use_with smartcard opensc) \ |
135 |
${myconf} \ |
136 |
|| die "bad configure" |
137 |
emake || die "compile problem" |
138 |
} |
139 |
|
140 |
src_install() { |
141 |
emake install-nokeys DESTDIR="${D}" || die |
142 |
fperms 600 /etc/ssh/sshd_config |
143 |
dobin contrib/ssh-copy-id |
144 |
newinitd "${FILESDIR}"/sshd.rc6 sshd |
145 |
newconfd "${FILESDIR}"/sshd.confd sshd |
146 |
keepdir /var/empty |
147 |
|
148 |
newpamd "${FILESDIR}"/sshd.pam_include.2 sshd |
149 |
if use pam; then |
150 |
sed -i \ |
151 |
-e "/^#UsePAM /s:.*:UsePAM yes:" \ |
152 |
-e "/^#PasswordAuthentication /s:.*:PasswordAuthentication no:" \ |
153 |
-e "/^#PrintMotd /s:.*:PrintMotd no:" \ |
154 |
-e "/^#PrintLastLog /s:.*:PrintLastLog no:" \ |
155 |
"${D}"/etc/ssh/sshd_config || die "sed of configuration file failed" |
156 |
fi |
157 |
|
158 |
doman contrib/ssh-copy-id.1 |
159 |
dodoc ChangeLog CREDITS OVERVIEW README* TODO sshd_config |
160 |
|
161 |
diropts -m 0700 |
162 |
dodir /etc/skel/.ssh |
163 |
} |
164 |
|
165 |
pkg_postinst() { |
166 |
enewgroup sshd 22 |
167 |
enewuser sshd 22 -1 /var/empty sshd |
168 |
|
169 |
# help fix broken perms caused by older ebuilds. |
170 |
# can probably cut this after the next stage release. |
171 |
chmod u+x "${ROOT}"/etc/skel/.ssh >& /dev/null |
172 |
|
173 |
ewarn "Remember to merge your config files in /etc/ssh/ and then" |
174 |
ewarn "reload sshd: '/etc/init.d/sshd reload'." |
175 |
if use pam ; then |
176 |
echo |
177 |
ewarn "Please be aware users need a valid shell in /etc/passwd" |
178 |
ewarn "in order to be allowed to login." |
179 |
fi |
180 |
} |