net-nntp/nzbget: improve init script to use a pid file, add depend
authorLouis Sautier <sautier.louis@gmail.com>
Wed, 4 Oct 2017 10:11:42 +0000 (12:11 +0200)
committerSven Wegener <swegener@gentoo.org>
Thu, 5 Oct 2017 21:35:44 +0000 (21:35 +0000)
It seems that the older behaviour did not work with recent openrc
versions. The process could not be found when running the stop command.
We don't need to override LockFile in the configuration file any more
since we set it when we start the daemon.

Package-Manager: Portage-2.3.8, Repoman-2.3.3
[swegener: separate init script revision]

net-nntp/nzbget/files/nzbget.initd-r1 [new file with mode: 0644]
net-nntp/nzbget/nzbget-20.0_pre2108-r1.ebuild [moved from net-nntp/nzbget/nzbget-20.0_pre2108.ebuild with 96% similarity]

diff --git a/net-nntp/nzbget/files/nzbget.initd-r1 b/net-nntp/nzbget/files/nzbget.initd-r1
new file mode 100644 (file)
index 0000000..2a9fae6
--- /dev/null
@@ -0,0 +1,28 @@
+#!/sbin/openrc-run
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+extra_started_commands="reload"
+
+description="A command-line based binary newsgrabber supporting .nzb files"
+pidfile=/run/nzbget/nzbget.pid
+command=/usr/bin/nzbget
+command_args="--configfile \"${NZBGET_CONFIGFILE}\" \
+  --daemon --option LockFile=${pidfile} \
+  ${NZBGET_OPTS}"
+start_stop_daemon_args="--user \"${NZBGET_USER}\" \
+  --group \"${NZBGET_GROUP}\""
+
+depend() {
+  need localmount net
+}
+
+start_pre() {
+  checkpath -d -m 0755 -o "${NZBGET_USER}":"${NZBGET_GROUP}" /run/nzbget
+}
+
+reload() {
+  ebegin "Reloading ${RC_SVCNAME}"
+  ${command} --configfile "${NZBGET_CONFIGFILE}" --reload >/dev/null
+  eend $?
+}
similarity index 96%
rename from net-nntp/nzbget/nzbget-20.0_pre2108.ebuild
rename to net-nntp/nzbget/nzbget-20.0_pre2108-r1.ebuild
index c6d86f04383d6f9fc27a48f03be3113c07ed585c..3e119a13d9e8bf89576d18a3963741073bec27d2 100644 (file)
@@ -58,7 +58,6 @@ src_prepare() {
 
        sed \
                -e 's:^MainDir=.*:MainDir=/var/lib/nzbget:' \
-               -e 's:^LockFile=.*:LockFile=/run/nzbget/nzbget.pid:' \
                -e 's:^LogFile=.*:LogFile=/var/log/nzbget/nzbget.log:' \
                -e 's:^WebDir=.*:WebDir=/usr/share/nzbget/webui:' \
                -e 's:^ConfigTemplate=.*:ConfigTemplate=/usr/share/nzbget/nzbget.conf:' \
@@ -91,7 +90,7 @@ src_install() {
        keepdir /var/lib/nzbget/{dst,nzb,queue,tmp}
        keepdir /var/log/nzbget
 
-       newinitd "${FILESDIR}"/nzbget.initd nzbget
+       newinitd "${FILESDIR}"/nzbget.initd-r1 nzbget
        newconfd "${FILESDIR}"/nzbget.confd nzbget
 }