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.6.3-r1.ebuild @ 10:66907cc05248

reworked ebuild for current version to work without a patch file for better compatibility with new releases!
author gsnerf <gsnerf@gsnerf.de>
date Sat, 16 Jun 2012 17:49:00 +0200
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_0.9.6.3.143-4466fb5_i386.deb )
	amd64?	( http://www.plexapp.com/repo/pool/main/p/plexmediaserver/plexmediaserver_0.9.6.3.143-4466fb5_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
}

pkg_preinst() {
	einfo "Unpacking DEB File"
	cd ${WORKDIR}
	ar x ${DISTDIR}/${A}
        mkdir data
        mkdir control
        tar -xzf data.tar.gz -C data
        tar -xzf control.tar.gz -C control

	einfo "Preparing files for installation"
	# replace debian specific init scripts with gentoo specific ones
        rm data/etc/init.d/plexmediaserver
	rm -r data/etc/init
	cp "${FILESDIR}"/pms_initd_1 data/etc/init.d/plex-media-server
        chmod 755 data/etc/init.d/plex-media-server
	# move the config to the correct place
	mkdir data/etc/plex
	mv data/etc/default/plexmediaserver data/etc/plex/plexmediaserver.conf
	rmdir data/etc/default
	# remove debian specific useless files
	rm data/usr/share/doc/plexmediaserver/README.Debian
        # as the patch doesn't seem to correctly set the permissions on new files do this now
	# now copy to image directory for actual installation
	cp -R data/* ${D}

	# last but not least make sure the logging directory is created
	mkdir ${D}var
	mkdir ${D}var/log
	mkdir ${D}var/log/pms
	chown plex:plex ${D}var/log/pms

	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
}