plex-media-server: Add service, add _plex system user, ship better start_pms script, add default config

This commit is contained in:
Anachron 2019-04-13 16:54:32 +02:00 committed by maxice8
parent 1bbedfe121
commit f070a1f291
4 changed files with 55 additions and 3 deletions

View file

@ -0,0 +1,15 @@
# config for Plex Media Server
# ulimit -s $PLEX_MEDIA_SERVER_MAX_STACK_SIZE
export PLEX_MEDIA_SERVER_MAX_STACK_SIZE=3000
#export PLEX_MEDIA_SERVER_MAX_VIRTUAL_MEMORY=524288000
# the user that PMS should run as, defaults to 'plex'
# note that if you change this you might need to move
# the Application Support directory to not lose your
# media library (match what is in /etc/passwd)
#export PLEX_MEDIA_SERVER_USER="_plex"
# Uncomment this to use syslog for logging instead of
# sending logs to Plex Media Server.log
#export PLEX_MEDIA_SERVER_USE_SYSLOG=true

View file

@ -0,0 +1,5 @@
#!/bin/sh
[ -r ./conf ] && ./conf
chpst -u _plex:_plex start_pms

View file

@ -0,0 +1,28 @@
#!/bin/sh
# Set identification variables
. /etc/os-release
export PLEX_MEDIA_SERVER_INFO_VENDOR="${NAME}"
export PLEX_MEDIA_SERVER_INFO_DEVICE="PC"
export PLEX_MEDIA_SERVER_INFO_MODEL="$(uname -m)"
export PLEX_MEDIA_SERVER_INFO_PLATFORM_VERSION=$(date +%Y.%m.%d)
# change these parameters in /etc/default/plexmediaserver
export PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS=6
export PLEX_MEDIA_SERVER_HOME="/usr/lib/plexmediaserver"
export PLEX_MEDIA_SERVER_TMPDIR="/tmp"
export PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR="/var/plexmediaserver"
test -d "${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}" || mkdir "${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}"
test -e /etc/default/plexmediaserver && . /etc/default/plexmediaserver
export LD_LIBRARY_PATH="${PLEX_MEDIA_SERVER_HOME}/lib:${PLEX_MEDIA_SERVER_HOME}"
export TMPDIR="${PLEX_MEDIA_SERVER_TMPDIR}"
(
printf 'Starting "Plex Media Server" on %s (%s, %s)\n' "${PLEX_MEDIA_SERVER_INFO_VENDOR}" "${PLEX_MEDIA_SERVER_INFO_MODEL}" "${PLEX_MEDIA_SERVER_INFO_PLATFORM_VERSION}"
test -n "${PLEX_MEDIA_SERVER_MAX_STACK_SIZE}" && ulimit -s "${PLEX_MEDIA_SERVER_MAX_STACK_SIZE}"
test -n "${PLEX_MEDIA_SERVER_MAX_VIRTUAL_MEMORY}" && ulimit -v "${PLEX_MEDIA_SERVER_MAX_VIRTUAL_MEMORY}"
cd "${PLEX_MEDIA_SERVER_HOME}" && ./Plex\ Media\ Server
)

View file

@ -1,7 +1,7 @@
# Template file for 'plex-media-server'
pkgname=plex-media-server
version=1.15.3.876
revision=1
revision=2
_suffix=ad6e39743
archs="i686 x86_64 armv7 aarch64"
create_wrksrc=yes
@ -11,6 +11,7 @@ license="Proprietary"
homepage="https://www.plex.tv/media-server-downloads"
restricted=yes
repository=nonfree
system_accounts="_plex"
# See https://support.plex.tv/articles/categories/plex-media-server/
case "$XBPS_TARGET_MACHINE" in
@ -35,18 +36,21 @@ esac
nopie="yes"
nopie_files="/usr/lib/plexmediaserver/Plex DLNA Server"
make_dirs="/var/plexmediaserver 0755 _plex _plex"
do_extract() {
fn="${distfiles##*/}"
ar x "${XBPS_SRCDISTDIR}/${pkgname}-${version}/${fn}"
tar xf data.tar.xz
mv usr/{s,}bin
sed -i 's/export PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR.*/'\
'export PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR="${HOME}\/.pms"/g' usr/bin/start_pms
cp "${FILESDIR}/default" etc/default/plexmediaserver
cp "${FILESDIR}/start_pms" usr/bin/start_pms
rm -r etc/{apt,init}
}
do_install() {
vcopy etc /
vcopy usr /
vsv plex-media-server
vlicense "${FILESDIR}/LICENSE"
}