aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Bernardo <samuelbernardo.mail@gmail.com>2019-11-17 18:09:39 +0000
committerSamuel Bernardo <samuelbernardo.mail@gmail.com>2019-11-17 18:09:39 +0000
commit6c00ff512c00d323750bc540a1f566b1a4f17128 (patch)
treea4fef104403339d541eaaf28503367c3def079d9
parentcorrect version binaries of meocloud client (diff)
downloadssnb-6c00ff512c00d323750bc540a1f566b1a4f17128.tar.gz
ssnb-6c00ff512c00d323750bc540a1f566b1a4f17128.tar.bz2
ssnb-6c00ff512c00d323750bc540a1f566b1a4f17128.zip
add plex media server
Signed-off-by: Samuel Bernardo <samuelbernardo.mail@gmail.com>
-rw-r--r--media-tv/plex-media-server/Manifest8
-rw-r--r--media-tv/plex-media-server/files/conf.d/plex-media-server7
-rwxr-xr-xmedia-tv/plex-media-server/files/init.d/plex-media-server20
-rw-r--r--media-tv/plex-media-server/files/systemd/plex-media-server.service11
-rw-r--r--media-tv/plex-media-server/files/virtualenv_start_pms.patch23
-rw-r--r--media-tv/plex-media-server/metadata.xml8
-rw-r--r--media-tv/plex-media-server/plex-media-server-1.18.2.ebuild162
7 files changed, 239 insertions, 0 deletions
diff --git a/media-tv/plex-media-server/Manifest b/media-tv/plex-media-server/Manifest
new file mode 100644
index 0000000..92b2555
--- /dev/null
+++ b/media-tv/plex-media-server/Manifest
@@ -0,0 +1,8 @@
+AUX conf.d/plex-media-server 216 BLAKE2B 094d0f6f7cdfa696ae47d7879c7459be5755dfe02a12c3ee986c1078ae0a46d974adc25dce252a49c3fd72e0dfe1ba65c49d575e12036fba44ce9b0390da64ec SHA512 d3d68fa58a1c1064803a9607708123302890571e823e5bc26de741bb15bd51db19234636672ff01757cbbcdb984c60663545689fa915761c78c3cf49e6da0f95
+AUX init.d/plex-media-server 413 BLAKE2B f60fe9f653c591cddaf77a0ebcb47218681a63235e82bc016c7d2ee9180df7f6ff24f3784216ea370bdc2d493531492f196200b6ec56ff8b303e69adaa0f108d SHA512 aeb873a00081f20abd27cc76d395908ae0643bd8aa665557adafef2ed97edbe93c18b55818b49227746f9c3ce4b7a81ceb9132f07d8d873bc7b5a932b944a402
+AUX systemd/plex-media-server.service 159 BLAKE2B d4988890f6424e0b9160e90df0125fbcb32e86443c5b869f66ac6e28c3701fdaa3dd819823edd0c8675792bf4e24e7fcf3bb8894e55539ad8fc5eb9ac9a550fc SHA512 9066840efa43b127dd0d4b26ea0552894db97bf48f89003258095986e7d4728e05bee2f49de856777ed3d0b5ec41654c14505bc9867b227b754aeecd0529abd6
+AUX virtualenv_start_pms.patch 839 BLAKE2B 20d6a53b40a2c714153bc7f04c2bbad568b75197cd450cb52129cc3718fad1db09f9fe2a92e8608e1e95b710e0b4af58a373650ab4017438b63fe61132f13d75 SHA512 55fb8f3234942d10c0d6d1820fbab48b8a9f26f069031946dae551cde8b7d18d61ef36ec994719d2519687dc75e5ec27205702395a8af112bda720b7a62072aa
+DIST plexmediaserver_1.18.2.2029-36236cc4c_amd64.deb 86133786 BLAKE2B b33a53e48b190b70cc3cc2b7aa0b311a7e0f18423473fb45805cfaf60417eacb59f4e46aaa66b63f1511e4eff4ebbf6d2f3a8e905a7c7487cfdcedb119ed9959 SHA512 e0f3c4fde6cdd010314843457ac89407361046ad2ff69d919f2ac6b22d92bf96f89c63152eaa04c6071baa32eff747d56c23fc4a678d5700f2f98793a2fd3dd3
+DIST plexmediaserver_1.18.2.2029-36236cc4c_i386.deb 72963886 BLAKE2B 28b09dbaedad1394627231ce7747c7b6b6af8d6f8a0b9eec6bc9728dd7206d0a2f733f69109133c16c5a776c06c51b3c9e511cb53c46eb2345d27c1f1b1de650 SHA512 ed091de6593cd7a9a8c5c1b2c776a405816276f8902d352ed4cf251857cce191ea00a2ada58ace525b97c9ffbd675f756384f420fba7edc4ab056aaafec5acb9
+EBUILD plex-media-server-1.18.2.ebuild 5214 BLAKE2B 0c5c770dade237ec662a536623af23ba69013a3d526b2816d5783f6fa0ab173c3efcd0f4ebbab881940fd948adf592c33b169bf75569b681acef7547a7255d51 SHA512 a64d2b254b02d6a62560f6686fdd34d614a51cc5028d98046b23f585f4d47376fccae1a1302c282d8655f92ffd39f377aef3dec745cf0f464b8ccf43c5959e3b
+MISC metadata.xml 245 BLAKE2B 94154a8bdd62b19999d65d599876471c8e44c02209c12a20d75667a21eb873ad59b42d27536d54ff1274d57bad9d73d81eaacea36b8b02e01b40b9eb5e6c82d4 SHA512 c3c7907e50537dd94fdcec1da306eee2f050e5a456d369cd3df8c9bf36c810d811fe547418a8025e533916eb52a742d9feafae647b2957820d99ed962dad302e
diff --git a/media-tv/plex-media-server/files/conf.d/plex-media-server b/media-tv/plex-media-server/files/conf.d/plex-media-server
new file mode 100644
index 0000000..7fe754f
--- /dev/null
+++ b/media-tv/plex-media-server/files/conf.d/plex-media-server
@@ -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"
diff --git a/media-tv/plex-media-server/files/init.d/plex-media-server b/media-tv/plex-media-server/files/init.d/plex-media-server
new file mode 100755
index 0000000..102ac80
--- /dev/null
+++ b/media-tv/plex-media-server/files/init.d/plex-media-server
@@ -0,0 +1,20 @@
+#!/sbin/openrc-run
+
+depend() {
+ need avahi-daemon
+}
+
+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 $?
+}
diff --git a/media-tv/plex-media-server/files/systemd/plex-media-server.service b/media-tv/plex-media-server/files/systemd/plex-media-server.service
new file mode 100644
index 0000000..12412a8
--- /dev/null
+++ b/media-tv/plex-media-server/files/systemd/plex-media-server.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Plex Media Server
+After=network.target
+
+[Service]
+Type=simple
+User=plex
+ExecStart=/usr/sbin/start_pms
+
+[Install]
+WantedBy=multi-user.target
diff --git a/media-tv/plex-media-server/files/virtualenv_start_pms.patch b/media-tv/plex-media-server/files/virtualenv_start_pms.patch
new file mode 100644
index 0000000..bb4d575
--- /dev/null
+++ b/media-tv/plex-media-server/files/virtualenv_start_pms.patch
@@ -0,0 +1,23 @@
+--- a/usr/sbin/start_pms 2017-03-01 13:35:28.340489280 -0500
++++ b/usr/sbin/start_pms 2017-03-01 13:36:05.574540305 -0500
+@@ -8,16 +8,20 @@
+ 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
+
++# Activate python virtualenv
++. "${PLEX_MEDIA_SERVER_HOME}"/Resources/Python/bin/activate
++
++
+ if [ ! -d "$PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR" ]
+ then
+ mkdir -p "$PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR"
+ if [ ! $? -eq 0 ]
+ then
+ echo "WARNING COULDN'T CREATE $PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR, MAKE SURE I HAVE PERMISSON TO DO THAT!"
+ exit 1
+ fi
diff --git a/media-tv/plex-media-server/metadata.xml b/media-tv/plex-media-server/metadata.xml
new file mode 100644
index 0000000..1a06e96
--- /dev/null
+++ b/media-tv/plex-media-server/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person">
+ <email>chainsaw@gentoo.org</email>
+ <name>Tony Vroon</name>
+ </maintainer>
+</pkgmetadata>
diff --git a/media-tv/plex-media-server/plex-media-server-1.18.2.ebuild b/media-tv/plex-media-server/plex-media-server-1.18.2.ebuild
new file mode 100644
index 0000000..ff689da
--- /dev/null
+++ b/media-tv/plex-media-server/plex-media-server-1.18.2.ebuild
@@ -0,0 +1,162 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python2_7 )
+inherit eutils user systemd unpacker pax-utils python-single-r1
+
+MINOR_VERSION="2029-36236cc4c"
+
+_APPNAME="plexmediaserver"
+_USERNAME="plex"
+_SHORTNAME="${_USERNAME}"
+_FULL_VERSION="${PV}.${MINOR_VERSION}"
+
+URI="https://downloads.plex.tv/plex-media-server-new"
+
+DESCRIPTION="A free media library that is intended for use with a plex client."
+HOMEPAGE="https://www.plex.tv/"
+SRC_URI="amd64? ( ${URI}/${_FULL_VERSION}/debian/plexmediaserver_${_FULL_VERSION}_amd64.deb )
+ x86? ( ${URI}/${_FULL_VERSION}/debian/plexmediaserver_${_FULL_VERSION}_i386.deb )"
+SLOT="0"
+LICENSE="Plex"
+RESTRICT="bindist strip"
+KEYWORDS="-* ~x86 ~amd64"
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+DEPEND="
+ sys-apps/fix-gnustack
+ dev-python/virtualenv[${PYTHON_USEDEP}]"
+
+RDEPEND="
+ net-dns/avahi
+ ${PYTHON_DEPS}"
+
+QA_DESKTOP_FILE="usr/share/applications/plexmediamanager.desktop"
+QA_PREBUILT="*"
+QA_MULTILIB_PATHS=(
+ "usr/lib/${_APPNAME}/.*"
+ "usr/lib/${_APPNAME}/Resources/Python/lib/python2.7/.*"
+)
+
+EXECSTACKED_BINS=( "${ED}/usr/lib/plexmediaserver/libgnsdk_dsp.so*" )
+BINS_TO_PAX_MARK=( "${ED}/usr/lib/plexmediaserver/Plex Script Host" )
+
+S="${WORKDIR}"
+PATCHES=( "${FILESDIR}/virtualenv_start_pms.patch" )
+
+pkg_setup() {
+ enewgroup ${_USERNAME}
+ enewuser ${_USERNAME} -1 /bin/bash /var/lib/${_APPNAME} "${_USERNAME},video"
+ python-single-r1_pkg_setup
+}
+
+src_unpack() {
+ unpack_deb ${A}
+}
+
+src_install() {
+ # Move the config to the correct place
+ local CONFIG_VANILLA="/etc/default/plexmediaserver"
+ local CONFIG_PATH="/etc/${_SHORTNAME}"
+ dodir "${CONFIG_PATH}"
+ insinto "${CONFIG_PATH}"
+ doins "${CONFIG_VANILLA#/}"
+ sed -e "s#${CONFIG_VANILLA}#${CONFIG_PATH}/${_APPNAME}#g" -i "${S}"/usr/sbin/start_pms || die
+
+ # Remove Debian specific files
+ rm -rf "usr/share/doc" || die
+
+ # 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
+ local LOGGING_DIR="/var/log/pms"
+ dodir "${LOGGING_DIR}"
+ chown "${_USERNAME}":"${_USERNAME}" "${ED}/${LOGGING_DIR}" || die
+ keepdir "${LOGGING_DIR}"
+
+ # Create default library folder with correct permissions
+ local DEFAULT_LIBRARY_DIR="/var/lib/${_APPNAME}"
+ dodir "${DEFAULT_LIBRARY_DIR}"
+ chown "${_USERNAME}":"${_USERNAME}" "${ED}/${DEFAULT_LIBRARY_DIR}" || die
+ keepdir "${DEFAULT_LIBRARY_DIR}"
+
+ # Install the OpenRC init/conf files
+ doinitd "${FILESDIR}/init.d/${PN}"
+ doconfd "${FILESDIR}/conf.d/${PN}"
+
+ # Disabling due to Bug 644694
+ #_handle_multilib
+
+ # Mask Plex libraries so that revdep-rebuild doesn't try to rebuild them.
+ # Plex has its own precompiled libraries.
+ _mask_plex_libraries_revdep
+
+ # Install systemd service file
+ local INIT_NAME="${PN}.service"
+ local INIT="${FILESDIR}/systemd/${INIT_NAME}"
+ systemd_newunit "${INIT}" "${INIT_NAME}"
+
+ _remove_execstack_markings
+ _add_pax_markings
+
+ einfo "Configuring virtualenv"
+ virtualenv -v --no-pip --no-setuptools --no-wheel "${ED}"/usr/lib/plexmediaserver/Resources/Python || die
+ pushd "${ED}"/usr/lib/plexmediaserver/Resources/Python &>/dev/null || die
+ find . -type f -exec sed -i -e "s#${D}##g" {} + || die
+ popd &>/dev/null || die
+}
+
+pkg_postinst() {
+ einfo ""
+ elog "Plex Media Server is now installed. Please check the configuration file in /etc/${_SHORTNAME}/${_APPNAME} to verify the default settings."
+ elog "To start the Plex Server, run 'rc-config start plex-media-server', you will then be able to access your library at http://<ip>:32400/web/"
+}
+
+# Disabling the follow function due to Bug 644694.
+# We shouldn't register plex libraries in global
+# library path since this will cause other packages
+# on the system to break.
+
+# Finds out where the library directory is for this system
+# and handles ldflags as to not break library dependencies
+# during rebuilds.
+_handle_multilib() {
+ # Prevent revdep-rebuild, @preserved-rebuild breakage
+ cat > "${T}"/66plex <<-EOF || die
+ LDPATH="${EPREFIX}/usr/$(get_libdir)/plexmediaserver"
+ EOF
+
+ doenvd "${T}"/66plex
+}
+
+# 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.
+_mask_plex_libraries_revdep() {
+ dodir /etc/revdep-rebuild/
+
+ # Bug: 659702. The upstream plex binary installs its precompiled package to /usr/lib.
+ # Due to profile 17.1 splitting /usr/lib and /usr/lib64, we can no longer rely
+ # on the implicit symlink automatically satisfying our revdep requirement when we use $(get_libdir).
+ # Thus we will match upstream's directory automatically. If upstream switches their location,
+ # then so should we.
+ echo "SEARCH_DIRS_MASK=\"${EPREFIX}/usr/lib/plexmediaserver\"" > "${ED}"/etc/revdep-rebuild/80plexmediaserver
+}
+
+# Remove execstack flags from some libraries/executables
+# so that it works in hardened setups.
+_remove_execstack_markings() {
+ for f in "${EXECSTACKED_BINS[@]}"; do
+ # Unquoting 'f' so that expansion works.
+ fix-gnustack -f ${f} > /dev/null
+ done
+}
+
+# Add pax markings to some binaries so that they work on hardened setup.
+_add_pax_markings() {
+ for f in "${BINS_TO_PAX_MARK[@]}"; do
+ pax-mark m "${f}"
+ done
+}