From 19a868eb135823597dd9c76b9a7a34452e9dc44d Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Fri, 5 Jan 2024 17:26:33 +0100 Subject: [PATCH] fixed systemd file [release 6.10-3mamba;Sat Dec 26 2020] --- rng-tools-6.10-pkcs11-path.patch | 51 ++++++++++++++++++++++++++++++++ rng-tools.spec | 31 +++++++++++++++++-- rngd.service | 9 ++++++ 3 files changed, 89 insertions(+), 2 deletions(-) create mode 100644 rng-tools-6.10-pkcs11-path.patch create mode 100644 rngd.service diff --git a/rng-tools-6.10-pkcs11-path.patch b/rng-tools-6.10-pkcs11-path.patch new file mode 100644 index 0000000..fb2feb7 --- /dev/null +++ b/rng-tools-6.10-pkcs11-path.patch @@ -0,0 +1,51 @@ +diff --git a/.travis.yml b/.travis.yml +index be3bf06..b6acd39 100644 +--- a/.travis.yml ++++ b/.travis.yml +@@ -1,6 +1,10 @@ + language: c + dist: trusty + ++arch: ++ - amd64 ++ - arm64 ++ + compiler: + - clang + - gcc +diff --git a/Makefile.am b/Makefile.am +index db4fcfc..5917023 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -31,9 +31,10 @@ rngd_LDADD = librngd.a -lsysfs $(LIBS) ${libp11_LIBS} ${libcrypto_LIBS} ${libcur + + if PKCS11 + rngd_SOURCES += rngd_pkcs11.c ++pkcs11_ENGINE = -DDEFAULT_PKCS11_ENGINE=\"$(PKCS11_ENGINE)\" + endif + +-rngd_CFLAGS = ${pkcs11_CFLAGS} ${libp11_CFLAGS} ${libcrypto_CFLAGS} ${libxml2_CFLAGS} ${openssl_CFLAGS} $(PTHREAD_CFLAGS) ++rngd_CFLAGS = ${pkcs11_CFLAGS} ${pkcs11_ENGINE} ${libp11_CFLAGS} ${libcrypto_CFLAGS} ${libxml2_CFLAGS} ${openssl_CFLAGS} $(PTHREAD_CFLAGS) + rngd_LDFLAGS = $(PTHREAD_CFLAGS) + + rngtest_SOURCES = exits.h stats.h stats.c rngtest.c +diff --git a/configure.ac b/configure.ac +index f252d03..616d8fa 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -111,6 +111,15 @@ AS_IF( + PKG_CHECK_MODULES([libp11], [libp11], [], [AC_MSG_ERROR([libp11 is required])]) + PKG_CHECK_MODULES([libcrypto], [libcrypto], [], [AC_MSG_ERROR([libcrypto is required])]) + AC_DEFINE([HAVE_PKCS11],1,[Enable PKCS11]) ++ AS_CASE([$host_cpu], ++ [i?86|armv7hl], ++ [ ++ PKCS11_ENGINE=/usr/lib/opensc-pkcs11.so ++ ], ++ [ ++ PKCS11_ENGINE=/usr/lib64/opensc-pkcs11.so ++ ]) ++ AC_SUBST([PKCS11_ENGINE]) + ] + ) + diff --git a/rng-tools.spec b/rng-tools.spec index 114a8f2..df7f491 100644 --- a/rng-tools.spec +++ b/rng-tools.spec @@ -1,14 +1,15 @@ Name: rng-tools Version: 6.10 -Release: 1mamba +Release: 3mamba Summary: A random number generator daemon Group: System/Kernel and Hardware Vendor: openmamba Distribution: openmamba Packager: Silvan Calarco URL: https://github.com/nhorman/rng-tools.git -## GITSOURCE https://github.com/nhorman/rng-tools.git v6.10 Source: https://github.com/nhorman/rng-tools.git/v%{version}/rng-tools-%{version}.tar.bz2 +Patch0: rng-tools-6.10-pkcs11-path.patch +Source1: rngd.service License: GPL ## AUTOBUILDREQ-BEGIN BuildRequires: glibc-devel @@ -22,6 +23,7 @@ BuildRequires: libsysfs-devel BuildRequires: libusb-devel BuildRequires: libxml2-devel ## AUTOBUILDREQ-END +Requires: libopensc BuildRoot: %{_tmppath}/%{name}-%{version}-root %description @@ -32,6 +34,10 @@ It monitors a set of entropy sources, and supplies entropy from them to the syst %prep %setup -q +#%ifarch x86_64 aarch64 +#% patch0 -p1 +#%endif + ./autogen.sh %build @@ -42,17 +48,38 @@ It monitors a set of entropy sources, and supplies entropy from them to the syst [ "%{buildroot}" != / ] && rm -rf "%{buildroot}" %makeinstall +install -D -m0644 %{SOURCE1} %{buildroot}%{_unitdir}/rngd.service + %clean [ "%{buildroot}" != / ] && rm -rf "%{buildroot}" +%post +%systemd_post rngd +: + +%preun +%systemd_preun rngd +: + +%postun +%systemd_postun rngd +: + %files %defattr(-,root,root) %{_bindir}/rngtest %{_sbindir}/rngd +%{_unitdir}/rngd.service %{_mandir}/man1/rngtest.1* %{_mandir}/man8/rngd.8* %doc AUTHORS COPYING %changelog +* Sat Dec 26 2020 Silvan Calarco 6.10-3mamba +- fixed systemd file + +* Tue Apr 07 2020 Silvan Calarco 6.10-2mamba +- add systemd service file; require libopensc + * Sun Mar 29 2020 Silvan Calarco 6.10-1mamba - package created using the webbuild interface diff --git a/rngd.service b/rngd.service new file mode 100644 index 0000000..1cc09da --- /dev/null +++ b/rngd.service @@ -0,0 +1,9 @@ +[Unit] +Description=Hardware RNG Entropy Gatherer Daemon +ConditionVirtualization=!container + +[Service] +ExecStart=/usr/sbin/rngd -f + +[Install] +WantedBy=multi-user.target