Subject: [alpine-aports] [PATCH] testing/rng-tools: fixed init.d script

From: Dennis Przytarski <[email-masked]>
Date: Sun, 9 Aug 2015 22:01:29 +0000

old init.d script failed to start the rngd instance
---
 testing/rng-tools/APKBUILD   | 8 ++++----
 testing/rng-tools/rngd.initd | 6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/testing/rng-tools/APKBUILD b/testing/rng-tools/APKBUILD
index bfa2543..4f75191 100644
--- a/testing/rng-tools/APKBUILD
+++ b/testing/rng-tools/APKBUILD
@@ -2,7 +2,7 @@
 # Maintainer:
 pkgname=rng-tools
 pkgver=5
-pkgrel=1
+pkgrel=2
 pkgdesc="a random number generator daemon"
 url="http://sourceforge.net/projects/gkernel/"
 arch="all"
@@ -51,12 +51,12 @@ package() {
 md5sums="6726cdc6fae1f5122463f24ae980dd68  rng-tools-5.tar.gz
 327ecc26d50a4a93f8cdec4a24fa837c  fix-textrels-on-PIC-x86.patch
 6f883db10f299d0640e0b3c5fa6e6175  rngd.confd
-afe366ae9d230898abf7984e4fd6686a  rngd.initd"
+9e5077d1710cfe08ff798a55896caa34  rngd.initd"
 sha256sums="60a102b6603bbcce2da341470cad42eeaa9564a16b4490e7867026ca11a3078e  rng-tools-5.tar.gz
 15072f76a7198859a08de56fc6c438a1c393a31e4a119200a7c8c63c5b15f0b6  fix-textrels-on-PIC-x86.patch
 5cd5751f8b849b3df9c8d5203e137123ef4603eb882f02603c83a61c5365f237  rngd.confd
-3bf0a290067f4e02aa1b655ecd609ab21ff4bea28aab77659c4926a26029ec28  rngd.initd"
+0bdbdf8ac77df3ccdecce3411ebc21fa58ef4a2f965431b0da5f7b8951b74138  rngd.initd"
 sha512sums="58047c37cad4f5f1210b696e4dba122878f78e57d05d9cb822f79234240ecce31efd2d39061fea1eb5b2e81d48d8c3bf6b92d06451f1ce5d5db7117704e89c50  rng-tools-5.tar.gz
 5c8196c3e70c093215fc0720cd3f58f339f74293a7eb35d95b914591d783472119dcc34fb27ab6a4c3ce5359e050b4987d1e7ddf213a7445fc0b70d9fae5eae5  fix-textrels-on-PIC-x86.patch
 2823cdb88cd45652d7d5097cdb239b404d7754930995f957dc2653c03762952cefc7c804f3dabfe8a4836bd098a4265cff67cff351b22cccf94d70efad293e2b  rngd.confd
-833612de0fb3f3f4a43a1d570660bd95a544983f1fe6e4a7b34e2a039729512dd76077e1a2469552830b98a869e47f4c8685fc55219beaca267993d8f0bdd2b9  rngd.initd"
+fe98f06a0729f413a18369719747a506216b54f6453b78a4744ef76bcd4c0416ff34bdca8e0fa8e6ea6f76ca1638067219cdd08ec3db8b54d6fc8d0a710066c3  rngd.initd"
diff --git a/testing/rng-tools/rngd.initd b/testing/rng-tools/rngd.initd
index 5ec0423..668d335 100644
--- a/testing/rng-tools/rngd.initd
+++ b/testing/rng-tools/rngd.initd
@@ -11,15 +11,15 @@ depend() {
 
 start() {
 	ebegin "Starting ${name}"
-	start-stop-daemon --start \
-		--pidfile $pidfile --exec $command -- $command_args
+	start-stop-daemon --start --background --make-pidfile --pidfile $pidfile --wait 5 \
+		--exec $command -- -f --pid-file=$pidfile $command_args
         eend $?
 }
 
 stop() {
 	ebegin "Stopping ${name}"
 	if [ -f $pidfile ]; then
-		start-stop-daemon --stop --pidfile $pidfile
+		start-stop-daemon --stop --pidfile $pidfile --retry 5
 	fi
 	ewend $?
 }
-- 
2.4.1

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---

---

From: Sören Tempel <[email-masked]>
Date: Mon, 10 Aug 2015 16:16:34 +0200

> +		start-stop-daemon --stop --pidfile $pidfile --retry 5

Why did you increase the retry timeout?

Sören.

---

---

From: Dennis Przytarski <[email-masked]>
Date: Mon, 10 Aug 2015 21:51:52 +0000

old init.d script failed to start the rngd instance
simplified scripts
---
 testing/rng-tools/APKBUILD   | 14 +++++++-------
 testing/rng-tools/rngd.confd |  5 +----
 testing/rng-tools/rngd.initd | 30 +++++++++---------------------
 3 files changed, 17 insertions(+), 32 deletions(-)

diff --git a/testing/rng-tools/APKBUILD b/testing/rng-tools/APKBUILD
index bfa2543..37ca559 100644
--- a/testing/rng-tools/APKBUILD
+++ b/testing/rng-tools/APKBUILD
@@ -2,7 +2,7 @@
 # Maintainer:
 pkgname=rng-tools
 pkgver=5
-pkgrel=1
+pkgrel=2
 pkgdesc="a random number generator daemon"
 url="http://sourceforge.net/projects/gkernel/"
 arch="all"
@@ -50,13 +50,13 @@ package() {
 
 md5sums="6726cdc6fae1f5122463f24ae980dd68  rng-tools-5.tar.gz
 327ecc26d50a4a93f8cdec4a24fa837c  fix-textrels-on-PIC-x86.patch
-6f883db10f299d0640e0b3c5fa6e6175  rngd.confd
-afe366ae9d230898abf7984e4fd6686a  rngd.initd"
+2652d9515601d09291f66f8c352d3034  rngd.confd
+e0dbde536f506707cb11594fc947607d  rngd.initd"
 sha256sums="60a102b6603bbcce2da341470cad42eeaa9564a16b4490e7867026ca11a3078e  rng-tools-5.tar.gz
 15072f76a7198859a08de56fc6c438a1c393a31e4a119200a7c8c63c5b15f0b6  fix-textrels-on-PIC-x86.patch
-5cd5751f8b849b3df9c8d5203e137123ef4603eb882f02603c83a61c5365f237  rngd.confd
-3bf0a290067f4e02aa1b655ecd609ab21ff4bea28aab77659c4926a26029ec28  rngd.initd"
+bcd519614980323554c1db08aea876dff4f0f1cee10e86d4826443aaa81b489d  rngd.confd
+7ccc1b605a7a861bed8b032010aaad4d745b2e8a8d1800840e1f7063f128599c  rngd.initd"
 sha512sums="58047c37cad4f5f1210b696e4dba122878f78e57d05d9cb822f79234240ecce31efd2d39061fea1eb5b2e81d48d8c3bf6b92d06451f1ce5d5db7117704e89c50  rng-tools-5.tar.gz
 5c8196c3e70c093215fc0720cd3f58f339f74293a7eb35d95b914591d783472119dcc34fb27ab6a4c3ce5359e050b4987d1e7ddf213a7445fc0b70d9fae5eae5  fix-textrels-on-PIC-x86.patch
-2823cdb88cd45652d7d5097cdb239b404d7754930995f957dc2653c03762952cefc7c804f3dabfe8a4836bd098a4265cff67cff351b22cccf94d70efad293e2b  rngd.confd
-833612de0fb3f3f4a43a1d570660bd95a544983f1fe6e4a7b34e2a039729512dd76077e1a2469552830b98a869e47f4c8685fc55219beaca267993d8f0bdd2b9  rngd.initd"
+ce82f583ab06580f038f17d4ecc84655cfc001abf344f9a50d12b8c1a5a6c4b74c386fbbc8b130201e4c34a7d99da75a4e64bcc41b2aebd381e74a352b5531c4  rngd.confd
+46abb31d575854a51fc5ee1d31eb436e153cf969435d5b835d6fb44f4bdce549378ca9abcd81142abeb650312bd62133552eed2bec4eb9035f9456f739f1a3b7  rngd.initd"
diff --git a/testing/rng-tools/rngd.confd b/testing/rng-tools/rngd.confd
index 8650720..c065e7e 100644
--- a/testing/rng-tools/rngd.confd
+++ b/testing/rng-tools/rngd.confd
@@ -1,4 +1 @@
-command=/usr/sbin/rngd
-command_args="--no-drng=1 --no-tpm=1"
-pidfile=/var/run/rngd.pid
-
+RNGD_OPTS="--no-drng=1 --no-tpm=1"
diff --git a/testing/rng-tools/rngd.initd b/testing/rng-tools/rngd.initd
index 5ec0423..b91412d 100644
--- a/testing/rng-tools/rngd.initd
+++ b/testing/rng-tools/rngd.initd
@@ -1,26 +1,14 @@
 #!/sbin/openrc-run
 
-name=rngd
-daemon=/usr/sbin/$name
+name="rngd"
+command="/usr/sbin/${name}"
+command_args="-f ${RNGD_OPTS}"
+command_background="yes"
+start_stop_daemon_args="--wait 5"
+pidfile="/var/run/${name}.pid"
 
 depend() {
-	need localmount
-	after urandom
-	provide entropy
+        need localmount
+        after urandom
+        provide entropy
 }
-
-start() {
-	ebegin "Starting ${name}"
-	start-stop-daemon --start \
-		--pidfile $pidfile --exec $command -- $command_args
-        eend $?
-}
-
-stop() {
-	ebegin "Stopping ${name}"
-	if [ -f $pidfile ]; then
-		start-stop-daemon --stop --pidfile $pidfile
-	fi
-	ewend $?
-}
-
-- 
2.4.1

---