diff options
Diffstat (limited to 'meta/recipes-core/dropbear/dropbear.inc')
-rw-r--r-- | meta/recipes-core/dropbear/dropbear.inc | 106 |
1 files changed, 106 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..947a491679 --- /dev/null +++ b/meta/recipes-core/dropbear/dropbear.inc | |||
@@ -0,0 +1,106 @@ | |||
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 += "${@bb.utils.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 | ${@bb.utils.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 | PAM_PLUGINS = "libpam-runtime \ | ||
31 | pam-plugin-deny \ | ||
32 | pam-plugin-permit \ | ||
33 | pam-plugin-unix \ | ||
34 | " | ||
35 | RDEPENDS_${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${PAM_PLUGINS}', '', d)}" | ||
36 | |||
37 | inherit autotools update-rc.d systemd | ||
38 | |||
39 | INITSCRIPT_NAME = "dropbear" | ||
40 | INITSCRIPT_PARAMS = "defaults 10" | ||
41 | |||
42 | SYSTEMD_SERVICE_${PN} = "dropbear.socket" | ||
43 | |||
44 | CFLAGS_prepend = " -I. " | ||
45 | LD = "${CC}" | ||
46 | |||
47 | SBINCOMMANDS = "dropbear dropbearkey dropbearconvert" | ||
48 | BINCOMMANDS = "dbclient ssh scp" | ||
49 | EXTRA_OEMAKE = 'MULTI=1 SCPPROGRESS=1 PROGRAMS="${SBINCOMMANDS} ${BINCOMMANDS}"' | ||
50 | EXTRA_OECONF += "\ | ||
51 | ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '--enable-pam', '--disable-pam', d)}" | ||
52 | CFLAGS += "-DSFTPSERVER_PATH=\\"${libdir}/openssh/sftp-server\\"" | ||
53 | |||
54 | do_install() { | ||
55 | install -d ${D}${sysconfdir} \ | ||
56 | ${D}${sysconfdir}/init.d \ | ||
57 | ${D}${sysconfdir}/default \ | ||
58 | ${D}${sysconfdir}/dropbear \ | ||
59 | ${D}${bindir} \ | ||
60 | ${D}${sbindir} \ | ||
61 | ${D}${localstatedir} | ||
62 | |||
63 | install -m 0755 dropbearmulti ${D}${sbindir}/ | ||
64 | ln -s ${sbindir}/dropbearmulti ${D}${bindir}/dbclient | ||
65 | |||
66 | for i in ${SBINCOMMANDS} | ||
67 | do | ||
68 | ln -s ./dropbearmulti ${D}${sbindir}/$i | ||
69 | done | ||
70 | sed -e 's,/etc,${sysconfdir},g' \ | ||
71 | -e 's,/usr/sbin,${sbindir},g' \ | ||
72 | -e 's,/var,${localstatedir},g' \ | ||
73 | -e 's,/usr/bin,${bindir},g' \ | ||
74 | -e 's,/usr,${prefix},g' ${WORKDIR}/init > ${D}${sysconfdir}/init.d/dropbear | ||
75 | chmod 755 ${D}${sysconfdir}/init.d/dropbear | ||
76 | if [ "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'pam', '', d)}" = "pam" ]; then | ||
77 | install -d ${D}${sysconfdir}/pam.d | ||
78 | install -m 0644 ${WORKDIR}/dropbear ${D}${sysconfdir}/pam.d/ | ||
79 | fi | ||
80 | |||
81 | # deal with systemd unit files | ||
82 | install -d ${D}${systemd_unitdir}/system | ||
83 | install -m 0644 ${WORKDIR}/dropbearkey.service ${D}${systemd_unitdir}/system | ||
84 | install -m 0644 ${WORKDIR}/dropbear@.service ${D}${systemd_unitdir}/system | ||
85 | install -m 0644 ${WORKDIR}/dropbear.socket ${D}${systemd_unitdir}/system | ||
86 | sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \ | ||
87 | -e 's,@BINDIR@,${bindir},g' \ | ||
88 | -e 's,@SBINDIR@,${sbindir},g' \ | ||
89 | ${D}${systemd_unitdir}/system/dropbear.socket ${D}${systemd_unitdir}/system/*.service | ||
90 | } | ||
91 | |||
92 | inherit update-alternatives | ||
93 | |||
94 | ALTERNATIVE_PRIORITY = "20" | ||
95 | ALTERNATIVE_${PN} = "scp ssh" | ||
96 | |||
97 | ALTERNATIVE_TARGET = "${sbindir}/dropbearmulti" | ||
98 | |||
99 | pkg_postrm_append_${PN} () { | ||
100 | if [ -f "${sysconfdir}/dropbear/dropbear_rsa_host_key" ]; then | ||
101 | rm ${sysconfdir}/dropbear/dropbear_rsa_host_key | ||
102 | fi | ||
103 | if [ -f "${sysconfdir}/dropbear/dropbear_dss_host_key" ]; then | ||
104 | rm ${sysconfdir}/dropbear/dropbear_dss_host_key | ||
105 | fi | ||
106 | } | ||