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