summaryrefslogtreecommitdiff
path: root/extra/haveged
diff options
context:
space:
mode:
authorNicolás Reynolds <fauno@endefensadelsl.org>2013-12-27 23:55:53 +0000
committerNicolás Reynolds <fauno@endefensadelsl.org>2013-12-27 23:55:53 +0000
commit65eeff79fff8a1bfdf67ca51d147384f46f4d5c0 (patch)
treefbfdff322b28d9a3c37e6e31c94caf1d8e48dac1 /extra/haveged
parentd53c44f055929b18d7d1b25f8367ee5836c435fc (diff)
Fri Dec 27 23:54:04 UTC 2013
Diffstat (limited to 'extra/haveged')
-rw-r--r--extra/haveged/PKGBUILD39
-rw-r--r--extra/haveged/cleanexit.patch21
-rw-r--r--extra/haveged/service11
3 files changed, 71 insertions, 0 deletions
diff --git a/extra/haveged/PKGBUILD b/extra/haveged/PKGBUILD
new file mode 100644
index 000000000..a404e9c06
--- /dev/null
+++ b/extra/haveged/PKGBUILD
@@ -0,0 +1,39 @@
+# $Id: PKGBUILD 199016 2013-11-06 11:28:54Z bpiotrowski $
+# Maintainer: Bartłomiej Piotrowski <barthalion@gmail.com>
+# Contributor: kfgz <kfgz at interia dot pl>
+# Contributor: pootzko <pootzko at gmail dot com>
+
+pkgname=haveged
+pkgver=1.7.c
+_pkgver=${pkgver/.c/c}
+pkgrel=3
+pkgdesc='Entropy harvesting daemon using CPU timings'
+arch=('i686' 'x86_64')
+url='http://www.issihosts.com/haveged'
+license=('GPL')
+depends=('glibc')
+source=($url/$pkgname-$_pkgver.tar.gz
+ service cleanexit.patch)
+sha256sums=('40397eded96fc0d624a6a81c8e888ab023e46f3114f1ee699994e645531bf121'
+ 'badf8ceb5484d45888a089fabdfba5f44f6ec2930bca203c50200051a4d83e12'
+ 'be896659dd96cb85915ac5a9c2bd8d81d1ff348508362d1b71d64b207f69fa5c')
+
+prepare() {
+ cd $pkgname-$_pkgver
+ patch -Np1 -i ../cleanexit.patch
+}
+
+build() {
+ cd $pkgname-$_pkgver
+ ./configure --prefix=/usr --bindir=/usr/bin --sbindir=/usr/bin
+ make
+}
+
+package() {
+ cd $pkgname-$_pkgver
+ make DESTDIR="$pkgdir" install
+
+ rm -rf "$pkgdir"/etc/init.d
+ install -D -m644 "$srcdir"/service \
+ "$pkgdir"/usr/lib/systemd/system/haveged.service
+}
diff --git a/extra/haveged/cleanexit.patch b/extra/haveged/cleanexit.patch
new file mode 100644
index 000000000..01f8c7f94
--- /dev/null
+++ b/extra/haveged/cleanexit.patch
@@ -0,0 +1,21 @@
+diff -u -r haveged-1.7c/src/haveged.c haveged-1.7c-cleanexit/src/haveged.c
+--- haveged-1.7c/src/haveged.c 2013-01-12 19:20:04.000000000 +0100
++++ haveged-1.7c-cleanexit/src/haveged.c 2013-11-05 22:40:22.202935493 +0100
+@@ -642,7 +642,16 @@
+ static void tidy_exit( /* OUT: nothing */
+ int signum) /* IN: signal number */
+ {
+- error_exit("Stopping due to signal %d\n", signum);
++#ifndef NO_DAEMON
++ if (params->detached!=0) {
++ unlink(params->pid_file);
++ syslog(LOG_INFO, "%s Stopping due to signal %d", params->daemon, signum);
++ }
++ else
++#endif
++ fprintf(stderr, "%s Stopping due to signal %d\n", params->daemon, signum);
++ havege_destroy(handle);
++ exit(0);
+ }
+ /**
+ * send usage display to stderr
diff --git a/extra/haveged/service b/extra/haveged/service
new file mode 100644
index 000000000..676fb1893
--- /dev/null
+++ b/extra/haveged/service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Entropy Harvesting Daemon
+Documentation=man:haveged(8)
+
+[Service]
+Type=forking
+ExecStart=/usr/bin/haveged -w 1024 -v 1
+PIDFile=/var/run/haveged.pid
+
+[Install]
+WantedBy=multi-user.target