We have moved to Git. This repository is only provided for compatibility with old installations. Learn how to migrate your installation here.

view media-tv/plex-media-server/plex-media-server-0.9.3.5.ebuild @ 0:3d30b669f1d5

added ebuilds for plex-media-server
author gsnerf <gsnerf@gsnerf.de>
date Thu, 09 Feb 2012 02:55:54 +0100
parents
children
line wrap: on
line source

# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI="2"

inherit eutils

DESCRIPTION="Plex Media Server is a free media library that is intended for use with a plex client available for OS X, iOS and Android systems. It is a standalone product which can be used in conjunction with every program, that knows the API. For managing the library a web based interface is provided."
HOMEPAGE="http://www.plexapp.com/"
KEYWORDS="-* ~x86 ~amd64"
SRC_URI="x86?	( http://www.plexapp.com/repo/pool/main/p/plexmediaserver/plexmediaserver_${PV}ubuntu1_i386.deb )
	amd64?	( http://www.plexapp.com/repo/pool/main/p/plexmediaserver/plexmediaserver_${PV}ubuntu1_amd64.deb )"
SLOT="0"
LICENSE="PMS-License"
IUSE=""

RDEPEND="net-dns/avahi"
DEPEND="${RDEPEND}"

INIT_SCRIPT="${ROOT}/etc/init/plexmediaserver"

pkg_setup() {
	enewgroup plex
	enewuser plex -1 /bin/bash /var/lib/plexmediaserver "plex" --system
	return
}

src_unpack() {
	ar x ${DISTDIR}/${A}
	mkdir data
	mkdir control
	tar -xzf data.tar.gz -C data
	tar -xzf control.tar.gz -C control
}

src_prepare() {
	# that is a debian file that does not exist in gentoo and therefore can't be handled through diff
	rm data/etc/init.d/plexmediaserver
	# now adapt the config and start scripts to work with gentoo
	epatch "${FILESDIR}"/${PN}-startup_fix.patch
	# as the patch doesn't seem to correctly set the permissions on new files do this now
	chmod 755 data/etc/init.d/plex-media-server
}

src_install () {
	cp -R data/* ${D}
}

pkg_preinst() {
	einfo "Stopping running instances of Media Server"
	if [ -e "${INIT_SCRIPT}" ]; then
		${INIT_SCRIPT} stop
	fi
}

pkg_prerm() {
	einfo "Stopping running instances of Media Server"
	if [ -e "${INIT_SCRIPT}" ]; then
		${INIT_SCRIPT} stop
	fi
}