diff options
author | Thomas Deutschmann <whissi@gentoo.org> | 2020-06-28 14:34:45 +0200 |
---|---|---|
committer | Thomas Deutschmann <whissi@gentoo.org> | 2020-06-28 14:59:08 +0200 |
commit | 0f0e394cc4589571a6ed678fb9712c1aabcce5ea (patch) | |
tree | 283fd72abd8960e37fa5efb127b57c0e088c00dd /net-nntp/sabnzbd | |
parent | acct-user/sabnzbd: new user for net-nntp/sabnzbd, UID 397 (diff) | |
download | gentoo-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')
-rw-r--r-- | net-nntp/sabnzbd/files/sabnzbd-r1.ini | 12 | ||||
-rw-r--r-- | net-nntp/sabnzbd/files/sabnzbd-r1.initd | 71 | ||||
-rw-r--r-- | net-nntp/sabnzbd/sabnzbd-3.0.0_rc1.ebuild (renamed from net-nntp/sabnzbd/sabnzbd-3.0.0_rc1_pre0.ebuild) | 45 |
3 files changed, 104 insertions, 24 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 $? +} diff --git a/net-nntp/sabnzbd/sabnzbd-3.0.0_rc1_pre0.ebuild b/net-nntp/sabnzbd/sabnzbd-3.0.0_rc1.ebuild index 2a8fb3992d67..afa365fd3af6 100644 --- a/net-nntp/sabnzbd/sabnzbd-3.0.0_rc1_pre0.ebuild +++ b/net-nntp/sabnzbd/sabnzbd-3.0.0_rc1.ebuild @@ -7,7 +7,7 @@ EAPI="7" PYTHON_COMPAT=( python3_{6..8} ) PYTHON_REQ_USE="sqlite" -inherit python-single-r1 user systemd +inherit python-single-r1 systemd MY_PV="${PV/_rc/RC}" MY_PV="${MY_PV//_pre*}" @@ -21,13 +21,15 @@ SRC_URI="https://github.com/sabnzbd/sabnzbd/releases/download/${MY_PV}/${MY_P}-s # Sabnzbd is GPL-2 but bundles software with the following licenses. LICENSE="GPL-2 BSD LGPL-2 MIT BSD-1" SLOT="0" -KEYWORDS="" +KEYWORDS="~amd64" IUSE="+7za +rar unzip" # Sabnzbd is installed to /usr/share/ as upstream makes it clear they should not # be in python's sitedir. See: https://sabnzbd.org/wiki/advanced/unix-packaging COMMON_DEPS=" + acct-user/sabnzbd + acct-group/sabnzbd ${PYTHON_DEPS} $(python_gen_cond_dep ' dev-python/chardet[${PYTHON_MULTI_USEDEP}] @@ -60,11 +62,6 @@ S="${WORKDIR}/${MY_P}" pkg_setup() { MY_HOMEDIR="/var/lib/${PN}" python-single-r1_pkg_setup - - # Create sabnzbd group - enewgroup "${PN}" - # Create sabnzbd user, put in sabnzbd group - enewuser "${PN}" -1 -1 "${MY_HOMEDIR}" "${PN}" } src_install() { @@ -81,7 +78,7 @@ src_install() { python_fix_shebang "${ED}/usr/share/${PN}" python_optimize "${ED}/usr/share/${PN}" - newinitd "${FILESDIR}/${PN}.initd" "${PN}" + newinitd "${FILESDIR}/${PN}-r1.initd" "${PN}" newconfd "${FILESDIR}/${PN}.confd" "${PN}" diropts -o "${PN}" -g "${PN}" @@ -90,7 +87,7 @@ src_install() { insinto "/etc/${PN}" insopts -m 0600 -o "${PN}" -g "${PN}" - doins "${FILESDIR}/${PN}.ini" + newins "${FILESDIR}"/${PN}-r1.ini ${PN}.ini dodoc {ABOUT,ISSUES}.txt README.mkd licenses/* @@ -104,21 +101,21 @@ pkg_postinst() { einfo einfo "To add a user to the sabnzbd group so it can edit SABnzbd+ files, run:" einfo - einfo " gpasswd -a <user> sabnzbd" + einfo " usermod -a -G sabnzbd <user>" einfo - einfo "By default, SABnzbd+ will listen on TCP port 8080." + einfo "By default, SABnzbd will listen on TCP port 8080." + else + local v + for v in ${REPLACING_VERSIONS}; do + if ver_test "${v}" -lt 3; then + ewarn + ewarn "Due to changes in this release, the queue will be converted when ${PN}" + ewarn "is started for the first time. Job order, settings and data will be" + ewarn "preserved, but all jobs will be unpaused and URLs that did not finish" + ewarn "fetching before the upgrade will be lost!" + ewarn + break + fi + done fi - - local v - for v in ${REPLACING_VERSIONS}; do - if ver_test "${v}" -lt 3; then - ewarn - ewarn "Due to changes in this release, the queue will be converted when ${PN}" - ewarn "is started for the first time. Job order, settings and data will be" - ewarn "preserved, but all jobs will be unpaused and URLs that did not finish" - ewarn "fetching before the upgrade will be lost!" - ewarn - break - fi - done } |