blob: b6b436c584d8f51914dcfa493ed66706177365bb [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001SUMMARY = "A lightweight SSH and SCP implementation"
2HOMEPAGE = "http://matt.ucc.asn.au/dropbear/dropbear.html"
3SECTION = "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
7LICENSE = "MIT & BSD-3-Clause & BSD-2-Clause & PD"
8LIC_FILES_CHKSUM = "file://LICENSE;md5=a5ec40cafba26fc4396d0b550f824e01"
9
10DEPENDS = "zlib"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050011RPROVIDES_${PN} = "ssh sshd"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050012
13DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'libpam', '', d)}"
14
15SRC_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 \
Patrick Williamsc0f7c042017-02-23 20:41:17 -060020 file://fix-libtomcrypt-libtommath-ordering.patch \
Patrick Williamsc124f4f2015-09-15 14:41:29 -050021 file://init \
22 file://dropbearkey.service \
23 file://dropbear@.service \
24 file://dropbear.socket \
25 ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)} "
26
27PAM_SRC_URI = "file://0005-dropbear-enable-pam.patch \
28 file://0006-dropbear-configuration-file.patch \
29 file://dropbear"
30
31PAM_PLUGINS = "libpam-runtime \
32 pam-plugin-deny \
33 pam-plugin-permit \
34 pam-plugin-unix \
35 "
36RDEPENDS_${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${PAM_PLUGINS}', '', d)}"
37
38inherit autotools update-rc.d systemd
39
40INITSCRIPT_NAME = "dropbear"
41INITSCRIPT_PARAMS = "defaults 10"
42
43SYSTEMD_SERVICE_${PN} = "dropbear.socket"
44
Patrick Williamsc124f4f2015-09-15 14:41:29 -050045SBINCOMMANDS = "dropbear dropbearkey dropbearconvert"
46BINCOMMANDS = "dbclient ssh scp"
47EXTRA_OEMAKE = 'MULTI=1 SCPPROGRESS=1 PROGRAMS="${SBINCOMMANDS} ${BINCOMMANDS}"'
Patrick Williamsc0f7c042017-02-23 20:41:17 -060048
49PACKAGECONFIG ?= ""
50PACKAGECONFIG[system-libtom] = "--disable-bundled-libtom,--enable-bundled-libtom,libtommath libtomcrypt"
51
Patrick Williamsc124f4f2015-09-15 14:41:29 -050052EXTRA_OECONF += "\
53 ${@bb.utils.contains('DISTRO_FEATURES', 'pam', '--enable-pam', '--disable-pam', d)}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050054
55do_install() {
56 install -d ${D}${sysconfdir} \
57 ${D}${sysconfdir}/init.d \
58 ${D}${sysconfdir}/default \
59 ${D}${sysconfdir}/dropbear \
60 ${D}${bindir} \
61 ${D}${sbindir} \
62 ${D}${localstatedir}
63
64 install -m 0755 dropbearmulti ${D}${sbindir}/
65 ln -s ${sbindir}/dropbearmulti ${D}${bindir}/dbclient
Brad Bishop6e60e8b2018-02-01 10:27:11 -050066
Patrick Williamsc124f4f2015-09-15 14:41:29 -050067 for i in ${SBINCOMMANDS}
68 do
69 ln -s ./dropbearmulti ${D}${sbindir}/$i
70 done
71 sed -e 's,/etc,${sysconfdir},g' \
72 -e 's,/usr/sbin,${sbindir},g' \
73 -e 's,/var,${localstatedir},g' \
74 -e 's,/usr/bin,${bindir},g' \
75 -e 's,/usr,${prefix},g' ${WORKDIR}/init > ${D}${sysconfdir}/init.d/dropbear
76 chmod 755 ${D}${sysconfdir}/init.d/dropbear
Brad Bishop6e60e8b2018-02-01 10:27:11 -050077 if [ "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" ]; then
Patrick Williamsc124f4f2015-09-15 14:41:29 -050078 install -d ${D}${sysconfdir}/pam.d
79 install -m 0644 ${WORKDIR}/dropbear ${D}${sysconfdir}/pam.d/
80 fi
81
82 # deal with systemd unit files
83 install -d ${D}${systemd_unitdir}/system
84 install -m 0644 ${WORKDIR}/dropbearkey.service ${D}${systemd_unitdir}/system
85 install -m 0644 ${WORKDIR}/dropbear@.service ${D}${systemd_unitdir}/system
86 install -m 0644 ${WORKDIR}/dropbear.socket ${D}${systemd_unitdir}/system
87 sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \
88 -e 's,@BINDIR@,${bindir},g' \
89 -e 's,@SBINDIR@,${sbindir},g' \
90 ${D}${systemd_unitdir}/system/dropbear.socket ${D}${systemd_unitdir}/system/*.service
91}
92
93inherit update-alternatives
94
95ALTERNATIVE_PRIORITY = "20"
96ALTERNATIVE_${PN} = "scp ssh"
97
98ALTERNATIVE_TARGET = "${sbindir}/dropbearmulti"
99
100pkg_postrm_append_${PN} () {
101 if [ -f "${sysconfdir}/dropbear/dropbear_rsa_host_key" ]; then
102 rm ${sysconfdir}/dropbear/dropbear_rsa_host_key
103 fi
104 if [ -f "${sysconfdir}/dropbear/dropbear_dss_host_key" ]; then
105 rm ${sysconfdir}/dropbear/dropbear_dss_host_key
106 fi
107}