Skip to content

Commit

Permalink
media-tv/plex-media-server: restore package (new ebuild version 1.23.…
Browse files Browse the repository at this point in the history
…1.4602)

This package does bundle deps (Python, optionally OpenSSL).

[Note by sam@:

- Restoring because this is a particularly popular piece of software.
- Yes, Python is "bundled", but it's a stripped down copy, modified/patched copy
with missing functionality, and we'll do best to treat it as if it's not there.
- Users are better served by keeping an up-to-date version in tree, even if it's
less-than-ideal for upstream to include Python in this way.]

Closes: https://bugs.gentoo.org/769782
Signed-off-by: Scott Martin <om@organizedmagnetism.com>
Closes: #20320
Signed-off-by: Sam James <sam@gentoo.org>
  • Loading branch information
ephemer0l authored and thesamesam committed Jun 2, 2021
1 parent 164a99b commit 18855a3
Show file tree
Hide file tree
Showing 9 changed files with 230 additions and 0 deletions.
54 changes: 54 additions & 0 deletions licenses/Plex

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions media-tv/plex-media-server/Manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
DIST plexmediaserver_1.23.1.4602-280ab6053_amd64.deb 81613502 BLAKE2B 59f3bc54e8436bb35983cc7b77c252c88d5ccc26325203edcbaf7ef2428dbe465e0db8bb0b24472f7f7b07b25b23d23e240903243d8dcd7983edd4cda62906b3 SHA512 e269066a10794d63cf9912df3e66b92874701a8263f2806f42d0abe9484bd347284e2bacb3ba2f6825e1489be164f0b2abe6d23021737b37be918a9b356c1301
DIST plexmediaserver_1.23.1.4602-280ab6053_i386.deb 75020714 BLAKE2B 12c8057592f734969c9d4a3ea245c2b725fe16433260214c1e18d0b192151b51c61d55bde7b40015727b1775a21fe965960165b8cc6f039a138f521f95f34cb3 SHA512 afd569e0cfd665b81e422b925e623b910d29b99e77dbfe2ff2333497f63fb69adf851562c887a9bd8ff216f37b18397cad673547a41d8fdba611d9a6bd7254e2
1 change: 1 addition & 0 deletions media-tv/plex-media-server/files/80plexmediaserver
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SEARCH_DIRS_MASK="/usr/lib/plexmediaserver/lib /usr/lib/plexmediaserver/Resources/Python/lib/python2.7/lib-dynload /usr/lib/plexmediaserver/Resources/Python/lib/python2.7/site-packages/lxml"
4 changes: 4 additions & 0 deletions media-tv/plex-media-server/files/README.gentoo
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Plex Media Server is now installed. Please check the configuration file.
It can be found in /etc/plex/plexmediaserver to verify the default settings.
To start the Plex Server, run 'rc-config start plex-media-server'
You will then be able to access your library at http://localhost:32400/manage
7 changes: 7 additions & 0 deletions media-tv/plex-media-server/files/plex-media-server.conf.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Config file for /etc/init.d/plex-media-server

PLEX_PIDFILE="/var/run/plex-media-server.pid"
PLEX_OUTLOG="/var/log/pms/out.log"
PLEX_ERRLOG="/var/log/pms/err.log"
PLEX_USER="plex"
PLEX_SCRIPT="/usr/sbin/start_pms"
16 changes: 16 additions & 0 deletions media-tv/plex-media-server/files/plex-media-server.init.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/sbin/openrc-run

start() {
ebegin "Starting Plex Media Server"
start-stop-daemon -S -m -p ${PLEX_PIDFILE} -1 ${PLEX_OUTLOG} -2 ${PLEX_ERRLOG} --quiet -u ${PLEX_USER} -N -5 -b --exec ${PLEX_SCRIPT}
eend $?
}

stop() {
ebegin "Stopping Plex Media Server"
kill -- -`cat ${PLEX_PIDFILE}`

# Remove stale pid file since this is a dirty solution
rm ${PLEX_PIDFILE}
eend $?
}
51 changes: 51 additions & 0 deletions media-tv/plex-media-server/files/start_pms
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/sh
#
# Plex Media Server - Manual start script.
#

# Set Crash Reporting identification variables
export PLEX_MEDIA_SERVER_INFO_VENDOR="$(grep ^NAME= /etc/os-release|awk -F= '{print $2}'|tr -d \" )"
export PLEX_MEDIA_SERVER_INFO_DEVICE="PC"
export PLEX_MEDIA_SERVER_INFO_MODEL="$(uname -m)"
GENTOO_PROFILE="`readlink /etc/portage/make.profile`"
export PLEX_MEDIA_SERVER_INFO_PLATFORM_VERSION="${GENTOO_PROFILE#.*/profiles/}"

# Change these parameters in /etc/default/plexmediaserver
export PLEX_MEDIA_SERVER_USER=plex
export PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS=6
export PLEX_MEDIA_SERVER_HOME=/usr/lib/plexmediaserver
export PLEX_MEDIA_SERVER_MAX_STACK_SIZE=3000
export LD_LIBRARY_PATH="${PLEX_MEDIA_SERVER_HOME}"
export PLEX_MEDIA_SERVER_TMPDIR=/tmp
export PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR="${HOME}/Library/Application Support"

if [ -f /etc/default/locale ]; then
export LANG="$(cat /etc/default/locale|awk -F '=' '/LANG=/{print $2}'|sed 's/"//g')"
export LC_ALL="$LANG"
fi

test -f /etc/default/plexmediaserver && . /etc/default/plexmediaserver

# Silently support PLEX_USER if provided as override
if [ "$PLEX_USER" != "" ]; then
export PLEX_MEDIA_SERVER_USER="$PLEX_USER"
fi

# Create AppSuppDir if not present
if [ ! -d "$PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR" ]; then
mkdir -p "$PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR"
if [ ! $? -eq 0 ]; then
echo "ERROR: Couldn't create $PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR "
exit 1
fi
fi

export LD_LIBRARY_PATH="${PLEX_MEDIA_SERVER_HOME}/lib":"${PLEX_MEDIA_SERVER_HOME}"
export TMPDIR="${PLEX_MEDIA_SERVER_TMPDIR}"

ulimit -s $PLEX_MEDIA_SERVER_MAX_STACK_SIZE

# Add sleep - for those who launch with this script
sleep 3

(cd /usr/lib/plexmediaserver; ./Plex\ Media\ Server)
19 changes: 19 additions & 0 deletions media-tv/plex-media-server/metadata.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person" proxied="yes">
<email>om@organizedmagnetism.com</email>
<name>Scott Martin</name>
</maintainer>
<maintainer type="project" proxied="proxy">
<email>proxy-maint@gentoo.org</email>
<name>Proxy Maintainers</name>
</maintainer>
<upstream>
<changelog>http://forums.plex.tv/discussion/62832/plex-media-server#latest</changelog>
<doc>https://support.plex.tv/hc/en-us/categories/200007268-Getting-Started</doc>
</upstream>
<use>
<flag name="system-openssl">Use system copy of <pkg>dev-libs/openssl</pkg> instead of the bundled one. Unsupported upstream.</flag>
</use>
</pkgmetadata>
76 changes: 76 additions & 0 deletions media-tv/plex-media-server/plex-media-server-1.23.1.4602.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit readme.gentoo-r1 systemd unpacker

MY_PV="${PV}-280ab6053"
MY_URI="https://downloads.plex.tv/plex-media-server-new"

DESCRIPTION="Free media library that is intended for use with a plex client"
HOMEPAGE="https://www.plex.tv/"
SRC_URI="
amd64? ( ${MY_URI}/${MY_PV}/debian/plexmediaserver_${MY_PV}_amd64.deb )
x86? ( ${MY_URI}/${MY_PV}/debian/plexmediaserver_${MY_PV}_i386.deb )"
S="${WORKDIR}"

LICENSE="Plex"
SLOT="0"
KEYWORDS="-* ~amd64 ~x86"
IUSE="system-openssl"
RESTRICT="mirror bindist"

DEPEND="
acct-group/plex
acct-user/plex"
RDEPEND="
${DEPEND}
system-openssl? ( dev-libs/openssl:0/1.1 )"

QA_PREBUILT="*"
QA_MULTILIB_PATHS=(
"usr/lib/plexmediaserver/lib/.*"
"usr/lib/plexmediaserver/Resources/Python/lib/python2.7/.*"
"usr/lib/plexmediaserver/Resources/Python/lib/python2.7/lib-dynload/_hashlib.so"
)

src_install() {
# Remove Debian specific files
rm -r "usr/share/doc" || die

# Remove shipped openssl library
if use system-openssl; then
rm usr/lib/plexmediaserver/lib/libssl.so.1.1 || die
fi

# Add startup wrapper
dosbin "${FILESDIR}/start_pms"

# Copy main files over to image and preserve permissions so it is portable
cp -rp usr/ "${ED}" || die

# Make sure the logging directory is created
keepdir /var/log/pms
fowners plex:plex /var/log/pms

keepdir /var/lib/plexmediaserver
fowners plex:plex /var/lib/plexmediaserver

newinitd "${FILESDIR}/${PN}.init.d" ${PN}
newconfd "${FILESDIR}/${PN}.conf.d" ${PN}

systemd_dounit "${ED}"/usr/lib/plexmediaserver/lib/plexmediaserver.service
keepdir /var/lib/plexmediaserver

# Adds the precompiled plex libraries to the revdep-rebuild's mask list
# so it doesn't try to rebuild libraries that can't be rebuilt.
insinto /etc/revdep-rebuild
doins "${FILESDIR}"/80plexmediaserver

readme.gentoo_create_doc
}

pkg_postinst() {
readme.gentoo_print_elog
}

0 comments on commit 18855a3

Please sign in to comment.