From 30ae37b756d207b8016cd8f1ef768fbe41080b6a Mon Sep 17 00:00:00 2001 From: Aníbal Limón Date: Tue, 26 Jul 2022 14:33:22 -0500 Subject: rng-tools: Change systemd service name to work with sysvinit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change systemd service name from rngd -> rng-tools to avoid load twice the service when sysvinit compatibility is enabled, ... root@:~# ps | grep rng 23 root 0 SW [hwrng] 13109 root 3528 R /usr/sbin/rngd -f -r /dev/hwrng 13117 root 2348 S grep rng 29418 root 12756 S /usr/sbin/rngd -r /dev/hwrng ... (From OE-Core rev: 945dfe2e4ba8581a19ebdc833100e87ed96c5d08) Signed-off-by: Aníbal Limón Signed-off-by: Luca Ceresoli Signed-off-by: Richard Purdie --- .../rng-tools/rng-tools/rng-tools.service | 33 ++++++++++++++++++++++ .../rng-tools/rng-tools/rngd.service | 33 ---------------------- meta/recipes-support/rng-tools/rng-tools_6.15.bb | 12 ++++---- 3 files changed, 39 insertions(+), 39 deletions(-) create mode 100644 meta/recipes-support/rng-tools/rng-tools/rng-tools.service delete mode 100644 meta/recipes-support/rng-tools/rng-tools/rngd.service diff --git a/meta/recipes-support/rng-tools/rng-tools/rng-tools.service b/meta/recipes-support/rng-tools/rng-tools/rng-tools.service new file mode 100644 index 0000000000..568686e80e --- /dev/null +++ b/meta/recipes-support/rng-tools/rng-tools/rng-tools.service @@ -0,0 +1,33 @@ +[Unit] +Description=Hardware RNG Entropy Gatherer Daemon +DefaultDependencies=no +After=systemd-udev-settle.service +Before=sysinit.target shutdown.target +Wants=systemd-udev-settle.service +Conflicts=shutdown.target + +[Service] +EnvironmentFile=-@SYSCONFDIR@/default/rng-tools +ExecStart=@SBINDIR@/rngd -f $EXTRA_ARGS +CapabilityBoundingSet=CAP_SYS_ADMIN +IPAddressDeny=any +LockPersonality=yes +MemoryDenyWriteExecute=yes +NoNewPrivileges=yes +PrivateTmp=yes +ProtectControlGroups=yes +ProtectHome=yes +ProtectHostname=yes +ProtectKernelModules=yes +ProtectKernelLogs=yes +ProtectSystem=strict +RestrictAddressFamilies=AF_UNIX +RestrictNamespaces=yes +RestrictRealtime=yes +RestrictSUIDSGID=yes +SystemCallArchitectures=native +SystemCallErrorNumber=EPERM +SystemCallFilter=@system-service + +[Install] +WantedBy=sysinit.target diff --git a/meta/recipes-support/rng-tools/rng-tools/rngd.service b/meta/recipes-support/rng-tools/rng-tools/rngd.service deleted file mode 100644 index 568686e80e..0000000000 --- a/meta/recipes-support/rng-tools/rng-tools/rngd.service +++ /dev/null @@ -1,33 +0,0 @@ -[Unit] -Description=Hardware RNG Entropy Gatherer Daemon -DefaultDependencies=no -After=systemd-udev-settle.service -Before=sysinit.target shutdown.target -Wants=systemd-udev-settle.service -Conflicts=shutdown.target - -[Service] -EnvironmentFile=-@SYSCONFDIR@/default/rng-tools -ExecStart=@SBINDIR@/rngd -f $EXTRA_ARGS -CapabilityBoundingSet=CAP_SYS_ADMIN -IPAddressDeny=any -LockPersonality=yes -MemoryDenyWriteExecute=yes -NoNewPrivileges=yes -PrivateTmp=yes -ProtectControlGroups=yes -ProtectHome=yes -ProtectHostname=yes -ProtectKernelModules=yes -ProtectKernelLogs=yes -ProtectSystem=strict -RestrictAddressFamilies=AF_UNIX -RestrictNamespaces=yes -RestrictRealtime=yes -RestrictSUIDSGID=yes -SystemCallArchitectures=native -SystemCallErrorNumber=EPERM -SystemCallFilter=@system-service - -[Install] -WantedBy=sysinit.target diff --git a/meta/recipes-support/rng-tools/rng-tools_6.15.bb b/meta/recipes-support/rng-tools/rng-tools_6.15.bb index 0696351903..efc08b5e0a 100644 --- a/meta/recipes-support/rng-tools/rng-tools_6.15.bb +++ b/meta/recipes-support/rng-tools/rng-tools_6.15.bb @@ -11,7 +11,7 @@ DEPENDS = "sysfsutils openssl" SRC_URI = "git://github.com/nhorman/rng-tools.git;branch=master;protocol=https \ file://init \ file://default \ - file://rngd.service \ + file://rng-tools.service \ " SRCREV = "381f69828b782afda574f259c1b7549f48f9bb77" @@ -32,7 +32,7 @@ PACKAGECONFIG[nistbeacon] = "--with-nistbeacon,--without-nistbeacon,curl libxml2 INITSCRIPT_NAME = "rng-tools" INITSCRIPT_PARAMS = "start 03 2 3 4 5 . stop 30 0 6 1 ." -SYSTEMD_SERVICE:${PN} = "rngd.service" +SYSTEMD_SERVICE:${PN} = "rng-tools.service" CFLAGS += " -DJENT_CONF_ENABLE_INTERNAL_TIMER " @@ -44,18 +44,18 @@ do_configure:prepend() { do_install:append() { install -Dm 0644 ${WORKDIR}/default ${D}${sysconfdir}/default/rng-tools install -Dm 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/rng-tools - install -Dm 0644 ${WORKDIR}/rngd.service \ - ${D}${systemd_system_unitdir}/rngd.service + install -Dm 0644 ${WORKDIR}/rng-tools.service \ + ${D}${systemd_system_unitdir}/rng-tools.service sed -i \ -e 's,@SYSCONFDIR@,${sysconfdir},g' \ -e 's,@SBINDIR@,${sbindir},g' \ ${D}${sysconfdir}/init.d/rng-tools \ - ${D}${systemd_system_unitdir}/rngd.service + ${D}${systemd_system_unitdir}/rng-tools.service if [ "${@bb.utils.contains('PACKAGECONFIG', 'nistbeacon', 'yes', 'no', d)}" = "yes" ]; then sed -i \ -e '/^IPAddressDeny=any/d' \ -e '/^RestrictAddressFamilies=/ s/$/ AF_INET AF_INET6/' \ - ${D}${systemd_system_unitdir}/rngd.service + ${D}${systemd_system_unitdir}/rng-tools.service fi } -- cgit v1.2.3-54-g00ecf