rename packages/ to recipes/ per earlier agreement
[openembedded.git] / recipes / openssh / openssh_4.6p1.bb
1 DEPENDS = "zlib openssl"
2
3 RCONFLICTS_openssh = "dropbear"
4 RCONFLICTS_openssh-sshd = "dropbear"
5
6 SECTION = "console/network"
7 DESCRIPTION = "Secure rlogin/rsh/rcp/telnet replacement (OpenSSH) \
8 Ssh (Secure Shell) is a program for logging into a remote machine \
9 and for executing commands on a remote machine. \
10 It provides secure encrypted communications between two untrusted \
11 hosts over an insecure network.  X11 connections and arbitrary TCP/IP \
12 ports can also be forwarded over the secure channel. \
13 It is intended as a replacement for rlogin, rsh and rcp, and can be \
14 used to provide applications with a secure communication channel."
15 HOMEPAGE = "http://www.openssh.org/"
16 LICENSE = "BSD"
17 PR = "r6"
18
19 SRC_URI = "ftp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-${PV}.tar.gz \
20            file://sftp-server-nolibcrypto.patch;patch=1 \
21            file://sshd_config \
22            file://ssh_config \
23            file://init"
24
25 inherit autotools
26
27 export ASKPASS_PROGRAM = "${bindir}/ssh-askpass"
28 export LD = "${CC}"
29 CFLAGS_prepend = "-I${S} "
30 CFLAGS_append = " -D__FILE_OFFSET_BITS=64"
31 LDFLAGS_prepend = "-L${S} -L${S}/openbsd-compat "
32 EXTRA_OECONF = "--disable-suid-ssh --with-ssl=${STAGING_LIBDIR}/ssl \
33                 --with-rand-helper=no --without-pam \
34                 --without-zlib-version-check \
35                 --with-privsep-path=/var/run/sshd \
36                 --sysconfdir=${sysconfdir}/ssh \
37                 --with-xauth=/usr/bin/xauth"
38
39 EXTRA_OEMAKE = "'STRIP_OPT='"
40
41 do_configure_prepend () {
42         if [ ! -e acinclude.m4 -a -e aclocal.m4 ]; then
43                 cp aclocal.m4 acinclude.m4
44         fi
45 }
46
47 do_compile_append () {
48         install -m 0644 ${WORKDIR}/sshd_config ${S}/
49         install -m 0644 ${WORKDIR}/ssh_config ${S}/
50 }
51
52 do_install_append() {
53         install -d ${D}${sysconfdir}/init.d
54         install -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/sshd
55         mv ${D}${bindir}/scp ${D}${bindir}/scp.openssh
56         mv ${D}${bindir}/ssh ${D}${bindir}/ssh.openssh
57         rmdir ${D}/var/run/sshd ${D}/var/run ${D}/var
58 }
59
60 PACKAGES =+ " ssh-keygen openssh-scp openssh-ssh openssh-sshd openssh-sftp openssh-misc openssh-sftp-server"
61 FILES_openssh-dbg +=${bindir}/.debug ${libdir}exec/.debug"
62 FILES_openssh-scp = "${bindir}/scp.${PN}"
63 FILES_openssh-ssh = "${bindir}/ssh.${PN} ${bindir}/slogin /${sysconfdir}/ssh/ssh_config"
64 FILES_openssh-sshd = "${sbindir}/sshd /${sysconfdir}/init.d/sshd"
65 FILES_openssh-sshd += " /${sysconfdir}/ssh/moduli /${sysconfdir}/ssh/sshd_config"
66 FILES_openssh-sftp = "${bindir}/sftp"
67 FILES_openssh-sftp-server = "${libdir}exec/sftp-server"
68 FILES_openssh-misc = "${bindir}/ssh* ${libdir}exec/ssh*"
69 FILES_ssh-keygen = "${bindir}/ssh-keygen"
70
71 RDEPENDS_openssh += " openssh-scp openssh-ssh openssh-sshd ssh-keygen "
72 DEPENDS_openssh-sshd += " update-rc.d"
73 RDEPENDS_openssh-sshd += " update-rc.d ssh-keygen "
74
75 pkg_postinst_openssh-sshd() {
76 if test "x$D" != "x"; then
77         exit 1
78 else
79         addgroup sshd
80         adduser --system --home /var/run/sshd --no-create-home --disabled-password --ingroup sshd -s /bin/false sshd
81         update-rc.d sshd defaults 9
82 fi
83 }
84
85 pkg_postinst_openssh-scp() {
86         update-alternatives --install ${bindir}/scp scp scp.${PN} 90
87 }
88
89 pkg_postinst_openssh-ssh() {
90         update-alternatives --install ${bindir}/ssh ssh ssh.${PN} 90
91 }
92
93 pkg_postrm_openssh-ssh() {
94         update-alternatives --remove ${bindir}/ssh ssh.${PN}
95 }
96
97 pkg_postrm_openssh-scp() {
98         update-alternatives --remove ${bindir}/scp scp.${PN}
99 }
100
101 pkg_postrm_openssh-sshd() {
102 if test "x$D" != "x"; then
103         exit 1
104 else
105         ${sysconfdir}/init.d/sshd stop
106         deluser sshd
107         delgroup sshd
108         update-rc.d -f sshd remove
109 fi
110 }
111
112 CONFFILES_openssh-sshd = "${sysconfdir}/ssh/sshd_config"
113 CONFFILES_openssh-ssh = "${sysconfdir}/ssh/ssh_config"