summaryrefslogtreecommitdiff
path: root/community/rng-tools
diff options
context:
space:
mode:
Diffstat (limited to 'community/rng-tools')
-rw-r--r--community/rng-tools/PKGBUILD34
-rwxr-xr-xcommunity/rng-tools/rngd41
-rw-r--r--community/rng-tools/rngd.conf1
-rw-r--r--community/rng-tools/rngd.service9
4 files changed, 85 insertions, 0 deletions
diff --git a/community/rng-tools/PKGBUILD b/community/rng-tools/PKGBUILD
new file mode 100644
index 000000000..8e886488a
--- /dev/null
+++ b/community/rng-tools/PKGBUILD
@@ -0,0 +1,34 @@
+# Maintainer: Massimiliano Torromeo <massimiliano.torromeo@gmail.com>
+# Contributor: Alasdair Haswell <ali at arhaswell dot co dot uk>
+
+pkgname=rng-tools
+pkgver=4
+pkgrel=1
+pkgdesc="Random number generator related utilities"
+arch=('i686' 'x86_64')
+url="http://sourceforge.net/projects/gkernel/"
+license=('GPL')
+backup=(etc/conf.d/rngd)
+source=(http://downloads.sourceforge.net/sourceforge/gkernel/$pkgname-$pkgver.tar.gz
+ rngd
+ rngd.conf
+ rngd.service)
+
+build() {
+ cd "$srcdir/$pkgname-$pkgver"
+ ./configure --prefix=/usr
+ make
+}
+
+package() {
+ cd "$srcdir/$pkgname-$pkgver"
+ make DESTDIR="$pkgdir" install
+ install -Dm0644 "$srcdir/rngd.service" "$pkgdir/usr/lib/systemd/system/rngd.service"
+ install -Dm0755 "$srcdir/rngd" "$pkgdir/etc/rc.d/rngd"
+ install -Dm0644 "$srcdir/rngd.conf" "$pkgdir/etc/conf.d/rngd"
+}
+
+sha256sums=('b71bdfd4222c05e8316001556be90e1606f2a1bac3efde60153bd84e873cc195'
+ '45084eff83306c74e707a72b44b5b20d8b94777377af414e1c43f738c7a720ed'
+ 'a4a19dbe5403b9dcb2bc6b3699dcaba7a47ff3e3ccf58aa3bdbfe14eb1d16003'
+ 'abf163089fc466e45955fd0da98a20a966b3b0b4c714c27b470d03fedfc04ca3')
diff --git a/community/rng-tools/rngd b/community/rng-tools/rngd
new file mode 100755
index 000000000..bd6b8d62f
--- /dev/null
+++ b/community/rng-tools/rngd
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+rnd_device=/dev/random
+rng_device=/dev/hw_random
+timeout=0
+
+[ -f /etc/conf.d/rngd ] && . /etc/conf.d/rngd
+PID=$(pidof -o %PPID /usr/sbin/rngd)
+case "$1" in
+ start)
+ stat_busy "Starting RNG"
+ [ -z "$PID" ] && /usr/sbin/rngd $RNGD_OPTS
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon rngd
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping RNG"
+ [ ! -z "$PID" ] && kill -s SIGALRM $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon rngd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 2
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0
diff --git a/community/rng-tools/rngd.conf b/community/rng-tools/rngd.conf
new file mode 100644
index 000000000..8ff9a639e
--- /dev/null
+++ b/community/rng-tools/rngd.conf
@@ -0,0 +1 @@
+RNGD_OPTS="-o /dev/random -r /dev/urandom"
diff --git a/community/rng-tools/rngd.service b/community/rng-tools/rngd.service
new file mode 100644
index 000000000..87185bc32
--- /dev/null
+++ b/community/rng-tools/rngd.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=Hardware RNG Entropy Gatherer Daemon
+
+[Service]
+EnvironmentFile=/etc/conf.d/rngd
+ExecStart=/usr/sbin/rngd -f $RNGD_OPTS
+
+[Install]
+WantedBy=multi-user.target