summaryrefslogtreecommitdiff
path: root/meta-openembedded/meta-networking/recipes-support/chrony/chrony_4.1.bb
diff options
context:
space:
mode:
Diffstat (limited to 'meta-openembedded/meta-networking/recipes-support/chrony/chrony_4.1.bb')
-rw-r--r--meta-openembedded/meta-networking/recipes-support/chrony/chrony_4.1.bb25
1 files changed, 17 insertions, 8 deletions
diff --git a/meta-openembedded/meta-networking/recipes-support/chrony/chrony_4.1.bb b/meta-openembedded/meta-networking/recipes-support/chrony/chrony_4.1.bb
index 0262a6e8d..117451db2 100644
--- a/meta-openembedded/meta-networking/recipes-support/chrony/chrony_4.1.bb
+++ b/meta-openembedded/meta-networking/recipes-support/chrony/chrony_4.1.bb
@@ -36,7 +36,7 @@ SRC_URI = "https://download.tuxfamily.org/chrony/chrony-${PV}.tar.gz \
file://arm_eabi.patch \
"
-SRC_URI_append_libc-musl = " \
+SRC_URI:append:libc-musl = " \
file://0001-Fix-compilation-with-musl.patch \
"
SRC_URI[sha256sum] = "ed76f2d3f9347ac6221a91ad4bd553dd0565ac188cd7490d0801d08f7171164c"
@@ -47,6 +47,11 @@ DEPENDS = "pps-tools"
# chrony does not use GNU Autotools.
inherit update-rc.d systemd
+# Add chronyd user if privdrop packageconfig is selected
+inherit ${@bb.utils.contains('PACKAGECONFIG', 'privdrop', 'useradd', '', d)}
+USERADD_PACKAGES = "${@bb.utils.contains('PACKAGECONFIG', 'privdrop', '${PN}', '', d)}"
+USERADD_PARAM:${PN} += "${@bb.utils.contains('PACKAGECONFIG', 'privdrop', '--system -d / -M --shell /bin/nologin chronyd;', '', d)}"
+
# Configuration options:
# - For command line editing support in chronyc, you may specify either
# 'editline' or 'readline' but not both. editline is smaller, but
@@ -68,7 +73,7 @@ PACKAGECONFIG ??= "editline \
PACKAGECONFIG[readline] = "--without-editline,--without-readline,readline"
PACKAGECONFIG[editline] = ",--without-editline,libedit"
PACKAGECONFIG[sechash] = "--without-tomcrypt,--disable-sechash,nss"
-PACKAGECONFIG[privdrop] = ",--disable-privdrop,libcap"
+PACKAGECONFIG[privdrop] = "--with-libcap,--disable-privdrop --without-libcap,libcap"
PACKAGECONFIG[scfilter] = "--enable-scfilter,--without-seccomp,libseccomp"
PACKAGECONFIG[ipv6] = ",--disable-ipv6,"
PACKAGECONFIG[nss] = "--with-nss,--without-nss,nss"
@@ -97,6 +102,10 @@ do_install() {
# Config file
install -d ${D}${sysconfdir}
install -m 644 ${WORKDIR}/chrony.conf ${D}${sysconfdir}
+ if ${@bb.utils.contains('PACKAGECONFIG', 'privdrop', 'true', 'false', d)}; then
+ echo "# Define user to drop to after dropping root privileges" >> ${D}${sysconfdir}/chrony.conf
+ echo "user chronyd" >> ${D}${sysconfdir}/chrony.conf
+ fi
# System V init script
install -d ${D}${sysconfdir}/init.d
@@ -119,20 +128,20 @@ do_install() {
sed -i 's!^EnvironmentFile=.*!EnvironmentFile=-${sysconfdir}/default/chronyd!' ${D}${systemd_unitdir}/system/chronyd.service
}
-FILES_${PN} = "${sbindir}/chronyd ${sysconfdir} ${localstatedir}/lib/chrony ${localstatedir}"
-CONFFILES_${PN} = "${sysconfdir}/chrony.conf"
+FILES:${PN} = "${sbindir}/chronyd ${sysconfdir} ${localstatedir}/lib/chrony ${localstatedir}"
+CONFFILES:${PN} = "${sysconfdir}/chrony.conf"
INITSCRIPT_NAME = "chronyd"
INITSCRIPT_PARAMS = "defaults"
SYSTEMD_PACKAGES = "${PN}"
-SYSTEMD_SERVICE_${PN} = "chronyd.service"
+SYSTEMD_SERVICE:${PN} = "chronyd.service"
# It's probably a bad idea to run chrony and another time daemon on
# the same system. systemd includes the SNTP client 'timesyncd', which
# will be disabled by chronyd.service, however it will remain on the rootfs
-# wasting 150 kB unless you put 'PACKAGECONFIG_remove_pn-systemd = "timesyncd"'
+# wasting 150 kB unless you put 'PACKAGECONFIG:remove:pn-systemd = "timesyncd"'
# in a conf file or bbappend somewhere.
-RCONFLICTS_${PN} = "ntp ntimed"
+RCONFLICTS:${PN} = "ntp ntimed"
# Separate the client program into its own package
PACKAGES =+ "chronyc"
-FILES_chronyc = "${bindir}/chronyc"
+FILES:chronyc = "${bindir}/chronyc"