diff options
Diffstat (limited to 'meta/recipes-core/dropbear/dropbear.inc')
-rw-r--r-- | meta/recipes-core/dropbear/dropbear.inc | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/meta/recipes-core/dropbear/dropbear.inc b/meta/recipes-core/dropbear/dropbear.inc new file mode 100644 index 0000000000..1bdd4cbf86 --- /dev/null +++ b/meta/recipes-core/dropbear/dropbear.inc | |||
@@ -0,0 +1,104 @@ | |||
1 | DESCRIPTION = "Dropbear is a lightweight SSH and SCP implementation" | ||
2 | HOMEPAGE = "http://matt.ucc.asn.au/dropbear/dropbear.html" | ||
3 | SECTION = "console/network" | ||
4 | |||
5 | INC_PR = "r1" | ||
6 | |||
7 | # some files are from other projects and have others license terms: | ||
8 | # public domain, OpenSSH 3.5p1, OpenSSH3.6.1p2, PuTTY | ||
9 | LICENSE = "MIT" | ||
10 | LIC_FILES_CHKSUM = "file://LICENSE;md5=3a5b0c2f0d0c49dfde9558ae2036683c" | ||
11 | |||
12 | DEPENDS = "zlib" | ||
13 | RPROVIDES_${PN} = "ssh sshd" | ||
14 | |||
15 | DEPENDS += "${@base_contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}" | ||
16 | |||
17 | SRC_URI = "http://matt.ucc.asn.au/dropbear/releases/dropbear-${PV}.tar.bz2 \ | ||
18 | file://0001-urandom-xauth-changes-to-options.h.patch \ | ||
19 | file://0002-static_build_fix.patch \ | ||
20 | file://0003-configure.patch \ | ||
21 | file://0004-fix-2kb-keys.patch \ | ||
22 | file://0007-dropbear-fix-for-x32-abi.patch \ | ||
23 | file://build_test.patch \ | ||
24 | file://init \ | ||
25 | file://run-ptest \ | ||
26 | ${@base_contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)} " | ||
27 | |||
28 | PAM_SRC_URI = "file://0005-dropbear-enable-pam.patch \ | ||
29 | file://0006-dropbear-configuration-file.patch \ | ||
30 | file://dropbear" | ||
31 | |||
32 | inherit autotools update-rc.d | ||
33 | |||
34 | RDEPENDS_${PN}-ptest += "make" | ||
35 | |||
36 | INITSCRIPT_NAME = "dropbear" | ||
37 | INITSCRIPT_PARAMS = "defaults 10" | ||
38 | |||
39 | CFLAGS_prepend = " -I. " | ||
40 | LD = "${CC}" | ||
41 | |||
42 | SBINCOMMANDS = "dropbear dropbearkey dropbearconvert" | ||
43 | BINCOMMANDS = "dbclient ssh scp" | ||
44 | EXTRA_OEMAKE = 'MULTI=1 SCPPROGRESS=1 PROGRAMS="${SBINCOMMANDS} ${BINCOMMANDS}"' | ||
45 | EXTRA_OECONF += "\ | ||
46 | ${@base_contains('DISTRO_FEATURES', 'pam', '--enable-pam', '--disable-pam', d)}" | ||
47 | CFLAGS += "-DSFTPSERVER_PATH=\\"${libdir}/openssh/sftp-server\\"" | ||
48 | |||
49 | do_install() { | ||
50 | install -d ${D}${sysconfdir} \ | ||
51 | ${D}${sysconfdir}/init.d \ | ||
52 | ${D}${sysconfdir}/default \ | ||
53 | ${D}${sysconfdir}/dropbear \ | ||
54 | ${D}${bindir} \ | ||
55 | ${D}${sbindir} \ | ||
56 | ${D}${localstatedir} | ||
57 | |||
58 | install -m 0755 dropbearmulti ${D}${sbindir}/ | ||
59 | ln -s ${sbindir}/dropbearmulti ${D}${bindir}/dbclient | ||
60 | |||
61 | for i in ${SBINCOMMANDS} | ||
62 | do | ||
63 | ln -s ./dropbearmulti ${D}${sbindir}/$i | ||
64 | done | ||
65 | cat ${WORKDIR}/init | sed -e 's,/etc,${sysconfdir},g' \ | ||
66 | -e 's,/usr/sbin,${sbindir},g' \ | ||
67 | -e 's,/var,${localstatedir},g' \ | ||
68 | -e 's,/usr/bin,${bindir},g' \ | ||
69 | -e 's,/usr,${prefix},g' > ${D}${sysconfdir}/init.d/dropbear | ||
70 | chmod 755 ${D}${sysconfdir}/init.d/dropbear | ||
71 | for i in ${DISTRO_FEATURES}; | ||
72 | do | ||
73 | if [ ${i} = "pam" ]; then | ||
74 | install -d ${D}${sysconfdir}/pam.d | ||
75 | install -m 0644 ${WORKDIR}/dropbear ${D}${sysconfdir}/pam.d/ | ||
76 | fi | ||
77 | done | ||
78 | |||
79 | } | ||
80 | |||
81 | inherit update-alternatives | ||
82 | |||
83 | ALTERNATIVE_PRIORITY = "20" | ||
84 | ALTERNATIVE_${PN} = "scp ssh" | ||
85 | |||
86 | ALTERNATIVE_TARGET = "${sbindir}/dropbearmulti" | ||
87 | |||
88 | do_compile_ptest () { | ||
89 | oe_runmake dropbear | ||
90 | oe_runmake -C libtomcrypt test | ||
91 | } | ||
92 | |||
93 | do_install_ptest () { | ||
94 | install -D libtomcrypt/test ${D}${PTEST_PATH}/libtomcrypt/test | ||
95 | } | ||
96 | |||
97 | pkg_postrm_append_${PN} () { | ||
98 | if [ -f "${sysconfdir}/dropbear/dropbear_rsa_host_key" ]; then | ||
99 | rm ${sysconfdir}/dropbear/dropbear_rsa_host_key | ||
100 | fi | ||
101 | if [ -f "${sysconfdir}/dropbear/dropbear_dss_host_key" ]; then | ||
102 | rm ${sysconfdir}/dropbear/dropbear_dss_host_key | ||
103 | fi | ||
104 | } | ||