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

comparison media-tv/plex-media-server/plex-media-server-1.1.4.ebuild @ 181:e86d3ea7f184

updated plex-media-server and adapted openrc init script to 'recent' changes in openrc script names
author gsnerf <gsnerf@gsnerf.de>
date Sat, 17 Sep 2016 14:05:47 +0200
parents
children
comparison
equal deleted inserted replaced
179:0e11f0586bd5 181:e86d3ea7f184
1 # Copyright 1999-2011 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
4
5 EAPI="2"
6
7 inherit eutils user
8
9 MAGIC="2757-24ffd60"
10 # URI_PRE="http://plexapp.com/repo/pool/main/p/plexmediaserver/plexmediaserver_${PV}.${MAGIC}_"
11 # this does not seem to work atm(/anymore?)
12 URI_PRE="https://downloads.plex.tv/plex-media-server/${PV}.${MAGIC}/plexmediaserver_${PV}.${MAGIC}_"
13
14 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."
15 HOMEPAGE="http://www.plexapp.com/"
16 KEYWORDS="-* ~x86 ~amd64"
17 SRC_URI="x86? ( ${URI_PRE}i386.deb )
18 amd64? ( ${URI_PRE}amd64.deb )"
19 SLOT="0"
20 LICENSE="PMS-License"
21 IUSE="systemd"
22 RESTRICT="mirror"
23
24 RDEPEND="net-dns/avahi
25 !systemd? ( >=sys-apps/openrc-0.13 )"
26 DEPEND="${RDEPEND}"
27
28 INIT_SCRIPT="${ROOT}/etc/init/plexmediaserver"
29
30 pkg_setup() {
31 enewgroup plex
32 enewuser plex -1 /bin/bash /var/lib/plexmediaserver "plex" --system
33 }
34
35 pkg_preinst() {
36 einfo "unpacking DEB File"
37 cd ${WORKDIR}
38 # ar x ${DISTDIR}/${A}
39 mkdir data
40 mkdir control
41 tar -xzf data.tar.gz -C data
42 tar -xzf control.tar.gz -C control
43
44 einfo "updating init script"
45 # replace debian specific init scripts with gentoo specific ones
46 rm data/etc/init.d/plexmediaserver
47 rm -r data/etc/init
48 if ! use systemd ; then
49 rm -r data/lib/systemd
50 cp "${FILESDIR}"/pms_initd_2 data/etc/init.d/plex-media-server
51 chmod 755 data/etc/init.d/plex-media-server
52 fi
53
54 einfo "moving config files"
55 # move the config to the correct place
56 mkdir data/etc/plex
57 mv data/etc/default/plexmediaserver data/etc/plex/plexmediaserver.conf
58 rmdir data/etc/default
59
60 einfo "cleaning apt config entry"
61 rm -r data/etc/apt
62
63 einfo "patching startup"
64 # apply patch for start_pms to use the new config file
65 cd data/usr/sbin
66 epatch "${FILESDIR}"/start_pms_1.patch
67 cd ../../..
68 # remove debian specific useless files
69 rm data/usr/share/doc/plexmediaserver/README.Debian
70
71 # as the patch doesn't seem to correctly set the permissions on new files do this now
72 # now copy to image directory for actual installation
73 cp -R data/* ${D}
74
75 einfo "preparing logging targets"
76 # make sure the logging directory is created
77 mkdir ${D}var
78 mkdir ${D}var/log
79 mkdir ${D}var/log/pms
80 chown plex:plex ${D}var/log/pms
81
82 einfo "prepare default library destination"
83 # also make sure the default library folder is pre created with correct permissions
84 mkdir ${D}var/lib
85 mkdir ${D}var/lib/plexmediaserver
86 chown plex:plex ${D}var/lib/plexmediaserver
87
88 einfo "Stopping running instances of Media Server"
89 if [ -e "${INIT_SCRIPT}" ]; then
90 ${INIT_SCRIPT} stop
91 fi
92 }
93
94 pkg_prerm() {
95 einfo "Stopping running instances of Media Server"
96 if [ -e "${INIT_SCRIPT}" ]; then
97 ${INIT_SCRIPT} stop
98 fi
99 }
100
101 pkg_postinst() {
102 einfo ""
103 elog "Plex Media Server is now fully installed. Please check the configuration file in /etc/plex if the defaults please your needs."
104 elog "To start please call '/etc/init.d/plex-media-server start'. You can manage your library afterwards by navigating to http://<ip>:32400/web/"
105 einfo ""
106
107 ewarn "Please note, that the URL to the library management has changed from http://<ip>:32400/manage to http://<ip>:32400/web!"
108 ewarn "If the new management interface forces you to log into myPlex and afterwards gives you an error that you need to be a plex-pass subscriber please delete the folder WebClient.bundle inside the Plug-Ins folder found in your library!"
109 }