summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Deutschmann <whissi@gentoo.org>2020-06-28 14:34:45 +0200
committerThomas Deutschmann <whissi@gentoo.org>2020-06-28 14:59:08 +0200
commit0f0e394cc4589571a6ed678fb9712c1aabcce5ea (patch)
tree283fd72abd8960e37fa5efb127b57c0e088c00dd /net-nntp/sabnzbd/files
parentacct-user/sabnzbd: new user for net-nntp/sabnzbd, UID 397 (diff)
downloadgentoo-0f0e394cc4589571a6ed678fb9712c1aabcce5ea.tar.gz
gentoo-0f0e394cc4589571a6ed678fb9712c1aabcce5ea.tar.bz2
gentoo-0f0e394cc4589571a6ed678fb9712c1aabcce5ea.zip
net-nntp/sabnzbd: bump to v3.0.0 RC1
Bug: https://bugs.gentoo.org/708958 Package-Manager: Portage-2.3.101, Repoman-2.3.22 Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
Diffstat (limited to 'net-nntp/sabnzbd/files')
-rw-r--r--net-nntp/sabnzbd/files/sabnzbd-r1.ini12
-rw-r--r--net-nntp/sabnzbd/files/sabnzbd-r1.initd71
2 files changed, 83 insertions, 0 deletions
diff --git a/net-nntp/sabnzbd/files/sabnzbd-r1.ini b/net-nntp/sabnzbd/files/sabnzbd-r1.ini
new file mode 100644
index 000000000000..5ccd7e19ca37
--- /dev/null
+++ b/net-nntp/sabnzbd/files/sabnzbd-r1.ini
@@ -0,0 +1,12 @@
+__version__ = 19
+[misc]
+log_dir = /var/log/sabnzbd
+admin_dir = /var/lib/sabnzbd/admin
+cache_dir = /var/lib/sabnzbd/cache
+complete_dir = /var/lib/sabnzbd/complete
+download_dir = /var/lib/sabnzbd/download
+dirscan_dir = /var/lib/sabnzbd/dirscan
+nzb_backup_dir = /var/lib/sabnzbd/backup
+auto_browser = 0
+host = ::
+port = 8080
diff --git a/net-nntp/sabnzbd/files/sabnzbd-r1.initd b/net-nntp/sabnzbd/files/sabnzbd-r1.initd
new file mode 100644
index 000000000000..eff3352a90b4
--- /dev/null
+++ b/net-nntp/sabnzbd/files/sabnzbd-r1.initd
@@ -0,0 +1,71 @@
+#!/sbin/openrc-run
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+PIDFILE="/run/sabnzbd/sabnzbd.pid"
+
+depend() {
+ use dns
+}
+
+get_var() {
+ grep -P -o -m 1 "(?<=^${1} = ).*" "${SABNZBD_CONFIGFILE}" || echo 0
+}
+
+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/share/sabnzbd/SABnzbd.py \
+ -- \
+ --config-file "${SABNZBD_CONFIGFILE}" \
+ --logging "${SABNZBD_LOGGING}" \
+ --daemon \
+ --pidfile "${PIDFILE}"
+
+ eend $?
+}
+
+stop() {
+ local protocol="http"
+ local host="$(get_var "host")"
+ local port="$(get_var "port")"
+
+ if [ $(get_var "enable_https") -eq 1 ]; then
+ protocol="https"
+ port="$(get_var "https_port")"
+ fi
+
+ case "${host}" in
+ *:*) host="[${host}]" ;;
+ esac
+
+ local url="${protocol}://${host}:${port}/sabnzbd/api?mode=shutdown"
+
+ if [ $(get_var "disable_api_key") -eq 0 ]; then
+ url="${url}&apikey=$(get_var "api_key")"
+ fi
+
+ local signals="TERM/1/KILL/1"
+
+ ebegin "Stopping SABnzbd"
+
+ if [ "$(wget -o /dev/null -t 1 -O - -T 10 "${url}")" = "ok" ]; then
+ signals="NULL/5/${signals}"
+ fi
+
+ start-stop-daemon \
+ --stop \
+ --pidfile "${PIDFILE}" \
+ --retry "${signals}"
+
+ eend $?
+}