diff options
Diffstat (limited to 'multimedia')
-rw-r--r-- | multimedia/plexmediaserver/README | 15 | ||||
-rw-r--r-- | multimedia/plexmediaserver/doinst.sh | 26 | ||||
-rw-r--r-- | multimedia/plexmediaserver/plexmediaserver.SlackBuild | 114 | ||||
-rw-r--r-- | multimedia/plexmediaserver/plexmediaserver.info | 10 | ||||
-rw-r--r-- | multimedia/plexmediaserver/rc.plexmediaserver | 62 | ||||
-rw-r--r-- | multimedia/plexmediaserver/slack-desc | 19 |
6 files changed, 246 insertions, 0 deletions
diff --git a/multimedia/plexmediaserver/README b/multimedia/plexmediaserver/README new file mode 100644 index 0000000000000..c964ec8f6eee0 --- /dev/null +++ b/multimedia/plexmediaserver/README @@ -0,0 +1,15 @@ +Plex Media Server is the backend for the Plex media system. + +Plex's frontend media player, Plex Home Theater, is Windows/Mac only; +however, you can stream your local files on Linux from your web browser. +Plex Home Theater allows the user to manage and play video, photos, music, +and podcasts from a local or remote computer running Plex Media Server. + +Plex Media Server runs as plex:plex (UID/GID 279) with its $HOME as +/var/lib/plexmediaserver: + +# groupadd -g 279 plex +# useradd -u 279 -d /var/lib/plexmediaserver -s /bin/false -g plex plex + +After installing, grab an account from https://my.plexapp.com/ and visit +http://localhost:32400/manage to configure your server. diff --git a/multimedia/plexmediaserver/doinst.sh b/multimedia/plexmediaserver/doinst.sh new file mode 100644 index 0000000000000..0908c4e6c4802 --- /dev/null +++ b/multimedia/plexmediaserver/doinst.sh @@ -0,0 +1,26 @@ +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then + # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +# Keep same perms on rc.plexmediaserver.new: +if [ -e etc/rc.d/rc.plexmediaserver ]; then + cp -a etc/rc.d/rc.plexmediaserver etc/rc.d/rc.plexmediaserver.new.incoming + cat etc/rc.d/rc.plexmediaserver.new > etc/rc.d/rc.plexmediaserver.new.incoming + mv etc/rc.d/rc.plexmediaserver.new.incoming etc/rc.d/rc.plexmediaserver.new +fi + +config etc/rc.d/rc.plexmediaserver.new +config etc/default/plexmediaserver + +if [ -x /usr/bin/update-desktop-database ]; then + /usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1 +fi diff --git a/multimedia/plexmediaserver/plexmediaserver.SlackBuild b/multimedia/plexmediaserver/plexmediaserver.SlackBuild new file mode 100644 index 0000000000000..a7500077a085e --- /dev/null +++ b/multimedia/plexmediaserver/plexmediaserver.SlackBuild @@ -0,0 +1,114 @@ +#!/bin/sh +# Generated by Alien's SlackBuild Toolkit: http://slackware.com/~alien/AST +# Copyright 2009, 2010, 2011, 2012, 2013 Eric Hameleers, Eindhoven, Netherlands +# Slackware build script for plexmediaserver +# Written by Lionel Young <lionelyoung@gmail.com> +# Based on http://slackbuilds.org/template.SlackBuild + +PRGNAM=plexmediaserver +VERSION=${VERSION:-0.9.8.10.215-020456b} +PKG_VERSION=0.9.8.10.215.020456b +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +ARCH=${ARCH:-$(uname -m)} +if [ "$ARCH" = "i386" ]; then + DEBARCH="i386" + LIBDIRSUFFIX="" + ARCH="i386" +elif [ "$ARCH" = "i486" ]; then + DEBARCH="i386" + LIBDIRSUFFIX="" + ARCH="i386" +elif [ "$ARCH" = "x86_64" ]; then + DEBARCH="amd64" + LIBDIRSUFFIX="64" + ARCH="x86_64" +else + echo "Package for $(uname -m) architecture is not available." + exit 1 +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +PLEX_USER=${PLEX_USER:-279} +PLEX_GROUP=${PLEX_GROUP:-279} + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $PKG +rm -rf $PRGNAM-$PKG_VERSION +ar xv $CWD/${PRGNAM}_${VERSION}_${DEBARCH}.deb +tar xvf data.tar.gz +# Remove debian files +rm -f debian-binary control.tar.gz data.tar.gz +rm -rf $PKG/etc/apt/ $PKG/etc/init $PKG/etc/init.d +chown -R root:root . + +# Bail if user or group isn't valid on your system +if ! grep ^plex: /etc/passwd 2>&1 > /dev/null; then + +cat << EOF + + You must have a plex user to run this script + + # groupadd -g $PLEX_USER plex + # useradd -u $PLEX_USER -d /var/lib/$PRGNAM -s /bin/false -g plex plex + +EOF + + exit +elif ! grep ^plex: /etc/group 2>&1 > /dev/null; then + +cat << EOF + + You must have a plex group to run this script + # groupadd -g $PLEX_GROUP plex + +EOF + exit +fi + +mkdir -p $PKG/opt/$PRGNAM/bin/ +mv $PKG/usr/lib/plexmediaserver $PKG/opt/$PRGNAM/lib + +# Fix binary paths +mv usr/sbin/start_pms $PKG/opt/$PRGNAM/bin/ +sed -i -e "s#/usr/lib/plexmediaserver#/opt/$PRGNAM/lib#" \ + $PKG/opt/$PRGNAM/bin/start_pms +mkdir -p $PKG/usr/bin/ +ln -s /opt/$PRGNAM/bin/start_pms \ + $PKG/usr/bin/start_pms + +# Install a .desktop launcher: +mv usr/share/applications/plexmediamanager.desktop $PKG/opt/$PRGNAM/ +sed -i -e "s/x-www-browser/xdg-open/" \ + $PKG/opt/$PRGNAM/plexmediamanager.desktop +mkdir -p $PKG/usr/share/applications +ln -s /opt/$PRGNAM/plexmediamanager.desktop \ + $PKG/usr/share/applications/plexmediamanager.desktop + +rm -rf $PKG/usr/share/doc $PKG/usr/sbin $PKG/usr/lib + +mkdir -p $PKG/usr/doc/$PRGNAM-$PKG_VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$PKG_VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/var/lib/$PRGNAM +chown -R $PLEX_USER:$PLEX_GROUP $PKG/var/lib/$PRGNAM + +mkdir -p $PKG/etc/rc.d/ +cat $CWD/rc.$PRGNAM > $PKG/etc/rc.d/rc.$PRGNAM.new +chmod 0644 $PKG/etc/rc.d/rc.$PRGNAM.new + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +# makepkg +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$PKG_VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/multimedia/plexmediaserver/plexmediaserver.info b/multimedia/plexmediaserver/plexmediaserver.info new file mode 100644 index 0000000000000..f4597881a6666 --- /dev/null +++ b/multimedia/plexmediaserver/plexmediaserver.info @@ -0,0 +1,10 @@ +PRGNAM="plexmediaserver" +VERSION="0.9.8.10.215.020456b" +HOMEPAGE="http://www.plexapp.com/connected/" +DOWNLOAD="http://downloads.plexapp.com/plex-media-server/0.9.8.10.215-020456b/plexmediaserver_0.9.8.10.215-020456b_i386.deb" +MD5SUM="c657221a97b928ee160cd463987c9a5f" +DOWNLOAD_x86_64="http://downloads.plexapp.com/plex-media-server/0.9.8.10.215-020456b/plexmediaserver_0.9.8.10.215-020456b_amd64.deb" +MD5SUM_x86_64="c1a22b243acec9b2f417a5e93f5dfee2" +REQUIRES="" +MAINTAINER="Lionel Young" +EMAIL="lionelyoung@gmail.com" diff --git a/multimedia/plexmediaserver/rc.plexmediaserver b/multimedia/plexmediaserver/rc.plexmediaserver new file mode 100644 index 0000000000000..93598b361c91e --- /dev/null +++ b/multimedia/plexmediaserver/rc.plexmediaserver @@ -0,0 +1,62 @@ +#!/bin/sh + +# /etc/rc.d/rc.plexmediaserver - Start/stop/restart the plexmediaserver daemon. +# To make plexmediaserver start automatically at boot, make this +# file executable: chmod 0755 /etc/rc.d/rc.plexmediaserver and add it +# to slackware's startup scripts (ie: rc.local) +# + +PIDFILE="/var/run/plexmediaserver.pid" + +plexmediaserver_start() { + echo "Starting plexmediaserver..." + CHECK=$(ps aux | grep /usr/bin/start_pms | grep -v grep) + STATUS=$? + + # make sure plexmediaserver isn't running yet + if [ "$STATUS" == "1" ]; then + touch $PIDFILE + chown plex:plex $PIDFILE + + # Start plexmediaserver + sudo -u plex /usr/bin/start_pms & + else + echo "plexmediaserver is already active and running under PID: $(cat $PIDFILE)" + echo "if you think this is wrong, remove the offending PID file" + echo "and restart plexmediaserver" + exit 1 + fi +} + +plexmediaserver_stop() { + echo -n "Stopping plexmediaserver..." + if [ -r $PIDFILE ]; then + kill $(cat $PIDFILE) + killall "Plex Media Server" + rm $PIDFILE + echo "done" + else + killall "Plex Media Server" + rm $PIDFILE + echo "done" + fi +} + +# Let's see how we are being called. +case "$1" in + start) + plexmediaserver_start + ;; + stop) + plexmediaserver_stop + ;; + restart) + plexmediaserver_start + sleep 3 + plexmediaserver_stop + ;; + *) + echo "Usage: $(basename $0) {start|stop|restart}" + exit 1 + ;; +esac diff --git a/multimedia/plexmediaserver/slack-desc b/multimedia/plexmediaserver/slack-desc new file mode 100644 index 0000000000000..950b31b4bc227 --- /dev/null +++ b/multimedia/plexmediaserver/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +plexmediaserver: plexmediaserver (media center server) +plexmediaserver: +plexmediaserver: Plex is a media player system consisting of a player application +plexmediaserver: and an associated media server. This package is for the backend +plexmediaserver: media server. Plex's frontend media player, Plex Home Theater, +plexmediaserver: allows the user to manage and play video, photos, music, and podcasts +plexmediaserver: from a local or remote computer running Plex Media Server. +plexmediaserver: +plexmediaserver: Home: http://www.plexapp.com/connected/ +plexmediaserver: +plexmediaserver: |