# Copyright 1999-2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ inherit distutils DESCRIPTION="Binary Newsgrabber written in Python, server-oriented using a web-interface.The active successor of the abandoned SABnzbd project." HOMEPAGE="http://sourceforge.net/projects/sabnzbd/" SRC_URI="mirror://sourceforge/sabnzbdplus/sabnzbd-${PV}-src.tar.gz" HOMEDIR="${ROOT}var/lib/${PN}" DHOMEDIR="var/lib/${PN}" LICENSE="GPL-2" SLOT="0" KEYWORDS="~amd64" IUSE="symlink unrar unzip feedparser par yenc" RDEPEND=">=dev-lang/python-2.4.4 ~dev-python/cherrypy-2.2.1 >=dev-python/cheetah-2.0.1 >=dev-python/elementtree-1.2.6 app-text/dos2unix unrar? ( >=app-arch/unrar-3.6.6 ) unzip? ( >=app-arch/unzip-5.5.2 ) feedparser? ( >=dev-python/feedparser-4.1 ) par? ( >=app-arch/par2cmdline-0.4 ) yenc? ( >=dev-python/yenc-0.3 )" DEPEND="" src_unpack() { unpack "${A}" || die mv ${WORKDIR}/SABnzbd-${PV}/* "${WORKDIR}/" einfo "copy setup.py to ${WORKDIR}/setup.py" cp "${FILESDIR}/${PN}-${PV}-gentoo-setup.py" "${WORKDIR}/setup.py" } src_compile() { distutils_src_compile } pkg_preinst() { #Create group and user enewgroup "${PN}" enewuser "${PN}" -1 /bin/false "${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}/${PN}-${PV}".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}"/ #cp -R "${WORKDIR}"/interfaces/Plush usr/share/"${PN}"-"${PV}"/Plush #cp -R "${WORKDIR}"/interfaces/smpl usr/share/"${PN}"-"${PV}"/smpl #cp -R "${WORKDIR}"/interfaces/iphone usr/share/"${PN}"-"${PV}"/iphone #Symlink /usr/share/SABnzbd to this version if use symlink; then cd "${D}"usr/share/ dosym "${PN}-${PV}" "${PN}" fi #fix permission on themes fowners root:sabnzbd -R usr/share/${PN}-${PV} } pkg_postinst() { einfo "Default directory: ${HOMEDIR}" einfo "Templates can be found in: ${ROOT}usr/share/${PN}-${PV}" 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" }