# Copyright 1999-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ EAPI="1" inherit distutils MY_P="${P/sab/SAB}" DESCRIPTION="Binary Newsgrabber written in Python, server-oriented using a web-interface.The active successor of the abandoned SABnzbd project." HOMEPAGE="http://www.sabnzbd.org/" SRC_URI="mirror://sourceforge/sabnzbdplus/${P}-src.tar.gz" HOMEDIR="${ROOT}var/lib/${PN}" DHOMEDIR="var/lib/${PN}" LICENSE="GPL-2" SLOT="0" KEYWORDS="~amd64 ~x86" IUSE="rar unzip feedparser yenc ssl" RDEPEND="|| ( ( >=dev-lang/python-2.4.4:2.4 >=dev-python/celementtree-1.0.5 ) >=dev-lang/python-2.5.2:2.5 ) ~dev-python/cherrypy-2.2.1 >=dev-python/cheetah-2.0.1 >=app-arch/par2cmdline-0.4 app-text/dos2unix rar? ( >=app-arch/unrar-3.7.0 ) unzip? ( >=app-arch/unzip-5.5.2 ) feedparser? ( >=dev-python/feedparser-4.1 ) yenc? ( >=dev-python/yenc-0.3 ) ssl? ( dev-python/pyopenssl )" DEPEND="${RDEPEND}" S="${WORKDIR}/${MY_P}" src_unpack() { unpack ${A} cp "${FILESDIR}/${P}-gentoo-setup.py" "${S}/setup.py" } pkg_preinst() { #Create group and user enewgroup "${PN}" enewuser "${PN}" -1 -1 "${HOMEDIR}" "${PN}" } src_install() { distutils_src_install #Init scripts newinitd "${FILESDIR}"/"${PN}".init "${PN}" newconfd "${FILESDIR}"/"${PN}".conf "${PN}" cd "${D}" #Config file (permissions for this are really up in the air, should this be sabnzbd owned with mask=600?) insinto /etc newins "${FILESDIR}/${P}".ini "${PN}".conf fowners root:"${PN}" etc/"${PN}".conf fperms 660 etc/"${PN}".conf #Create all default dirs keepdir "${DHOMEDIR}" fowners "${PN}":"${PN}" "${DHOMEDIR}" keepdir "${DHOMEDIR}"/download fowners "${PN}":"${PN}" "${DHOMEDIR}"/download fperms 775 "${DHOMEDIR}"/download keepdir "${DHOMEDIR}"/complete fowners "${PN}":"${PN}" "${DHOMEDIR}"/complete fperms 775 "${DHOMEDIR}"/complete keepdir "${DHOMEDIR}"/nzb_backup fowners "${PN}":"${PN}" "${DHOMEDIR}"/nzb_backup fperms 775 "${DHOMEDIR}"/nzb_backup keepdir "${DHOMEDIR}"/cache fowners "${PN}":"${PN}" "${DHOMEDIR}"/cache keepdir /var/log/sabnzbd fowners "${PN}":"${PN}" "${ROOT}"var/log/"${PN}" keepdir "${DHOMEDIR}"/dirscan fowners "${PN}":"${PN}" "${DHOMEDIR}"/dirscan fperms 775 "${DHOMEDIR}"/dirscan #Add themes cd "${D}" mv usr/interfaces usr/share/"${PN}"-"${PV}"/ #fix permission on themes fowners root:sabnzbd -R usr/share/${P} } pkg_postinst() { distutils_pkg_postinst einfo "Default directory: ${HOMEDIR}" einfo "Templates can be found in: ${ROOT}usr/share/${P}" einfo "" einfo "Run: gpasswd -a sabnzbd" einfo "to add an user to the sabnzbd group so it can edit sabnzbd files" einfo "" ewarn "Please configure ${ROOT}etc/conf.d/${PN} before starting!" einfo "" einfo "Start with ${ROOT}etc/init.d/${PN} start" }