diff options
author | Justin Bronder <jsbronder@gentoo.org> | 2013-06-25 03:48:27 +0000 |
---|---|---|
committer | Justin Bronder <jsbronder@gentoo.org> | 2013-06-25 03:48:27 +0000 |
commit | 2981f8c9d26ff6e7d16156e01040b461bbcd428c (patch) | |
tree | 4c2d5c630028ab6bb2a4f002683f09b31fb45f74 /net-nntp | |
parent | Fixup dependencies and drop invalid python targets. (diff) | |
download | gentoo-2-2981f8c9d26ff6e7d16156e01040b461bbcd428c.tar.gz gentoo-2-2981f8c9d26ff6e7d16156e01040b461bbcd428c.tar.bz2 gentoo-2-2981f8c9d26ff6e7d16156e01040b461bbcd428c.zip |
Update init.d scripts to use vars from the config file. Disable growl by default.
(Portage version: 2.1.12.2/cvs/Linux x86_64, signed Manifest commit with key 4D7043C9)
Diffstat (limited to 'net-nntp')
-rw-r--r-- | net-nntp/sabnzbd/ChangeLog | 10 | ||||
-rw-r--r-- | net-nntp/sabnzbd/files/sabnzbd.confd | 2 | ||||
-rw-r--r-- | net-nntp/sabnzbd/files/sabnzbd.ini | 2 | ||||
-rw-r--r-- | net-nntp/sabnzbd/files/sabnzbd.initd | 60 | ||||
-rw-r--r-- | net-nntp/sabnzbd/sabnzbd-0.7.13-r2.ebuild (renamed from net-nntp/sabnzbd/sabnzbd-0.7.13-r1.ebuild) | 2 | ||||
-rw-r--r-- | net-nntp/sabnzbd/sabnzbd-0.7.13.ebuild | 118 |
6 files changed, 54 insertions, 140 deletions
diff --git a/net-nntp/sabnzbd/ChangeLog b/net-nntp/sabnzbd/ChangeLog index 218d813a4cec..7711adf56cb7 100644 --- a/net-nntp/sabnzbd/ChangeLog +++ b/net-nntp/sabnzbd/ChangeLog @@ -1,6 +1,14 @@ # ChangeLog for net-nntp/sabnzbd # Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/net-nntp/sabnzbd/ChangeLog,v 1.14 2013/06/24 23:20:03 jsbronder Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-nntp/sabnzbd/ChangeLog,v 1.15 2013/06/25 03:48:26 jsbronder Exp $ + +*sabnzbd-0.7.13-r2 (25 Jun 2013) + + 25 Jun 2013; Justin Bronder <jsbronder@gentoo.org> +sabnzbd-0.7.13-r2.ebuild, + -sabnzbd-0.7.13-r1.ebuild, -sabnzbd-0.7.13.ebuild, files/sabnzbd.confd, + files/sabnzbd.ini, files/sabnzbd.initd: + Update init.d scripts to use vars from the config file. Disable growl by + default. *sabnzbd-0.7.13-r1 (24 Jun 2013) diff --git a/net-nntp/sabnzbd/files/sabnzbd.confd b/net-nntp/sabnzbd/files/sabnzbd.confd index 1dcaa94b8384..ec40168657bd 100644 --- a/net-nntp/sabnzbd/files/sabnzbd.confd +++ b/net-nntp/sabnzbd/files/sabnzbd.confd @@ -1,5 +1,3 @@ -SABNZBD_SERVER=0.0.0.0 -SABNZBD_PORT=8080 SABNZBD_CONFIGFILE=/etc/sabnzbd/sabnzbd.ini SABNZBD_USER=sabnzbd SABNZBD_GROUP=sabnzbd diff --git a/net-nntp/sabnzbd/files/sabnzbd.ini b/net-nntp/sabnzbd/files/sabnzbd.ini index cfb55613f8dd..9c69155bdbd5 100644 --- a/net-nntp/sabnzbd/files/sabnzbd.ini +++ b/net-nntp/sabnzbd/files/sabnzbd.ini @@ -10,3 +10,5 @@ nzb_backup_dir = /var/lib/sabnzbd/backup auto_browser = 0
host = 0.0.0.0
port = 8080
+[growl]
+growl_enable = 0
diff --git a/net-nntp/sabnzbd/files/sabnzbd.initd b/net-nntp/sabnzbd/files/sabnzbd.initd index 64c3d9888449..97c6b69c5d00 100644 --- a/net-nntp/sabnzbd/files/sabnzbd.initd +++ b/net-nntp/sabnzbd/files/sabnzbd.initd @@ -1,11 +1,9 @@ #!/sbin/runscript # Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-nntp/sabnzbd/files/sabnzbd.initd,v 1.4 2013/03/08 02:46:45 jsbronder Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-nntp/sabnzbd/files/sabnzbd.initd,v 1.5 2013/06/25 03:48:26 jsbronder Exp $ -# pid file name is hard-coded in sabnzbd, this must match RUNDIR=/var/run/sabnzbd -PIDFILE=${RUNDIR}/sabnzbd-${SABNZBD_PORT}.pid depend() { need net @@ -22,10 +20,9 @@ start() { --user ${SABNZBD_USER} \ --group ${SABNZBD_GROUP} \ --name sabnzbd \ - --pidfile ${PIDFILE} \ + --pidfile $(get_pidfile) \ --exec /usr/bin/sabnzbd \ -- \ - --server ${SABNZBD_SERVER}:${SABNZBD_PORT} \ --config-file ${SABNZBD_CONFIGFILE} \ --logging ${SABNZBD_LOGGING} \ --daemon \ @@ -34,34 +31,61 @@ start() { eend $? } -stop() { - local api_key=$(awk '/^api_key =/{print $3}' ${SABNZBD_CONFIGFILE}) - local hostname=${SABNZBD_SERVER} - local rc t +get_var() { + echo $(echo $(grep "^$1" ${SABNZBD_CONFIGFILE} | head -n 1 | sed 's/\r//' | awk '{print $3}')) +} + +get_pidfile () { + # pid file name is hard-coded in sabnzbd, this must match + local ssl=$(get_var 'enable_https') + + if [ -z "${ssl}" ]; then + echo "${RUNDIR}/sabnzbd-8080.pid" + elif [ ${ssl} -eq 0 ]; then + echo "${RUNDIR}/sabnzbd-$(get_var 'port').pid" + else + echo "${RUNDIR}/sabnzbd-$(get_var 'https_port').pid" + fi +} - ebegin "Stopping SABnzbd" +get_addr() { + local host=$(get_var 'host') + #local ssl=$(get_var 'enable_https') + #local ssl_port=$(get_var 'https_port') + local port=$(get_var 'port') - if [ -z "${hostname}" -o "${hostname}" == "0.0.0.0" ]; then - hostname="localhost" + if [ "${host}" == "0.0.0.0" ]; then + host=localhost fi - /usr/bin/wget -q --delete-after \ - "http://${hostname}:${SABNZBD_PORT}/sabnzbd/api?mode=shutdown&apikey=${api_key}" + # sabnzbd seems to only respond correctly to non ssl requests + echo ${host}:${port} +} + +stop() { + local api_key=$(get_var 'api_key') + local rc t + + ebegin "Stopping SABnzbd @ $(get_addr)" + + /usr/bin/wget -q --delete-after --no-check-certificate \ + "http://$(get_addr)/sabnzbd/api?mode=shutdown&apikey=${api_key}" rc=$? if [ ${rc} -eq 0 ]; then # Wait for sabnzbd to fully shutdown. - for ((t=0; t < 20; t++)); do + for ((t=0; t < 30; t++)); do sleep 0.5 - [ ! -s ${PIDFILE} ] && break + [ ! -s $(get_pidfile) ] && break done fi - if [ -s ${PIDFILE} ]; then + if [ -s $(get_pidfile) ]; then # Using wget didn't work, resort to start-stop-daemon + einfo "Falling back to SIGTERM, this may not work if you restarted via the web interface" start-stop-daemon \ --stop \ - --pidfile ${PIDFILE} \ + --pidfile $(get_pidfile) \ --retry SIGTERM/1/SIGKILL/5 rc=$? fi diff --git a/net-nntp/sabnzbd/sabnzbd-0.7.13-r1.ebuild b/net-nntp/sabnzbd/sabnzbd-0.7.13-r2.ebuild index 75a6b9f16c12..5974d5f05ba3 100644 --- a/net-nntp/sabnzbd/sabnzbd-0.7.13-r1.ebuild +++ b/net-nntp/sabnzbd/sabnzbd-0.7.13-r2.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-nntp/sabnzbd/sabnzbd-0.7.13-r1.ebuild,v 1.1 2013/06/24 23:20:03 jsbronder Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-nntp/sabnzbd/sabnzbd-0.7.13-r2.ebuild,v 1.1 2013/06/25 03:48:26 jsbronder Exp $ EAPI="4" diff --git a/net-nntp/sabnzbd/sabnzbd-0.7.13.ebuild b/net-nntp/sabnzbd/sabnzbd-0.7.13.ebuild deleted file mode 100644 index 7dea32997bfd..000000000000 --- a/net-nntp/sabnzbd/sabnzbd-0.7.13.ebuild +++ /dev/null @@ -1,118 +0,0 @@ -# Copyright 1999-2013 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/net-nntp/sabnzbd/sabnzbd-0.7.13.ebuild,v 1.1 2013/06/21 23:20:31 jsbronder Exp $ - -EAPI="4" - -# Require python-2 with sqlite USE flag -PYTHON_DEPEND="2:2.6" -PYTHON_USE_WITH="sqlite" - -inherit eutils python user - -MY_P="${P/sab/SAB}" - -DESCRIPTION="Binary newsgrabber with web-interface" -HOMEPAGE="http://www.sabnzbd.org/" -SRC_URI="mirror://sourceforge/sabnzbdplus/${MY_P}-src.tar.gz" - -# Sabnzbd is GPL-2 but bundles software with the following licenses. -LICENSE="GPL-2 BSD LGPL-2 MIT BSD-1" -SLOT="0" -KEYWORDS="~amd64" -IUSE="+rar +ssl unzip +yenc" - -# Sabnzbd is installed to /usr/share/ as upstream makes it clear they should not -# be in python's sitedir. See: http://wiki.sabnzbd.org/unix-packaging - -# TODO: still bundled but not in protage: -# kronos, rarfile, rsslib, ssmtplib, listquote, json-py, msgfmt -# pynewsleecher -# -# Also note that cherrypy is still bundled. It's near impossible to find -# out where the bundled and heavily patched version came from (pulled from -# cherrypy subversion, patched somewhere, then imported to sabnzbd and patched -# further. Upstream is planning on making this easier with 0.8.0. -# https://github.com/sabnzbd/sabnzbd/issues/47 - -RDEPEND=" - >=app-arch/par2cmdline-0.4 - >=dev-python/cheetah-2.0.1 - dev-python/configobj - dev-python/feedparser - dev-python/gntp - dev-python/pythonutils - net-misc/wget - rar? ( || ( app-arch/unrar app-arch/rar ) ) - ssl? ( dev-python/pyopenssl ) - unzip? ( >=app-arch/unzip-5.5.2 ) - yenc? ( dev-python/yenc ) -" - -S="${WORKDIR}/${MY_P}" - -pkg_setup() { - HOMEDIR="/var/lib/${PN}" - python_set_active_version 2 - python_pkg_setup - - # Create sabnzbd group - enewgroup ${PN} - # Create sabnzbd user, put in sabnzbd group - enewuser "${PN}" -1 -1 "${HOMEDIR}" "${PN}" -} - -src_prepare() { - epatch "${FILESDIR}"/use-system-configobj-and-feedparser.patch - - # remove bundled modules - rm -r sabnzbd/utils/{feedparser,configobj}.py || die - rm -r gntp || die - rm licenses/License-{feedparser,configobj,gntp}.txt || die -} - -src_install() { - local d - - dodir /usr/share/${PN}/sabnzbd - insinto /usr/share/${PN}/ - doins SABnzbd.py - fperms +x /usr/share/${PN}/SABnzbd.py - dobin "${FILESDIR}"/sabnzbd - - for d in cherrypy email icons interfaces locale po sabnzbd tools util; do - insinto /usr/share/${PN}/${d} - doins -r ${d}/* - done - - newinitd "${FILESDIR}/${PN}.initd" "${PN}" - newconfd "${FILESDIR}/${PN}.confd" "${PN}" - - insinto /etc/logrotate.d - newins "${FILESDIR}/"${PN}.logrotate ${PN} - - diropts -o ${PN} -g ${PN} - dodir /etc/${PN} - dodir /var/log/${PN} - - insinto "/etc/${PN}" - insopts -m 0600 -o ${PN} -g ${PN} - doins "${FILESDIR}/${PN}.ini" - - dodoc {ABOUT,CHANGELOG,ISSUES,README}.txt Sample-PostProc.sh licenses/* -} - -pkg_postinst() { - python_mod_optimize /usr/share/${PN} - - einfo "Default directory: ${HOMEDIR}" - einfo "" - einfo "Run: gpasswd -a <user> sabnzbd" - einfo "to add an user to the sabnzbd group so it can edit sabnzbd files" - einfo "" - einfo "By default sabnzbd will listen on 127.0.0.1:8080" -} - -pkg_postrm() { - python_mod_cleanup /usr/share/${PN} -} |