public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: net-nntp/sabnzbd/files/
@ 2016-10-28 12:57 Justin Bronder
  0 siblings, 0 replies; 6+ messages in thread
From: Justin Bronder @ 2016-10-28 12:57 UTC (permalink / raw
  To: gentoo-commits

commit:     975400d5765f7405f611ddf66a3ad717cb21a203
Author:     Michał Kępień <github <AT> kempniu <DOT> pl>
AuthorDate: Wed Oct  5 09:08:55 2016 +0000
Commit:     Justin Bronder <jsbronder <AT> gentoo <DOT> org>
CommitDate: Fri Oct 28 12:57:14 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=975400d5

net-nntp/sabnzbd: Rework init script

 net-nntp/sabnzbd/files/sabnzbd.initd | 130 ++++++++++++++---------------------
 1 file changed, 51 insertions(+), 79 deletions(-)

diff --git a/net-nntp/sabnzbd/files/sabnzbd.initd b/net-nntp/sabnzbd/files/sabnzbd.initd
old mode 100644
new mode 100755
index 9b6a941..ad11573
--- a/net-nntp/sabnzbd/files/sabnzbd.initd
+++ b/net-nntp/sabnzbd/files/sabnzbd.initd
@@ -1,99 +1,71 @@
 #!/sbin/openrc-run
-# Copyright 1999-2014 Gentoo Foundation
+# Copyright 1999-2016 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
-RUNDIR=/var/run/sabnzbd
+PIDFILE="/run/sabnzbd/sabnzbd.pid"
 
 depend() {
-    need net
+	need net
 }
 
 get_var() {
-    echo $(sed -n \
-        '/^\[misc]/,/^'$1'/ s/^'$1' = \([[:alnum:].]\+\)[\r|\n|\r\n]*$/\1/p' \
-        "${SABNZBD_CONFIGFILE}")
+	grep -P -o -m 1 "(?<=^${1} = ).*" "${SABNZBD_CONFIGFILE}" || echo 0
 }
 
-get_port() {
-    if [ "$(get_var 'enable_https')" -eq 1 ]; then
-        echo $(get_var 'https_port')
-    else
-        echo $(get_var 'port')
-    fi
+start() {
+	ebegin "Starting SABnzbd"
+
+	checkpath -q -d -o ${SABNZBD_USER}:${SABNZBD_GROUP} -m 0770 "$(dirname "${PIDFILE}")"
+
+	start-stop-daemon \
+		--quiet \
+		--start \
+		--user ${SABNZBD_USER} \
+		--group ${SABNZBD_GROUP} \
+		--pidfile "${PIDFILE}" \
+		--wait 1000 \
+		--exec /usr/bin/sabnzbd \
+		-- \
+		--config-file "${SABNZBD_CONFIGFILE}" \
+		--logging "${SABNZBD_LOGGING}" \
+		--daemon \
+		--pidfile "${PIDFILE}"
+
+	eend $?
 }
 
-get_addr() {
-    local host=$(get_var 'host')
-    local protocol='http'
+stop() {
+	local protocol="http"
+	local host="$(get_var "host")"
+	local port="$(get_var "port")"
 
-    [ "${host}" == "0.0.0.0" ] && host=localhost
-    [ "$(get_var 'enable_https')" -eq 1 ] && protocol='https'
+	if [ $(get_var "enable_https") -eq 1 ]; then
+		protocol="https"
+		port="$(get_var "https_port")"
+	fi
 
-    echo "${protocol}://${host}:$(get_port)"
-}
+	case "${host}" in
+		*:*) host="[${host}]" ;;
+	esac
 
-get_pidfile() {
-    echo "${RUNDIR}/sabnzbd-$(get_port).pid"
-}
+	local url="${protocol}://${host}:${port}/sabnzbd/api?mode=shutdown"
 
-start() {
-    ebegin "Starting SABnzbd"
-
-    checkpath -q -d -o ${SABNZBD_USER}:${SABNZBD_GROUP} -m 0770 "${RUNDIR}"
-
-    start-stop-daemon \
-        --quiet \
-        --start \
-        --user ${SABNZBD_USER} \
-        --group ${SABNZBD_GROUP} \
-        --name sabnzbd \
-        --background \
-        --pidfile "$(get_pidfile)" \
-        --exec /usr/bin/sabnzbd \
-        -- \
-        --config-file "${SABNZBD_CONFIGFILE}" \
-        --logging "${SABNZBD_LOGGING}" \
-        --daemon \
-        --pid "${RUNDIR}"
-
-    eend $?
-}
+	if [ $(get_var "disable_api_key") -eq 0 ]; then
+		url="${url}&apikey=$(get_var "api_key")"
+	fi
 
-start_pre() {
-    if [ "$RC_CMD" == "restart" ]; then
-        local pidfile=$(get_pidfile)
-        while [ -e ${pidfile} ]; do
-            sleep 1
-        done
-    fi
+	local signals="TERM/1/KILL/1"
 
-    return 0
-}
+	ebegin "Stopping SABnzbd"
 
-stop() {
-    local api_key=$(get_var 'api_key')
-    local addr=$(get_addr)
-    local rc=1
-
-    ebegin "Stopping SABnzbd @ ${addr}"
-    # This can only work if we have enabled the API
-    if [ -n "${api_key}" -a "$(get_var 'disable_api_key')" -ne 1 ]; then
-        local ret
-        einfo "Attempting web-based shutdown @ ${addr}"
-
-        # SABnzbd will return "ok" if shutdown is successful
-        ret=$(/usr/bin/curl -k -s "${addr}/sabnzbd/api?mode=shutdown&apikey=${api_key}")
-        [ "${ret}" == "ok" ] && rc=0
-    fi
-
-    if [ "${rc}" -ne 0 ]; then
-        einfo "Falling back to SIGTERM, this may not work if you restarted via the web interface"
-        start-stop-daemon \
-            --stop \
-            --pidfile $(get_pidfile) \
-            --retry SIGTERM/1/SIGKILL/5
-        rc=$?
-    fi
-
-    eend ${rc}
+	if [ "$(wget -q -t 1 -O - -T 10 "${url}")" = "ok" ]; then
+		signals="CONT/5/${signals}"
+	fi
+
+	start-stop-daemon \
+		--stop \
+		--pidfile "${PIDFILE}" \
+		--retry "${signals}"
+
+	eend $?
 }


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: net-nntp/sabnzbd/files/
@ 2016-11-19 16:34 Justin Bronder
  0 siblings, 0 replies; 6+ messages in thread
From: Justin Bronder @ 2016-11-19 16:34 UTC (permalink / raw
  To: gentoo-commits

commit:     56e2b810ae497894a3b0baf9087bca8dea82c366
Author:     Michał Kępień <github <AT> kempniu <DOT> pl>
AuthorDate: Fri Nov 18 13:38:47 2016 +0000
Commit:     Justin Bronder <jsbronder <AT> gentoo <DOT> org>
CommitDate: Sat Nov 19 16:33:12 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=56e2b810

Quote values in conf.d file

 net-nntp/sabnzbd/files/sabnzbd.confd | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/net-nntp/sabnzbd/files/sabnzbd.confd b/net-nntp/sabnzbd/files/sabnzbd.confd
index ec40168..c949355 100644
--- a/net-nntp/sabnzbd/files/sabnzbd.confd
+++ b/net-nntp/sabnzbd/files/sabnzbd.confd
@@ -1,6 +1,6 @@
-SABNZBD_CONFIGFILE=/etc/sabnzbd/sabnzbd.ini
-SABNZBD_USER=sabnzbd
-SABNZBD_GROUP=sabnzbd
+SABNZBD_CONFIGFILE="/etc/sabnzbd/sabnzbd.ini"
+SABNZBD_USER="sabnzbd"
+SABNZBD_GROUP="sabnzbd"
 
 # 0 - error/warnings, 1 - info, 2 - debug
-SABNZBD_LOGGING=1
+SABNZBD_LOGGING="1"


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: net-nntp/sabnzbd/files/
@ 2016-11-19 16:34 Justin Bronder
  0 siblings, 0 replies; 6+ messages in thread
From: Justin Bronder @ 2016-11-19 16:34 UTC (permalink / raw
  To: gentoo-commits

commit:     05db47762e5450957b34ad9c73d124063ff854ba
Author:     Michał Kępień <github <AT> kempniu <DOT> pl>
AuthorDate: Fri Nov 18 13:46:44 2016 +0000
Commit:     Justin Bronder <jsbronder <AT> gentoo <DOT> org>
CommitDate: Sat Nov 19 16:33:12 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=05db4776

Use dummy NULL signal instead of SIGCONT

 net-nntp/sabnzbd/files/sabnzbd.initd | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net-nntp/sabnzbd/files/sabnzbd.initd b/net-nntp/sabnzbd/files/sabnzbd.initd
index a2a8407..5a69358 100755
--- a/net-nntp/sabnzbd/files/sabnzbd.initd
+++ b/net-nntp/sabnzbd/files/sabnzbd.initd
@@ -59,7 +59,7 @@ stop() {
 	ebegin "Stopping SABnzbd"
 
 	if [ "$(wget -q -t 1 -O - -T 10 "${url}")" = "ok" ]; then
-		signals="CONT/5/${signals}"
+		signals="NULL/5/${signals}"
 	fi
 
 	start-stop-daemon \


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: net-nntp/sabnzbd/files/
@ 2016-11-19 16:34 Justin Bronder
  0 siblings, 0 replies; 6+ messages in thread
From: Justin Bronder @ 2016-11-19 16:34 UTC (permalink / raw
  To: gentoo-commits

commit:     94d6937ef7f6a065a9b1f55df49bd05c7d70bb2b
Author:     Michał Kępień <github <AT> kempniu <DOT> pl>
AuthorDate: Fri Nov 18 13:42:07 2016 +0000
Commit:     Justin Bronder <jsbronder <AT> gentoo <DOT> org>
CommitDate: Sat Nov 19 16:33:12 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=94d6937e

Accept IPv6 connections by default

 net-nntp/sabnzbd/files/sabnzbd.ini | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net-nntp/sabnzbd/files/sabnzbd.ini b/net-nntp/sabnzbd/files/sabnzbd.ini
index 1ce776f..c5ff048 100644
--- a/net-nntp/sabnzbd/files/sabnzbd.ini
+++ b/net-nntp/sabnzbd/files/sabnzbd.ini
@@ -8,7 +8,7 @@ download_dir = /var/lib/sabnzbd/download
 dirscan_dir = /var/lib/sabnzbd/dirscan
 nzb_backup_dir = /var/lib/sabnzbd/backup
 auto_browser = 0
-host = 0.0.0.0
+host = ::
 port = 8080
 [growl]
 growl_enable = 0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: net-nntp/sabnzbd/files/
@ 2017-11-26 20:05 Justin Bronder
  0 siblings, 0 replies; 6+ messages in thread
From: Justin Bronder @ 2017-11-26 20:05 UTC (permalink / raw
  To: gentoo-commits

commit:     ad458c8b83e618bac852ae1bba261a44d727e787
Author:     Justin Bronder <jsbronder <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 26 19:26:43 2017 +0000
Commit:     Justin Bronder <jsbronder <AT> gentoo <DOT> org>
CommitDate: Sun Nov 26 20:04:55 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ad458c8b

net-nntp/sabnzbd: fix sabnzbd service

Thanks to Mike Crawford for the report and fix.  #638560.

Package-Manager: Portage-2.3.13, Repoman-2.3.3

 net-nntp/sabnzbd/files/sabnzbd_at.service | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net-nntp/sabnzbd/files/sabnzbd_at.service b/net-nntp/sabnzbd/files/sabnzbd_at.service
index e9fdc4a35de..92c5eb91f17 100644
--- a/net-nntp/sabnzbd/files/sabnzbd_at.service
+++ b/net-nntp/sabnzbd/files/sabnzbd_at.service
@@ -3,8 +3,8 @@ Description=SABnzbd binary newsreader
 
 [Service]
 ExecStart=/usr/share/sabnzbd/SABnzbd.py --logging 1 --browser 0
-User=%I
-Group=%I
+User=sabnzbd
+Group=sabnzbd
 
 [Install]
 WantedBy=multi-user.target


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: net-nntp/sabnzbd/files/
@ 2019-09-18 17:17 Michał Górny
  0 siblings, 0 replies; 6+ messages in thread
From: Michał Górny @ 2019-09-18 17:17 UTC (permalink / raw
  To: gentoo-commits

commit:     1a3783e0179b091a163cd45b071e7b115cf70997
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Sep 18 17:17:22 2019 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Sep 18 17:17:48 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1a3783e0

net-nntp/sabnzbd: Make init.d -x

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 net-nntp/sabnzbd/files/sabnzbd.initd | 0
 1 file changed, 0 insertions(+), 0 deletions(-)

diff --git a/net-nntp/sabnzbd/files/sabnzbd.initd b/net-nntp/sabnzbd/files/sabnzbd.initd
old mode 100755
new mode 100644


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-09-18 17:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-28 12:57 [gentoo-commits] repo/gentoo:master commit in: net-nntp/sabnzbd/files/ Justin Bronder
  -- strict thread matches above, loose matches on Subject: below --
2016-11-19 16:34 Justin Bronder
2016-11-19 16:34 Justin Bronder
2016-11-19 16:34 Justin Bronder
2017-11-26 20:05 Justin Bronder
2019-09-18 17:17 Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox