blob: f0aa3ff93f5999018fed52858f2759e3779bdf60 [file] [log] [blame]
Andrew Geissler7e0e3c02022-02-25 20:34:39 +00001SUMMARY = "Random number generator daemon"
2DESCRIPTION = "Check and feed random data from hardware device to kernel"
Andrew Geissler7e0e3c02022-02-25 20:34:39 +00003HOMEPAGE = "https://github.com/nhorman/rng-tools"
4BUGTRACKER = "https://github.com/nhorman/rng-tools/issues"
5LICENSE = "GPL-2.0-only"
6LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
Patrick Williams705982a2024-01-12 09:51:57 -06007DEPENDS = "openssl libcap"
Andrew Geissler7e0e3c02022-02-25 20:34:39 +00008
9SRC_URI = "git://github.com/nhorman/rng-tools.git;branch=master;protocol=https \
10 file://init \
11 file://default \
Patrick Williamsdb4c27e2022-08-05 08:10:29 -050012 file://rng-tools.service \
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000013 "
Patrick Williams864cc432023-02-09 14:54:44 -060014SRCREV = "e061c313b95890eb5fa0ada0cd6eec619dafdfe2"
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000015
16S = "${WORKDIR}/git"
17
18inherit autotools update-rc.d systemd pkgconfig
19
20EXTRA_OECONF = "--without-rtlsdr"
21
22PACKAGECONFIG ??= "libjitterentropy"
23PACKAGECONFIG:libc-musl = "libargp libjitterentropy"
24
25PACKAGECONFIG[libargp] = "--with-libargp,--without-libargp,argp-standalone,"
26PACKAGECONFIG[libjitterentropy] = "--enable-jitterentropy,--disable-jitterentropy,libjitterentropy"
27PACKAGECONFIG[libp11] = "--with-pkcs11,--without-pkcs11,libp11 openssl"
Patrick Williams864cc432023-02-09 14:54:44 -060028PACKAGECONFIG[nistbeacon] = "--with-nistbeacon,--without-nistbeacon,curl libxml2"
29PACKAGECONFIG[qrypt] = "--with-qrypt,--without-qrypt,curl"
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000030
Andrew Geisslerfc113ea2023-03-31 09:59:46 -050031INITSCRIPT_PACKAGES = "${PN}-service"
32INITSCRIPT_NAME:${PN}-service = "rng-tools"
33INITSCRIPT_PARAMS:${PN}-service = "start 03 2 3 4 5 . stop 30 0 6 1 ."
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000034
Andrew Geisslerfc113ea2023-03-31 09:59:46 -050035SYSTEMD_PACKAGES = "${PN}-service"
36SYSTEMD_SERVICE:${PN}-service = "rng-tools.service"
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000037
Andrew Geissler9aee5002022-03-30 16:27:02 +000038CFLAGS += " -DJENT_CONF_ENABLE_INTERNAL_TIMER "
39
Andrew Geisslerfc113ea2023-03-31 09:59:46 -050040PACKAGES =+ "${PN}-service"
41
42FILES:${PN}-service += " \
43 ${sysconfdir}/init.d/rng-tools \
44 ${sysconfdir}/default/rng-tools \
45"
46
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000047# Refer autogen.sh in rng-tools
48do_configure:prepend() {
49 cp ${S}/README.md ${S}/README
50}
51
52do_install:append() {
53 install -Dm 0644 ${WORKDIR}/default ${D}${sysconfdir}/default/rng-tools
54 install -Dm 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/rng-tools
Patrick Williamsdb4c27e2022-08-05 08:10:29 -050055 install -Dm 0644 ${WORKDIR}/rng-tools.service \
56 ${D}${systemd_system_unitdir}/rng-tools.service
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000057 sed -i \
58 -e 's,@SYSCONFDIR@,${sysconfdir},g' \
59 -e 's,@SBINDIR@,${sbindir},g' \
60 ${D}${sysconfdir}/init.d/rng-tools \
Patrick Williamsdb4c27e2022-08-05 08:10:29 -050061 ${D}${systemd_system_unitdir}/rng-tools.service
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000062
63 if [ "${@bb.utils.contains('PACKAGECONFIG', 'nistbeacon', 'yes', 'no', d)}" = "yes" ]; then
64 sed -i \
65 -e '/^IPAddressDeny=any/d' \
66 -e '/^RestrictAddressFamilies=/ s/$/ AF_INET AF_INET6/' \
Patrick Williamsdb4c27e2022-08-05 08:10:29 -050067 ${D}${systemd_system_unitdir}/rng-tools.service
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000068 fi
69}